code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
import requests
import json
resp = requests.get('https://secure.etvnet.com/api/v3.0/video/live/channels.json?access_token=48cc25c9-7530-4d58-b2dd-bf61b7985697&offset=Europe%2FLondo')
r = resp.json()['data']
print r[0]
for i in r:
print i['name']
| mahandra/recipes_video_conv | local_scripts/get_url.py | Python | gpl-2.0 | 258 |
"""
사이트 관리 도구 어드민 페이지 설정.
"""
from django.contrib import admin
from modeltranslation.admin import TranslationAdmin
from .models import Category, GroupServicePermission, Service, TopBanner
class CategoryAdmin(TranslationAdmin):
"""
:class:`Category` 모델에 대한 커스텀 어드민.
`django-modeltranlation` 에서 제공하는 :clas... | hangpark/kaistusc | apps/manager/admin.py | Python | bsd-2-clause | 1,268 |
import json
from inspect import signature, currentframe
from typing import Callable, Type, Tuple, List
from django.conf import settings
from django.http.request import HttpRequest
from django.http.response import HttpResponse, HttpResponseBadRequest, HttpResponseNotFound
from .exceptions import (
MissingOperation... | idlesign/django-xross | xross/utils.py | Python | bsd-3-clause | 8,148 |
import unittest
from colorutils import *
from colorutils.equality import *
class ColorUtilsTestCase(unittest.TestCase):
def test_rgb_equality_fn(self):
_c1 = Color((255, 0, 3))
_c2 = Color((255, 0, 3))
_c3 = Color((12, 255, 59), equality_fn=RGB_eq)
_c4 = Color((12, 255, 59))
... | edaniszewski/colorutils | test/test_equality.py | Python | mit | 1,449 |
"""Base class for destinations.
A destination is a place where Grow static builds can be deployed. Grow takes
a pod, builds a static fileset, and deploys it to a remote location (the
desitnation), suitable for serving the web site to live end users.
A "deployment" is a destination loaded up with a configuration.
Cur... | grow/grow | grow/deployments/destinations/base.py | Python | mit | 12,760 |
"""Database queries for blender vision project"""
"""
Custom queries for STRF db
"""
from docdb_lite.dbqueries import generic as _g
### --- Simple item queries --- ###
class name(_g.ItemQuery):
"""Item query for name of db object (mask, experiment, etc)"""
def __init__(self, *args, **kwargs):
super(na... | marklescroart/bvp | bvp/dbqueries.py | Python | bsd-2-clause | 893 |
#!/usr/bin/python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Michael Still and Canonical 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... | sileht/deb-openstack-nova | nova/tests/test_imagecache.py | Python | apache-2.0 | 27,589 |
# coding=utf-8
# This file is part of SickChill.
#
# URL: https://sickchill.github.io
# Git: https://github.com/SickChill/SickChill.git
#
# SickChill is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either vers... | dfalt974/SickRage | tests/sickchill_tests/show/show_tests.py | Python | gpl-3.0 | 4,719 |
"""
Django settings for google_analytics project.
Generated by 'django-admin startproject' using Django 1.9.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
impor... | valer0ck/google-analytics | google_analytics/settings.py | Python | mit | 3,707 |
from operator import attrgetter
import inspect
import subprocess
import os
import sys
from functools import partial
REVISION_CMD = 'git rev-parse --short HEAD'
def _get_git_revision():
try:
revision = subprocess.check_output(REVISION_CMD.split()).strip()
except subprocess.CalledProcessError:
... | RPGOne/Skynet | scikit-learn-c604ac39ad0e5b066d964df3e8f31ba7ebda1e0e/doc/sphinxext/github_link.py | Python | bsd-3-clause | 2,661 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2013 Zuza Software Foundation
#
# This file is part of Pootle.
#
# Pootle is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the Lic... | arky/pootle-dev | pootle/apps/pootle_contact/forms.py | Python | gpl-2.0 | 1,939 |
# coding: utf-8
"""
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from datetime import datetime
from pprint import pformat
from six import iterit... | janinko/pnc-cli | pnc_cli/swagger_client/models/product_version_singleton.py | Python | apache-2.0 | 3,179 |
#!/usr/bin/env python
"""
Fish Eggs and Larvae
====================
"""
from datetime import datetime, timedelta
from opendrift.readers.reader_constant import Reader as ConstantReader
from opendrift.models.larvalfish import LarvalFish
o = LarvalFish(loglevel=50)
#%%
# Seeding 20 fish eggs, which will hatch as larvae... | OpenDrift/opendrift | examples/example_larvae.py | Python | gpl-2.0 | 1,302 |
import datetime
import os
from sqlalchemy import create_engine
from sqlalchemy import MetaData, Table, Column, DateTime, Float, Integer, ForeignKey
from sqlalchemy import between, func
from sqlalchemy.sql import select
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy import Column, String, DateTime, Fl... | aguinane/energyusage | energy/models.py | Python | agpl-3.0 | 3,513 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
# Copyright 2013 Big Switch Networks
#
# Licensed under the Apache License, Version... | deepakselvaraj/federated-horizon | openstack_dashboard/api/__init__.py | Python | apache-2.0 | 2,148 |
#!/usr/bin/env python
#
#
# simple.py
#
# This is an example of sending data to server via websocket.
#
# Last updated by Jackie Lee on 08/12/11.
#
#
import websocket
import random
import time
print "Initiating..."
# you need to put your server ip or domain name here
ws = websocket.create_connec... | jackylee0424/Physioboard | sc-phonegap-tornado-websocket/Collector/simple.py | Python | mit | 1,149 |
from django.core.management.base import NoArgsCommand
from datetime import datetime, timedelta
from pytz import utc
from allauth.account.models import EmailAddress, EmailConfirmation
class Command(NoArgsCommand):
def set_user_inactive(self, yesterday):
outstanding = EmailAddress.objects.filter(verified=... | nagyistoce/geokey | geokey/users/management/commands/check_confirm.py | Python | apache-2.0 | 851 |
"""
Tests for waffle utils features.
"""
import ddt
from django.test import TestCase
from mock import patch
from opaque_keys.edx.keys import CourseKey
from waffle.testutils import override_flag
from request_cache.middleware import RequestCache
from .. import CourseWaffleFlag, WaffleFlagNamespace
from ..models import ... | fintech-circle/edx-platform | openedx/core/djangoapps/waffle_utils/tests/test_init.py | Python | agpl-3.0 | 2,228 |
# vim: ts=4:sw=4:expandtab
# -*- coding: UTF-8 -*-
# BleachBit
# Copyright (C) 2008-2021 Andrew Ziem
# https://www.bleachbit.org
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version... | bleachbit/bleachbit | bleachbit/Unix.py | Python | gpl-3.0 | 26,681 |
# -*- coding: 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 model 'NarrativeConfig'
db.create_table(u'narrative_narrativeconfig', (
(u'id', self.gf... | ambitioninc/django-narrative | narrative/south_migrations/0016_auto__add_narrativeconfig.py | Python | mit | 6,622 |
'''
pickle Ä£¿éͬ marshal Ä£¿éÏàͬ, ½«Êý¾ÝÁ¬Ðø»¯, ±ãÓÚ±£´æ´«Êä.
Ëü±È marshal ÒªÂýһЩ, µ«Ëü¿ÉÒÔ´¦ÀíÀàʵÀý, ¹²ÏíµÄÔªËØ, ÒÔ¼°µÝ¹éÊý¾Ý½á¹¹µÈ.
'''
import pickle
value = (
"this is a string",
[1, 2, 3, 4],
("more tuples", 1.0, 2.3, 4.5),
"this is yet another string"
)
data = pickle.dumps(value)
# interme... | iamweilee/pylearn | pickle-example-1.py | Python | mit | 509 |
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from gcp_common import BaseTest
class InventoryTest(BaseTest):
def test_instance_query(self):
factory = self.replay_flight_data(
'instance-asset-query',
project_id='cloud-custodian'
)
... | alfredgamulo/cloud-custodian | tools/c7n_gcp/tests/test_inventory.py | Python | apache-2.0 | 1,726 |
import pytest
from ethereum import tester as t
from ethereum import blocks, utils, transactions, vm, abi, opcodes
from ethereum.exceptions import InvalidTransaction
import rlp
from rlp.utils import decode_hex, encode_hex, ascii_chr, str_to_bytes
from ethereum import processblock as pb
import copy
from ethereum.db impo... | shahankhatch/pyethereum | ethereum/testutils.py | Python | mit | 23,994 |
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
import os
from waflib import Context,Task,Utils,Options,Errors,Logs
from waflib.TaskGen import taskgen_method,before_method,feature,extension
from waflib.Configure import conf
@taskgen_method
def add... | softDi/clusim | ns3/ns-3.26/.waf-1.8.19-b1fc8f7baef51bd2db4c2971909a568d/waflib/Tools/glib2.py | Python | apache-2.0 | 10,566 |
'''
Support for WM_TOUCH messages (Windows platform)
================================================
'''
__all__ = ('WM_MotionEventProvider', 'WM_MotionEvent')
import os
from kivy.input.providers.wm_common import WNDPROC, \
SetWindowLong_WndProc_wrapper, RECT, POINT, WM_TABLET_QUERYSYSTEMGESTURE, \
QUERYSYST... | kivy/kivy | kivy/input/providers/wm_touch.py | Python | mit | 5,945 |
# -*- coding: utf-8 -*-
try:
from BeautifulSoup import BeautifulSoup as bss
except:
from bs4 import BeautifulSoup as bs
try:
import urllib2
except:
import urllib.request as urllib2
import urllib
import re
def read_url(url):
html=urllib2.urlopen(url).read()
try:
import HTMLParser
h = HTMLPa... | sanctuaryaddon/sanctuary | script.module.liveresolver/lib/liveresolver/modules/webutils.py | Python | gpl-2.0 | 861 |
# Lint as: python3
"""Transformer encoder implementation in JAX based on official TF model."""
from __future__ import absolute_import
from __future__ import division
from __future__ import REDACTED
from __future__ import print_function
from typing import List
from absl import flags
from flax import nn
from flax.train... | mlperf/training_results_v0.7 | Google/benchmarks/bert/implementations/bert-research-JAX-tpu-v3-8192/transformer_encoder.py | Python | apache-2.0 | 13,371 |
from myhdl import Signal, intbv, always_seq, always, always_comb, ConcatSignal, block, instances
from hdmi.cores.transmitter import serdes_n_to_1, encode, convert_30_to_15
@block
def hdmi_encoder(p_clock, p_clockx2, p_clockx10, reset, serdes_strobe,
video_interface, aux_interface, hdmi_interface):
... | srivatsan-ramesh/HDMI-Source-Sink-Modules | hdmi/cores/transmitter/hdmi_encoder.py | Python | mit | 5,666 |
from __future__ import absolute_import
from .check_info import check_info_annotation
from .rank_scores import build_rank_score_dict
from .build_info import (build_info_string, build_info_dict)
from .build_compounds import build_compounds_dict
from .build_models import build_models_dict
from .build_vep import (build_ve... | moonso/vcf_parser | vcf_parser/utils/__init__.py | Python | mit | 481 |
# Copyright 2019 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/cmake/traceparser.py | Python | apache-2.0 | 29,936 |
from abc import ABCMeta, abstractmethod, abstractproperty
class IService(object):
__metaclass__ = ABCMeta
@abstractmethod
def get_thread_messages(self, actor, thread, limit=None, offset=None):
"""
:type actor: L{pyligaforex.services.chats.interfaces.IActor}
:type thread: L{pyligaf... | cordis/pycloudia-chat | pyligaforex/services/chats/interfaces.py | Python | mit | 2,086 |
from generator import ContactGenerator
import allure
def test_check_fields_on_home_page(app, db):
with allure.step("Given a contact list from database"):
contacts_from_database = db.get_contact_list()
if len(contacts_from_database) == 0:
app.contact.create(ContactGenerator().get_contac... | melipharo/stru-python19 | test/test_check_contact_fields.py | Python | bsd-2-clause | 1,100 |
a = int(input())
print("The next number for the number %s is %s." % (a, a+1))
print("The previous number for the number %s is %s." % (a, a-1))
| Kulikovpavel/Programming-club | tkinter-examples/print.py | Python | mit | 143 |
#!/usr/bin/env python
import argparse
import json
from lib import host_utils
from lib import mysql_lib
from lib.environment_specific import TEST_MYSQL_SHARDS_CONFIG_LOCAL_PATH
from lib.environment_specific import MYSQL_SHARDS_CONFIG_LOCAL_PATH
DEFAULT = 'default'
OUTPUT_FORMAT = ('{replica_set:<RS}'
... | pinterest/mysql_utils | check_shard_mappings.py | Python | gpl-2.0 | 2,794 |
import re
import sys
#TODO allow strings here
type_map = {
'bool': 'Boolean',
'int': 'Integer',
'unsigned int': 'Integer',
'long': 'Integer',
'short': 'Integer',
'char': 'Integer',
'double': 'Number',
'float': 'Number',
'char*': 'String',
'char *': 'String',
'rgba': 'String'
... | hashcube/native-android | gradleops/AndroidSeed/tealeaf/src/main/jni/tools/struct_wrapper.py | Python | gpl-3.0 | 7,057 |
# -*- coding: utf-8 -*-
import sys
import os
import unittest
import trytond.tests.test_tryton
from trytond.tests.test_tryton import test_view, test_depends
DIR = os.path.abspath(os.path.normpath(os.path.join(
__file__, '..', '..', '..', '..', '..', 'trytond'
)))
if os.path.isdir(DIR):
sys.path.insert(0, os.pa... | priyankarani/trytond-customs-value | tests/test_views_depends.py | Python | bsd-3-clause | 1,157 |
"""Test MQTT fans."""
import json
from unittest.mock import ANY
from homeassistant.components import fan, mqtt
from homeassistant.components.mqtt.discovery import async_start
from homeassistant.const import ATTR_ASSUMED_STATE, STATE_UNAVAILABLE
from homeassistant.setup import async_setup_component
from tests.common i... | HydrelioxGitHub/home-assistant | tests/components/mqtt/test_fan.py | Python | apache-2.0 | 14,865 |
###############################################################################
# ilastik: interactive learning and segmentation toolkit
#
# Copyright (C) 2011-2014, the ilastik developers
# <team@ilastik.org>
#
# This program is free software; you can redistribute it and/or
# mod... | nielsbuwen/ilastik | ilastik/shell/gui/splashScreen.py | Python | gpl-3.0 | 1,515 |
#!/usr/bin/env python
"""
This file is part of open-ihm.
open-ihm is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
open-ihm is di... | tectronics/open-ihm | src/openihm/data/simulation.py | Python | lgpl-3.0 | 3,914 |
# 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... | cloudera/hue | apps/sqoop/src/sqoop/client/config.py | Python | apache-2.0 | 2,358 |
"""
Unit test to make sure examples each load and can make a hypothesis and data, and support sampling
"""
import unittest
from LOTlib.Examples import load_example
from LOTlib.Inference.Samplers.MetropolisHastings import MHSampler
class ExampleLoaderTest(unittest.TestCase):
def runTest(self):
for model... | piantado/LOTlib | LOTlib/Examples/testExamples.py | Python | gpl-3.0 | 1,085 |
import sys
import av
fh = av.open(sys.argv[1])
fh.streams.video[0].export_mvs = True
# fh.streams.video[0].flags2 |= 'EXPORT_MVS'
for pi, packet in enumerate(fh.demux()):
for fi, frame in enumerate(packet.decode()):
for di, data in enumerate(frame.side_data):
print(pi, fi, di, data)
... | mikeboers/PyAV | scratchpad/sidedata.py | Python | bsd-3-clause | 486 |
import pytest
from selenium import webdriver
@pytest.fixture
def driver (request):
wd = webdriver.Firefox()
request.addfinalizer(wd.quit)
return wd
def test_example(driver):
driver.get("http://localhost/litecart/en/")
driver.find_element_by_css_selector(".category-1").click()
products=driver.f... | talareq/selenium | test/label_checker.py | Python | apache-2.0 | 591 |
from __future__ import unicode_literals
import django_filters
from django.db.models import Q
from .models import Secret, SecretRole
from dcim.models import Device
from utilities.filters import NumericInFilter
class SecretRoleFilter(django_filters.FilterSet):
class Meta:
model = SecretRole
fiel... | snazy2000/netbox | netbox/secrets/filters.py | Python | apache-2.0 | 1,476 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('events', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='eventpage',
name='audi... | aksh1/wagtail-cookiecutter-foundation | {{cookiecutter.repo_name}}/events/migrations/0002_auto_20151014_1415.py | Python | mit | 839 |
import pytest
from events.importer.util import replace_location
from events.models import Event
@pytest.mark.django_db
def test_replace_location_by_different_source(place, place2, other_data_source, event):
assert event.location == place
place2.name = place.name
place2.save()
replace_location(replace... | City-of-Helsinki/linkedevents | events/tests/test_importer_util.py | Python | mit | 455 |
#!/usr/bin/env python
#-*-*- encoding: utf-8 -*-*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individual... | zstars/weblabdeusto | server/src/weblab/core/alive_users.py | Python | bsd-2-clause | 9,111 |
#This Python scrip will loop 20 times calculating the final velocity and
#displacemet for each i value
#Example 1
X_i = 829.8
V_i = 0
g = -9.81
times = range(0, 20, 1)
for i in times: #i = 20 numbers ranging from 0 to 19
V_f = V_i + g * t
X_f = X_i + V_i * t + 0.5 * g * t*... | TshepoMK/PyLib1.0 | 2.1 For Loop.py | Python | gpl-2.0 | 1,585 |
import unittest
from etk.knowledge_graph.node import Node, URI, BNode, Literal, LiteralType
from etk.etk_exceptions import InvalidGraphNodeValueError, UnknownLiteralType
class TestKGNode(unittest.TestCase):
def test_nodes_node(self):
with self.assertRaises(InvalidGraphNodeValueError):
Node(Non... | usc-isi-i2/etk | etk/unit_tests/test_kg_node.py | Python | mit | 3,268 |
# coding: utf-8
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.113
Contact: api-support@onshape.zendesk.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
im... | onshape-public/onshape-clients | python/onshape_client/oas/models/bt_user_settings_info.py | Python | mit | 10,790 |
#
# Copyright (C) 2010, 2013 Red Hat, Inc.
# Copyright (C) 2010 Cole Robinson <crobinso@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at yo... | Akasurde/virt-manager | virtManager/libvirtobject.py | Python | gpl-2.0 | 13,152 |
from .replot import Axes
__version__ = "0.0.1"
__all__ = ["Axes"]
| benbaror/replotlib | src/replotlib/__init__.py | Python | bsd-2-clause | 68 |
"""
inputpy.impexp
This module exports various Importers and Exporters.
Right now, there are only one set of Import/Export classes, both of which are
dummy implementations:
- XMLFileExporter
- XMLFileImporter
:copyright: (c) 2013 by Christoffer Fink.
:license: MIT. See LICENSE for details.
"""
class XMLFileExporter:
... | finkn/InPUTpy | inputpy/impexp.py | Python | mit | 438 |
# -*- coding: utf-8 -*-
"""
A Theil-Sen Estimator for Multiple Linear Regression Model
"""
# Author: Florian Wilhelm <florian.wilhelm@gmail.com>
#
# License: BSD 3 clause
import warnings
from itertools import combinations
import numpy as np
from scipy import linalg
from scipy.special import binom
from scipy.linalg.... | lesteve/scikit-learn | sklearn/linear_model/_theil_sen.py | Python | bsd-3-clause | 14,803 |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
# Copyright (c) 2018-2019 NVIDIA CORPORATION. All rights reserved.
import torch
from torch import nn
from torch.autograd import Function
from torch.autograd.function import once_differentiable
from torch.nn.modules.utils import _pair
from maskrcnn... | mlperf/training_results_v0.7 | NVIDIA/benchmarks/maskrcnn/implementations/pytorch/maskrcnn_benchmark/layers/roi_pool.py | Python | apache-2.0 | 1,951 |
import glob
import unittest
def test():
test_file_strings = glob.glob('test_*.py')
module_strings = [str[0:len(str)-3] for str in test_file_strings]
suites = [unittest.defaultTestLoader.loadTestsFromName(str) for str
in module_strings]
return unittest.TestSuite(suites)
if __name__ == '__ma... | faircloth-lab/rhino | rhino/tests/run.py | Python | bsd-3-clause | 411 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import base64
import werkzeug
import werkzeug.exceptions
import werkzeug.urls
import werkzeug.wrappers
import math
from dateutil.relativedelta import relativedelta
from operator import itemgetter
from odoo import field... | ddico/odoo | addons/website_profile/controllers/main.py | Python | agpl-3.0 | 14,537 |
# -*- coding: utf-8 -*-
#
# test_growth_curves.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the Lice... | hesam-setareh/nest-simulator | pynest/nest/tests/test_sp/test_growth_curves.py | Python | gpl-2.0 | 15,643 |
import os
import unittest
import mock
from hpcbench.benchmark.nvidia import NvidiaP2pBandwidthLatencyTest
from .benchmark import AbstractBenchmarkTest
class TestNvidiaP2pBandwidthLatency(AbstractBenchmarkTest, unittest.TestCase):
def setUp(self):
self.prev_cuda_visible_devices = os.environ.get('CUDA_VIS... | tristan0x/hpcbench | tests/benchmark/test_nvidia-p2pBandwidthLatencyTest.py | Python | mit | 2,801 |
try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
setup(
name='pylonsapp',
version='0.1',
description='',
author='',
author_email='',
#url='',
install_requires... | abourget/formalchemy-abourget | pylonsapp/setup.py | Python | mit | 1,043 |
#!/usr/bin/env python
"""Example code of DQN and DoubleDQN on OpenAI Gym environments.
For DQN, see: https://www.nature.com/articles/nature14236
For DoubleDQN, see: https://arxiv.org/abs/1509.06461
"""
from __future__ import division
import argparse
import collections
import copy
import random
import gym
import numpy... | rezoo/chainer | examples/reinforcement_learning/dqn_cartpole.py | Python | mit | 7,787 |
import socket
__author__ = 'c.vargas124'
import win32com.client
# Iniciando Vissim...
vissim = win32com.client.Dispatch("Vissim.Vissim")
vissim.LoadNet("C:\Users\c.vargas124\Desktop\int_rincon\int_rincon.inpx")
# Obteniendo referencias a los elementos...
sim = vissim.Simulation
net = vissim.Net
veh = net.V... | vargax/ejemplos | python/imagine/vafus_pyVissim/demos/francia/vissim_francia_verde.py | Python | gpl-2.0 | 1,438 |
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# bu... | farhaanbukhsh/bodhi | bodhi/cli.py | Python | gpl-2.0 | 11,187 |
# -*- coding: utf-8 -*-
#
# This file is part of Zenodo.
# Copyright (C) 2020 CERN.
#
# Zenodo is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later v... | slint/zenodo | zenodo/modules/tokens/config.py | Python | gpl-2.0 | 1,320 |
import ConfigParser
import datetime
import json
import os
import re
import time
import uuid
import paramiko
import pasteraw
from pygerrit import rest
from pygerrit.rest import auth
from publish import publish
_COMMENT = """
Master Results (sha: {master_sha})
Token creation
Requests per second: {master_create_... | lbragstad/keystone-performance | scheduler/schedule.py | Python | apache-2.0 | 14,481 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connectivity_parameters_py3.py | Python | mit | 1,429 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#+---------------------------------------------------------------------------+
#| 01001110 01100101 01110100 01111010 01101111 01100010 |
#| |
#| Netzob : Inferring comm... | dasbruns/netzob | test/src/test_netzob/test_Common/suite_Type.py | Python | gpl-3.0 | 2,410 |
"""Emission python module
This module is for everyone who wants to build tools / systems for calculating vehicle
emissions for various types of vehicles (Trucks, Buses, Cars, Vans, scooters, ..).
The calculation and factors is provided by the EU EEA guidebook: http://www.eea.europa.eu/publications/emep-eea-guidebook-... | NPRA/EmissionCalculatorLib | emission/__init__.py | Python | bsd-2-clause | 1,488 |
# -*- coding: utf-8 -*-
u"""pytest for `pykern.pkconfig`
:copyright: Copyright (c) 2015-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_channel_in(pkconfig_setup):
"""Va... | radiasoft/pykern | tests/pkconfig1_test.py | Python | apache-2.0 | 1,858 |
"""
Routines for testing or asserting that a value is certain type, in a way that
works in both Python 2.7 and Python 3.4.
"""
from __future__ import print_function, division, absolute_import
# In Python 3, the "unicode" and "long" types went away.
string_types = (str,) # Python 2 and 3.
try:
string_types += (uni... | hammerlab/typechecks | typechecks/__init__.py | Python | apache-2.0 | 3,859 |
"""
Django settings for webapp project.
Generated by 'django-admin startproject' using Django 1.11.7.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
... | rca/issuebranch | src/webapp/webapp/settings.py | Python | apache-2.0 | 3,048 |
import numpy as np
# Axes of chains are nwalker,nsteps,nparams
chain1=np.load('model1_nax20_DM_run1.npy')
chain2=np.load('model1_nax20_DM_run2.npy')
newchain=np.concatenate((chain1,chain2),axis=1)
np.save('model1_nax20_DM.npy',newchain) | DoddyPhysics/AxionNet | Chains/addChains.py | Python | mit | 240 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be usefu... | scylladb/scylla-longevity-tests | sdcm/utils/ssh_agent.py | Python | agpl-3.0 | 2,378 |
"""
Copyright 2016-2017 Ellation, 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, sof... | crunchyroll/ef-open | tests/unit_tests/test_ef_version.py | Python | apache-2.0 | 16,634 |
import sys
if sys.version_info[0] > 2:
def encode(s):
if isinstance(s, str):
s = s.encode('utf-8', 'ignore')
return s
def decode(s):
if isinstance(s, bytes):
s = s.decode('utf-8', 'ignore')
return s
else:
def encode(s):
if isinstance(s, unico... | imron/scalyr-agent-2 | scalyr_agent/third_party/pysmi/compat.py | Python | apache-2.0 | 498 |
import requests, sys
from ConfigParser import ConfigParser
from config_helper import api_info, get_proxies
from printing_helper import *
import rest
def get_top_stories():
url = "https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty"
return rest.get(url, proxies = get_proxies(), verify=rest.get_pe... | nramanan/nellie-bot | restagents/hackernews.py | Python | mit | 853 |
#!/usr/bin/env python3
# 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 o... | google/google-ctf | 2021/quals/hw-comlink/challenge/src/verify.py | Python | apache-2.0 | 2,152 |
# coding: utf-8
from __future__ import absolute_import, unicode_literals
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from ..payment_provider import BasePaymentProvider
from .tasks import process_pledge
from .app_... | feinheit/zipfelchappe | zipfelchappe/paypal/provider.py | Python | bsd-3-clause | 1,897 |
#-----------------------------------------------------------------------------
# Name: Config.py
# Product: ClamWin Free Antivirus
#
# Author: alch [alch at users dot sourceforge dot net]
#
# Created: 2004/19/03
# Copyright: Copyright alch (c) 2004
# Licence:
# This program is free soft... | ghostshellgnome/clamwin | py/Config.py | Python | gpl-2.0 | 6,253 |
""" rewrite of lambdify - This stuff is not stable at all.
It is for internal use in the new plotting module.
It may (will! see the Q'n'A in the source) be rewritten.
It's completely self contained. Especially it does not use lambdarepr.
It does not aim to replace the current lambdify. Most importantly it will never... | hrashk/sympy | sympy/plotting/experimental_lambdify.py | Python | bsd-3-clause | 24,795 |
"""Generic daemon class."""
import atexit
import errno
import os
import signal
import sys
import time
import eventlet.tpool
import gevent
class Daemon:
"""A generic daemon class.
Usage: subclass the Daemon class and override the run() method
"""
def __init__(self, pidfile, stdin=os.devnull, stdout... | lqmanh/daethon | daethon.py | Python | apache-2.0 | 5,713 |
#Generates Scripts for Myo
#Jake Chapeskie
#2014
import argparse
DEBUG_MODE=False #Set to true for extra print outputs
def debugPrint(s):
if DEBUG_MODE==True:
print(s)
return
def keyTwoMyo(key):
#TODO: Add special character parsing
str='myo.keyboard("'+key+'","press")'
return str
# parse Command Line inputs
pa... | 16cameronk/MyoScripts | ScriptGeneratorPython/generateScript.py | Python | mit | 2,643 |
import numpy as np
from holoviews.element import QuadMesh, Image, Dataset
from .test_plot import TestMPLPlot, mpl_renderer
class TestQuadMeshPlot(TestMPLPlot):
def test_quadmesh_invert_axes(self):
arr = np.array([[0, 1, 2], [3, 4, 5]])
qmesh = QuadMesh(Image(arr)).opts(plot=dict(invert_axes=Tr... | ioam/holoviews | holoviews/tests/plotting/matplotlib/test_quadmeshplot.py | Python | bsd-3-clause | 1,790 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-10-10 02:33
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('vpc', '0041_auto_20170930_1707'),
]
operations = [
migrations.AlterField(
... | hyperwd/hwcram | vpc/migrations/0042_auto_20171010_1033.py | Python | mit | 864 |
from django.contrib.auth.forms import AuthenticationForm
from django import forms
from django.shortcuts import get_object_or_404
from .models import UserDebitItem, Account
class UserForm(forms.Form):
username = forms.CharField(label="Username", max_length=30,
widget=forms.TextInput(attrs={'class': 'form-... | sk364/Money_Management | manage_your_money/forms.py | Python | mit | 2,331 |
# 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
# distrib... | openstack/python-openstackclient | openstackclient/tests/unit/identity/v3/test_endpoint.py | Python | apache-2.0 | 29,073 |
# -*- coding: utf-8 -*-
import json
import mock
import nose.tools as nt
from ckan.lib import search
from ckan import model
import ckan.new_tests.helpers as helpers
import ckan.new_tests.factories as factories
import ckanext.harvest.model as harvest_model
from ckanext.harvest.tests.factories import HarvestJobFactory... | Nithyavasudevan/ckanext-glasgow | ckanext/glasgow/tests/harvest/test_harvest.py | Python | agpl-3.0 | 16,143 |
#!/usr/bin/env python
import itertools
import sys
import time
import ipaddress as ipa # https://docs.python.org/3/library/ipaddress.html
import lookup
class IP(object):
"""
IP and information specific to it. Hosts contain multiple IPs,
as a domain can resolve to multiple IPs.
Keyword arguments:
... | drptbl/instarecon | src/ip.py | Python | mit | 7,083 |
#!/usr/bin/env python2
# Copyright (c) 2014 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Exercise the wallet keypool, and interaction with wallet encryption/locking
# Add python-monetarpc to modul... | biton-project/moneta-0.10.0 | qa/rpc-tests/keypool.py | Python | mit | 4,257 |
import time
from pathos.multiprocessing import ProcessPool
import numpy as np
import pandas as pd
def undirect(self,ncores=4):
'''
Remove directional links between species by finding the net weight of the jacobian
'''
dct={}
specs = self.spec.columns
iterate = []
for i in specs:
... | wolfiex/DSMACC-testing | dsmacc/graph/STPR/dsmacc_tools.py | Python | gpl-3.0 | 1,601 |
""" snoevsen script. """
from common import info
import mshr
import dolfin as df
import numpy as np
import os
from generate_mesh import MESHES_DIR, store_mesh_HDF5
import matplotlib.pyplot as plt
def description(**kwargs):
info("Snoevsen mesh.")
def method(L=3., H=1., R=0.3, n_segments=40, res=60, show=False, *... | gautelinga/BERNAISE | utilities/mesh_scripts/snoevsen.py | Python | mit | 1,471 |
#!/usr/bin/python
#
# Copyright 2007 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 a... | wyom/sympy-live | shell.py | Python | bsd-3-clause | 28,178 |
# Copyright 2014 Hewlett-Packard
#
# 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... | hpcloud-mon/monasca-events-api | monasca_events_api/api/events_api_v2.py | Python | apache-2.0 | 948 |
#! /usr/bin/env python
from sys import argv
script, q1, q2, k = argv
fw = open('c.txt', 'w+')
for docid in range(1,192):
filename = 'data/' + str(docid) + '.txt'
fr = open(filename)
string = fr.read()
pp1 = []
pp2 = []
l = []
position = 0
for token in string.split():
if token == q1:
pp1.append(position... | fortesit/search-engine | posting-list-search-k-distanced-words.py | Python | mit | 663 |
from PyQt4.QtCore import *
from PyQt4.QtSql import *
from blur.Stone import *
from blur.Classes import *
from verifier_plugin_factory import *
requiredShots = {}
requiredShots['30'] = [['21a_020', 'hf2-light'],
['21a_040', 'hf2-light'],
['04_060', 'hf2-light'],
... | lordtangent/arsenalsuite | python/scripts/verifier_plugins/urgentPrios.py | Python | gpl-2.0 | 1,171 |
# 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 u... | mahak/neutron | neutron/conf/policies/segment.py | Python | apache-2.0 | 3,171 |
#!/usr/bin/python
from src.sqllist import GLOBALS
class BasicResolver(object):
"""General resolver class"""
def __init__(self, conn=None):
self.conn = conn
pass
def resolve(self, detections, sources):
"""Template resolve function.
Returns resolution status and an array... | jjdmol/LOFAR | CEP/GSM/bremen/src/resolve.py | Python | gpl-3.0 | 2,496 |
from .copy_back import CopyBack as CopyBack
from .prepare import Prepare as Prepare
from .prepare_builder import BackupPrepareBuilderChecker as BackupPrepareBuilderChecker
| ShahriyarR/MySQL-AutoXtraBackup | mysql_autoxtrabackup/backup_prepare/__init__.py | Python | mit | 172 |
import sys
a, b = map(int, sys.stdin.readline().split())
while a != 0 and b != 0:
print(a//b, a%b, '/', b)
a, b = map(int, sys.stdin.readline().split())
| SirDavidLudwig/KattisSolutions | problems/mixedfractions/mixedfractions.py | Python | gpl-3.0 | 156 |
from __future__ import with_statement
import sys
from scriptine import run
from contextlib import contextmanager
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
state = set()
@contextmanager
def stdout_capture():
orig_stdout, orig_stderr = sys.stdout, sys.stderr
s... | olt/scriptine | test/test_command.py | Python | mit | 1,396 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.