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 os
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
cls = get_driver(Provider.ONEANDONE)
drv = cls(key=os.environ.get('ONEANDONE_TOKEN'))
# First we need to get all avaliable sizes
sizes = drv.list_sizes()
# Then we select one we want to use to create a node. We p... | vongazman/libcloud | docs/examples/compute/oneandone/create_node.py | Python | apache-2.0 | 1,130 |
import _plotly_utils.basevalidators
class OpacityValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="opacity", parent_name="box.marker", **kwargs):
super(OpacityValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/box/marker/_opacity.py | Python | mit | 528 |
# 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/clusterfuzz/_internal/tests/core/local/butler/package_test.py | Python | apache-2.0 | 3,888 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import logging
import xml.etree.ElementTree as ET
import requests
from flexget import plugin
from flexget.config_schema import one_or_more
from flexget.event import event
... | jawilson/Flexget | flexget/plugins/notifiers/notifymyandroid.py | Python | mit | 2,961 |
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 25 09:42:22 2016
@author: bing
"""
import numpy as np
#import scipy
import numba
import sys
import math
bohr_angstrom = 0.52917721092
hartree_wavenumber = 219474.63
#hartree_wavenumber = scipy.constants.value(u'hartree-inverse meter relationship') / 1e2
def M... | binghongcha08/pyQMD | sys_bath/bilinear/sys_bath_lqf.py | Python | gpl-3.0 | 10,991 |
from scrapy import Spider
from scrapy.http import Request
from firmware.items import FirmwareImage
from firmware.loader import FirmwareLoader
import urllib.request, urllib.parse, urllib.error
class UbloxSpider(Spider):
name = "ublox"
allowed_domains = ["u-blox.com"]
start_urls = [
"https://www.u-... | firmadyne/scraper | firmware/spiders/ublox.py | Python | mit | 1,271 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (c) 2011 Openstack, LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www... | rackerlabs/openstack-guest-agents-unix | tests/test_jsonparser.py | Python | apache-2.0 | 2,431 |
#! /usr/bin/env python
###########################################################################
#
# This program is part of Zenoss Core, an open source monitoring platform.
# Copyright (C) 2007, 2009 Zenoss Inc.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU ... | zenoss/ZenPacks.nozen.HPUXMon | ZenPacks/nozen/HPUXMon/zenhpuxprocess.py | Python | gpl-2.0 | 37,853 |
# -*- coding: utf-8 -*-
# Copyright (C) 2008-2009 Team XBMC http://www.xbmc.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 2 of the License, or
# (at your option)... | osmc/osmc | package/mediacenter-eventclients-common-osmc/files/usr/share/pyshared/xbmc/bt/hid.py | Python | gpl-2.0 | 3,013 |
from ._version import __version__
# :obj:`str`: version
# API
from .core import (CoverageType, Environment,
BuildHelper, BuildHelperError,
TestResults, TestCaseResult, TestCaseResultType)
| KarrLab/Karr-Lab-build-utils | karr_lab_build_utils/__init__.py | Python | mit | 227 |
# 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
# d... | apporc/oslo.messaging | oslo_messaging/tests/drivers/zmq/test_zmq_async.py | Python | apache-2.0 | 6,286 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: protobuf_example/addressbook/pb_addressbook/addressbook.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
... | fs714/ipyexample | protobuf_example/addressbook/pb_addressbook/addressbook_pb2.py | Python | apache-2.0 | 8,054 |
import os
import pytest
from tardis.io import config_reader
from tardis.montecarlo.base import MontecarloRunner
@pytest.fixture(scope="function")
def runner():
config_fname = "tardis/io/tests/data/tardis_configv1_verysimply.yml"
config = config_reader.Configuration.from_yaml(config_fname)
runner = Monteca... | tardis-sn/tardis | tardis/montecarlo/tests/conftest.py | Python | bsd-3-clause | 369 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_hostname_configuration_operations.py | Python | mit | 19,625 |
from .mtproto_plain_sender import MtProtoPlainSender
from .authenticator import do_authentication
from .mtproto_sender import MtProtoSender
from .connection import Connection, ConnectionMode
| andr-04/Telethon | telethon/network/__init__.py | Python | mit | 191 |
#!/usr/bin/env python
import twoauth.oauth
url = raw_input("url:")
method = raw_input("method:")
ckey = raw_input("consumer_key:")
csecret = raw_input("consumer_secret:")
atoken = raw_input("access_token:")
asecret = raw_input("accsess_secret:")
oauth = twoauth.oauth(ckey, csecret, atoken, asecret)
oauth._init_param... | techno/python-twoauth | sample/oauth_header.py | Python | mit | 575 |
import math
import tensorflow as tf
import time
import numpy as np
#http://stackoverflow.com/questions/33747596/problems-implementing-an-xor-gate-with-neural-nets-in-tensorflow
#http://stackoverflow.com/questions/33759623/tensorflow-how-to-restore-a-previously-saved-model-python
#https://www.tensorflow.org/versions/r0... | miguelotemagno/imagestion | imagestion_1.0/test-tensorflow.py | Python | gpl-2.0 | 7,279 |
"Dialog to specify or edit the parameters for a user configured help source."
import os
import sys
from Tkinter import *
import tkMessageBox
import tkFileDialog
class GetHelpSourceDialog(Toplevel):
def __init__(self, parent, title, menuItem='', filePath='', _htest=False):
"""Get menu entry and... | j5shi/Thruster | pylibs/idlelib/configHelpSourceEdit.py | Python | gpl-2.0 | 6,792 |
#
# 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... | jasonkuster/beam | sdks/python/apache_beam/io/google_cloud_platform/internal/clients/bigquery/bigquery_v2_messages.py | Python | apache-2.0 | 81,881 |
"""Provides a data provider for the CelebA dataset.
See celeba_dataset.py for more details of the CelebA dataset.
Author: Ramakrishna Vedantam (vrama@)
"""
from datasets.celeba import celeba_dataset
import tensorflow as tf
from tensorflow.contrib.slim.python.slim.data import dataset_data_provider
from datasets impor... | google/joint_vae | datasets/celeba/celeba_data_provider.py | Python | apache-2.0 | 2,359 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created: Sun May 12 18:04:51 2013
# by: The Resource Compiler for PyQt (Qt v5.0.2)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x03\x54\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\... | DevinDewitt/pyqt5 | examples/mainwindows/sdi/sdi_rc.py | Python | gpl-3.0 | 36,524 |
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# 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 3 of the License, or
# (at yo... | gangadhar-kadam/sms-erpnext | projects/page/projects/projects.py | Python | agpl-3.0 | 1,195 |
"""
sentry.web.forms.accounts
~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import pytz
import six
from datetime import datetime
from django import forms
from django.conf im... | looker/sentry | src/sentry/web/forms/accounts.py | Python | bsd-3-clause | 29,165 |
# Copyright (C) 2013-2015 Free Software Foundation, Inc.
# 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 3 of the License, or
# (at your option) any later version.
#
# This progr... | crystax/android-toolchain-gdb-7-10 | gdb/testsuite/gdb.python/py-framefilter.py | Python | gpl-2.0 | 4,581 |
"""Implementation of sample attack."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import os
import numpy as np
from scipy.misc import imread
from scipy.misc import imsave
import tensorflow as tf
from tensorflow.contrib.slim.nets import inc... | fartashf/cleverhans | examples/nips17_adversarial_competition/sample_targeted_attacks/step_target_class/attack_step_target_class.py | Python | mit | 5,572 |
"""deCONZ scene platform tests."""
from unittest.mock import patch
from homeassistant.components.scene import DOMAIN as SCENE_DOMAIN, SERVICE_TURN_ON
from homeassistant.const import ATTR_ENTITY_ID
from .test_gateway import (
DECONZ_WEB_REQUEST,
mock_deconz_put_request,
setup_deconz_integration,
)
async... | jawilson/home-assistant | tests/components/deconz/test_scene.py | Python | apache-2.0 | 1,711 |
from .Dome import readConfig, appGetBearing, motorStatusMonitor, demo
from . import Sensors
from . import UI
from . import Macros
from . import Control
from . import Dome
del(Dome) | HARDWAREdotASTRO/ROBh.aTnetwork | Robhat/Robhat/Dome/__init__.py | Python | mit | 181 |
from collections import Counter
c = Counter(input())
print(min(c['t'], c['r'], c['e']//2))
| knuu/competitive-programming | yukicoder/yuki279.py | Python | mit | 91 |
import cv2
import numpy as np
#S'il y a des mouvements detectes, dessine un rectangle autour de la plus grande surface en mouvement
#Return centre de cette surface
def searchForMovement(videoTresh,video):
objectDetected=False;
imCont, contours, hierarchy=cv2.findContours(videoTresh,cv2.RETR_EXTERNAL,cv2.... | DNLD2017/turret_control | video_python/detect.py | Python | gpl-2.0 | 2,597 |
import logging
from django.core.urlresolvers import reverse
from django.contrib import messages
from django.views.generic.edit import FormView, UpdateView
from django.shortcuts import render
from django.utils import timezone
from django.utils.decorators import method_decorator
from cuedmembers.decorators import member... | rjw57/edpcmentoring | edpcmentoring/frontend/views.py | Python | mit | 3,239 |
"""
:create: 2018 by Jens Diemer
:copyleft: 2018 by the django-cms-tools team, see AUTHORS for more details.
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
LANDING_PAGE_APPHOOK_NAMESPACE = "LandingPage"
LANDING_PAGE_APP_NAME="landingpage"
# placeholder slot name for cms.models.fields.P... | jedie/django-cms-tools | django_cms_tools/plugin_landing_page/constants.py | Python | gpl-3.0 | 562 |
class Box:
def __init__(self, x, y, w=None, h=None, right=None, bottom=None, text=None, tags=None):
self.x = x
self.y = y
self.text = text
self.tags = set()
'''
assert (w != None and h != None) or (right != None and bottom != None)
if w != None and h != None:
self.w = w
self.h = h
self.right =... | sbirch/TUSK | tusk/data-dictionary/visual_parse.py | Python | mit | 4,084 |
# -*- coding: utf-8 -*-
"""Video xmodule tests in mongo."""
import json
from collections import OrderedDict
from uuid import uuid4
import ddt
from django.conf import settings
from django.test import TestCase
from django.test.utils import override_settings
from edxval.api import (
ValCannotCreateError,
ValVide... | hastexo/edx-platform | lms/djangoapps/courseware/tests/test_video_mongo.py | Python | agpl-3.0 | 81,553 |
# by Carl Monk (@ForToffee)
# github.com/fortoffee
from time import sleep
from datetime import datetime
from gpiozero import LED, LEDBoard
board = LEDBoard(9, 22, 8, 18, 7, 17, 23, 24, 25)
def setDay(day):
board.off()
sleep(0.25)
sixDayCount = int((day - 1) / 6)
for i in range(0, sixDayCount + 1):
if i > 0:
... | ForToffee/SnowPi | advent.py | Python | mit | 906 |
from django.conf.urls import patterns, url
urlpatterns = patterns('live.views',
url('^fetch/$', 'fetch'),
url('^$', 'main_live')
)
| austinhartzheim/madhacks-live | live/urls.py | Python | mit | 140 |
'''
Test Login / Logout
'''
#pylint: disable=missing-docstring,too-many-public-methods
import sys
import os
sys.path.append(os.path.dirname(__file__) + '/..')
import streetsign_server.models as models
from unittest_helpers import StreetSignTestCase
class TestLogin(StreetSignTestCase):
''' test for valid H... | danthedeckie/streetsign | tests/test_auth.py | Python | gpl-3.0 | 3,870 |
# -*- coding: utf-8 -*-
#
# OSU DevOps BootCamp documentation build configuration file, created by
# sphinx-quickstart on Tue Oct 15 12:20:17 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated f... | edunham/website | source/conf.py | Python | apache-2.0 | 8,850 |
""" Sahana Eden Module Automated Tests - ASSET001 Create Asset
@copyright: 2011-2012 (c) Sahana Software Foundation
@license: MIT
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 Softwa... | flavour/rgims_as_diff | modules/tests/asset/create_asset.py | Python | mit | 6,678 |
# (C) British Crown Copyright 2010 - 2015, Met Office
#
# This file is part of Iris.
#
# Iris is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any l... | ghislainp/iris | lib/iris/tests/test_util.py | Python | gpl-3.0 | 13,736 |
# -*- coding: utf-8 -*-
"""
:copyright: (c) 2015 by the mediaTUM authors
:license: GPL3, see COPYING for details
"""
from pytest import raises
from sqlalchemy.exc import IntegrityError
from core import AccessRule, AccessRuleset, NodeToAccessRule, NodeToAccessRuleset
from core import db
from core.database.postgr... | mediatum/mediatum | core/test/test_permission.py | Python | gpl-3.0 | 4,815 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2018 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __manifest__.py... | maxime-beck/compassion-modules | contract_compassion/models/utm.py | Python | agpl-3.0 | 617 |
#!/usr/bin/env python
'''
| Filename : polyinterp.py
| Description : Polynomial interpolation of data points.
| Author : Pushpendre Rastogi
| Created : Tue Sep 6 00:10:47 2016 (-0400)
| Last-Updated: Tue Sep 6 00:11:35 2016 (-0400)
| By: Pushpendre Rastogi
| Update #: 1
Copied from http://hs... | se4u/rasengan | rasengan/polyinterp.py | Python | mit | 1,310 |
# Copyright (c) 2012 OpenStack Foundation.
#
# 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... | gkotton/neutron | neutron/tests/unit/ml2/drivers/cisco/nexus/test_cisco_mech.py | Python | apache-2.0 | 36,092 |
'''
Created on Aug 28, 2014
@author: Jason Guo E-mail: zqguo@zqguo.com
'''
import cStringIO
import datetime
from sklearn.externals import joblib
from PIL import Image
import config
class Identify():
'''
Usage: to identify the captcha.
Input: the string of captcha image
Output: the string of captch... | Zeing/CaptchaReader | src/Control/Identify.py | Python | mit | 4,946 |
#!/usr/bin/python
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible is distributed... | qrkourier/ansible | lib/ansible/modules/cloud/amazon/elb_application_lb.py | Python | gpl-3.0 | 41,113 |
# -*- coding: utf-8 -*-
from docpool.doksys import _
from Products.CMFPlone.utils import safe_encode
from zope.interface import implementer
from zope.schema.interfaces import IVocabularyFactory
from zope.schema.vocabulary import SimpleTerm
from zope.schema.vocabulary import SimpleVocabulary
@implementer(IVocabularyFa... | OpenBfS/dokpool-plone | Plone/src/docpool.doksys/src/docpool/doksys/vocabularies/purpose.py | Python | gpl-3.0 | 738 |
__name__ = 'ezhc'
name_url = __name__.replace('_', '-')
__packages__ = [__name__]
__version__ = '0.7.9'
__description__ = 'easy Highcharts & Highstock, dynamic plots from pandas dataframes in the Jupyter notebook'
__author__ = 'oscar6echo'
__author_email__ = 'olivier.borderies@gmail.com'
__url__ = 'https://github.com... | oscar6echo/ezhc | ezhc/__meta__.py | Python | mit | 1,260 |
# Copyright (c) 2014 - 2016 townhallpinball.org
#
# 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, p... | town-hall-pinball/project-omega | pin/service/switch_single_test.py | Python | mit | 3,501 |
#
# This file is part of HEPData.
# Copyright (C) 2015 CERN.
#
# HEPData 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.
#
# HEPData is... | eamonnmag/hepdata3 | tests/e2e/test_submit.py | Python | gpl-2.0 | 1,004 |
from setuptools import setup
setup(name="withpyproject", version="0.0.1")
| sbidoul/pip | tests/data/src/withpyproject/setup.py | Python | mit | 75 |
# -*- coding: utf-8; -*-
#
# @file base.py
# @brief
# @author Medhi BOULNEMOUR (INRA UMR1095)
# @date 2017-01-03
# @copyright Copyright (c) 2016 INRA/CIRAD
# @license MIT (see LICENSE file)
# @details
"""
coll-gate geolocation rest handler
"""
from igdectk.rest.handler import *
class RestGeolocation(RestHandler):... | coll-gate/collgate | server/geolocation/base.py | Python | mit | 377 |
"""Solution to Project Euler Problem 5
https://projecteuler.net/problem=5
gcd, lcm, and lcmm functions by J.F. Sebastian.
http://stackoverflow.com/a/147539/6119465
"""
from functools import reduce
MAXIMUM = 20
def gcd(num1, num2):
"""Return greatest common divisor using Euclid's Algorithm."""
while num2:
... | 2Cubed/ProjectEuler | euler/p005.py | Python | mit | 694 |
import pytest
import copy
import demistomock as demisto
from CyberArkAIM_v2 import Client, list_credentials_command, fetch_credentials
from test_data.context import LIST_CREDENTIALS_CONTEXT
from test_data.get_credentials_res import LIST_CREDENTIALS_RAW
@pytest.mark.parametrize('command, get_credentials_res, context',... | demisto/content | Packs/cyberark_AIM/Integrations/CyberArkAIM_v2/CyberArkAIM_v2_test.py | Python | mit | 3,964 |
# coding: utf-8
from __future__ import unicode_literals
import base64
import binascii
import json
import os
import random
from .common import InfoExtractor
from ..aes import aes_cbc_decrypt
from ..compat import (
compat_b64decode,
compat_ord,
)
from ..utils import (
bytes_to_intlist,
bytes_to_long,
ExtractorErro... | valmynd/MediaFetcher | src/plugins/youtube_dl/youtube_dl/extractor/adn.py | Python | gpl-3.0 | 5,421 |
from __future__ import print_function
from PIL import Image
from os.path import join
import os
import torch.utils.data as data
from .utils import download_url, check_integrity, list_dir, list_files
class Omniglot(data.Dataset):
"""`Omniglot <https://github.com/brendenlake/omniglot>`_ Dataset.
Args:
ro... | jrdurrant/vision | torchvision/datasets/omniglot.py | Python | bsd-3-clause | 4,148 |
from conan.packager import ConanMultiPackager
import platform
if __name__ == "__main__":
builder = ConanMultiPackager(username="memsharded", channel="testing",
visual_versions=["10", "12", "14"])
builder.add_common_builds(shared_option_name="Protobuf:shared")
filtered_build... | memsharded/conan-protobuf | build.py | Python | mit | 525 |
"""This module is part of Swampy, a suite of programs available from
allendowney.com/swampy.
Copyright 2010 Allen B. Downey
Distributed under the GNU General Public License at gnu.org/licenses/gpl.html.
"""
# import everything from the random module
from random import *
# import everything from TurtleWorld
try:
... | simontakite/sysadmin | pythonscripts/thinkpython/Wanderer.py | Python | gpl-2.0 | 2,539 |
# 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... | rabipanda/tensorflow | tensorflow/python/debug/lib/debug_gradients.py | Python | apache-2.0 | 15,460 |
import sys
import os
from eventlet.support import greenlets as greenlet
from eventlet import patcher
__all__ = ["use_hub", "get_hub", "get_default_hub", "trampoline"]
threading = patcher.original('threading')
_threadlocal = threading.local()
def get_default_hub():
"""Select the default hub implementation based o... | Cue/eventlet | eventlet/hubs/__init__.py | Python | mit | 4,048 |
import json
import requests
class ElasticDict(dict):
"""A dictionary that automatically dumps it's keys/values in Elastic
Search. Everything is converted to JSON behind the scenes, then sent over
the wire into ES.
"""
def __init__(self, es_host='localhost', es_port=9200,
es_inde... | bradmontgomery/elasticdict | elasticdict.py | Python | mit | 4,420 |
#!/usr/bin/env python
"""
Requirements:
* https://github.com/openalias/dnscrypt-python
* https://github.com/warner/python-pure25519/blob/master/misc/djbec.py
* a query file of the form `qname\tqtype`. Example query file https://nominum.com/measurement-tools/
Example usage:
python dnscrypt-fuzzer.py \
--provider-... | Cofyc/dnscrypt-wrapper | tests/dnscrypt-fuzzer.py | Python | gpl-2.0 | 7,804 |
def weighted_graph_import(unique):
G=nx.Graph()
for i in range(len(unique)):
from_id=unique[i][0]
to_id=unique[i][1]
weightvar=unique[i][2]
startvar=unique[i][3]
endvar=unique[i][4]
G.add_edge(from_id,to_id,weight=weightvar,start=startvar,end=endvar)
return G
| tothebeat/wikipedia-revisions | weighted_graph_import.py | Python | mit | 320 |
#!/usr/bin/python3
#
# Copyright 2018 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 a... | brain-research/realistic-ssl-evaluation | lib/tf_utils.py | Python | apache-2.0 | 2,509 |
# -*- coding: utf-8 -*-
from os import environ
DEBUG = True
DATABASES= {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'nps.db',
}
}
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'... | hugorodgerbrown/django-hipchat | settings.py | Python | mit | 2,693 |
# coding: utf-8
"""
mistune
~~~~~~~
The fastest markdown parser in pure Python with renderer feature.
:copyright: (c) 2014 - 2016 by Hsiaoming Yang.
"""
import re
import inspect
__version__ = '0.7.3'
__author__ = 'Hsiaoming Yang <me@lepture.com>'
__all__ = [
'BlockGrammar', 'BlockLexer',
'In... | ebursztein/SiteFab | SiteFab/parser/mistune.py | Python | gpl-3.0 | 35,424 |
#!/usr/bin/env python
"""py.test fixtures to be used in netmiko test suite."""
from os import path
import os
import pytest
from netmiko import ConnectHandler, FileTransfer, InLineTransfer
from tests.test_utils import parse_yaml
PWD = path.dirname(path.realpath(__file__))
def pytest_addoption(parser):
"""Add t... | shamanu4/netmiko | tests/conftest.py | Python | mit | 6,264 |
import os.path
import pytest
from pygrok import Grok
def test_dovecot_login():
"""Test POP or IMAP login (user checking his or her email from a mail client)"""
log_entry = 'Jun 24 15:06:14 web1 dovecot: imap-login: Login: user=<info@domain.com>, '\
'method=PLAIN, rip=192.168.1.1, lip=192.168.1.... | brianmpollack/WHM-LogStash-Grok-Patterns | tests/test_dovecot.py | Python | mit | 2,866 |
#!/usr/bin/env python
"""tilestache-seed.py will warm your cache.
This script is intended to be run directly. This example seeds the area around
West Oakland (http://sta.mn/ck) in the "osm" layer, for zoom levels 12-15:
tilestache-seed.py -c ./config.json -l osm -b 37.79 -122.35 37.83 -122.25 -e png 12 13 14 15
... | mpuig/TileStache | scripts/tilestache-seed.py | Python | bsd-3-clause | 13,294 |
from __future__ import with_statement
import contextlib
from urllib.parse import urlencode
from urllib.request import urlopen
def make_tiny(url):
request_url = ('http://tinyurl.com/api-create.php?' + urlencode({'url': url}))
with contextlib.closing(urlopen(request_url)) as response:
return response.r... | dpausp/arguments | src/ekklesia_portal/helper/url_shortener.py | Python | agpl-3.0 | 342 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/it-cert-automation-project | Part4/app-files/serializers.py | Python | apache-2.0 | 942 |
from view import CView
from template_view import CTemplateView
from form_view import CFormView | zacharytamas/django-chelsea | chelsea/views/__init__.py | Python | isc | 94 |
'''Module for physics simulation.
This module provides two classes that allow the
approximation of physics behind bouncing balls.'''
################################################################################
__version__ = '$Revision: 0 $'
__date__ = 'February 20, 2007'
__author__ = 'Stephen "Zero" Chappell <my... | ActiveState/code | recipes/Python/510397_Physics/recipe-510397.py | Python | mit | 4,063 |
"""added active property to user
Revision ID: 5f9359413469
Revises: 3bd9e44ec844
Create Date: 2017-08-16 13:53:43.797678
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '5f9359413469'
down_revision = '3bd9e44ec844'
branch_labels = None
depends_on = None
def u... | jonasliekens/KWB-App | migrations/versions/5f9359413469_added_active_property_to_user.py | Python | gpl-3.0 | 664 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | ykim362/mxnet | python/mxnet/gluon/model_zoo/vision/mobilenet.py | Python | apache-2.0 | 6,319 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2012, Jeroen Hoekx <jeroen@hoekx.be>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = r'''
---
module: wait_for... | Fale/ansible | lib/ansible/modules/wait_for.py | Python | gpl-3.0 | 25,705 |
#!/usr/bin/env python
"""
renumber the integers at the beginning of ever line in the file
to make sure these numbers are contiguous.
The file is read from sys.stdin.
This program does not parse an entire LAMMPS data file.
The text from the "Atoms" section
(or "Bonds", or "Angles", or "Dihedrals", or... | quang-ha/lammps | tools/moltemplate/moltemplate/renumber_DATA_first_column.py | Python | gpl-2.0 | 2,188 |
from datetime import datetime, timedelta
try:
from couchdb import Server
except ImportError:
print("WARNING: missing couchdb import")
try:
from crafts.common.metrics import Metric, MetricCollection
except ImportError:
print("WARNING: missing crafts import")
try:
from numpy.random import randn
exc... | crafts/arts | arts/handlers.py | Python | mit | 1,563 |
from __future__ import print_function
import shutil
import os.path
def build_directory_recurse(src_dir, dest_dir, source_path, build_path,
install_path=None):
def _copy(src, dest):
print("copying %s to %s..." % (src, dest))
if os.path.exists(dest):
shutil... | nerdvegas/rez | src/rez/data/tests/builds/packages/build_util/1/build_util/__init__.py | Python | apache-2.0 | 928 |
import unittest
from libweasyl import security
class SecurityTestCase(unittest.TestCase):
def test_generate_key(self):
length = 20
self.assertEqual(length, len(security.generate_key(length)))
| Weasyl/weasyl | libweasyl/libweasyl/test/test_security.py | Python | apache-2.0 | 214 |
# $Id: debug.py,v 1.3 2010/10/23 12:43:55 ceballos Exp $
import FWCore.ParameterSet.Config as cms
process = cms.Process('FILLER')
# import of standard configurations
process.load('Configuration/StandardSequences/Services_cff')
process.load('FWCore/MessageService/MessageLogger_cfi')
process.load('Configuration/Standa... | cpausmit/Kraken | filefi/014/debug.py | Python | mit | 1,936 |
#!/usr/bin/python3
import argparse
import urllib.request
import logging
from html.parser import HTMLParser
# PR label indicating that spread job should be skipped
LABEL_SKIP_SPREAD_JOB = "Skip spread"
class GithubLabelsParser(HTMLParser):
def __init__(self):
super().__init__()
self.in_labels = ... | stgraber/snapd | check-pr-skip-spread.py | Python | gpl-3.0 | 2,962 |
__all__ = [ "hp49", "com", "hpstr", "cmd", "protocol" ]
from . import *
| cr/pyHP49 | pyhp/__init__.py | Python | unlicense | 72 |
import urllib
import urllib2
import json
import requests
import time
# client="http://192.168.0.10:8000/api"
client="http://127.0.0.1:8000/api"
def loadJson(bytes):
return json.loads(bytes.decode('UTF-8'))
def fetch_url(url, params, method):
params = urllib.urlencode(params)
if method=="GET":
f... | FiniteElementries/barebone_server | tests/api_test.py | Python | mit | 4,590 |
# flake8: noqa
# -*- 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 'TaskAttachment'
db.create_table(u'task_list_taskattachment', (
(u... | bitmazk/django-task-list | task_list/migrations/0002_auto__add_taskattachment__del_field_task_is_example__del_field_task_at.py | Python | mit | 10,982 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011-2012 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.... | TieWei/nova | nova/api/openstack/compute/plugins/v3/cells.py | Python | apache-2.0 | 15,904 |
# ==================================================================================================
# Copyright 2011 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | foursquare/commons-old | src/python/twitter/common/metrics/metrics.py | Python | apache-2.0 | 3,249 |
"""Higher-level (i.e., user-friendly) functions for quickly reading
TLG data after it has been processed by ``TLGU()``.
"""
import os
import regex
from cltk.corpora.grc.tlg.tlg_index import TLG_INDEX, TLG_WORKS_INDEX
from cltk.utils.file_operations import make_cltk_path
def tlg_plaintext_cleanup(text, rm_punctuati... | kylepjohnson/cltk | src/cltk/corpora/grc/tlg/file_utils.py | Python | mit | 1,897 |
from django.shortcuts import render, redirect, render_to_response, get_object_or_404
from django.contrib import auth
from django.http import HttpResponseRedirect
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import csrf_protect
from myprofile.models import User,UserAvatar
f... | etovrodeya/hotel_project2 | myprofile/views.py | Python | mit | 4,004 |
#!/usr/bin/env python
# Copyright (c) 2014 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
A script to check that the (Linux) executables produced by gitian only contain
allowed gcc, glibc and libstdc++... | starwels/starwels | contrib/devtools/symbol-check.py | Python | mit | 6,201 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# --------------------------------------------------------------------------- #
# #
# Create databases for iSida Jabber Bot #
# Copyright (C) 2011 diSabler <dsy... | isida/4 | scripts/old/create_databases.py | Python | gpl-3.0 | 4,029 |
#-*-coding: utf-8 -*-
from pollandsurvey import model
from surveyobject import JsontoObject
from tgext.pyutilservice import Utility, extraLog
from tg import expose, flash, require, url, lurl, request, redirect, tmpl_context,validate,response
import logging;
log = logging.getLogger(__name__);
__all__ = ['InvitationSe... | tongpa/PollSurveyWeb | pollandsurvey/service/invitationservice.py | Python | gpl-2.0 | 1,225 |
# coding=utf-8
from time import time
from autosubliminal.parsers.guessit import default_api
from autosubliminal.util.common import connect_url
_base_url = 'https://raw.githubusercontent.com/h3llrais3r/Auto-Subliminal/gh-pages/guessit_exceptions/'
_release_groups_url = _base_url + 'release_groups.txt'
_titles_url = _... | h3llrais3r/Auto-Subliminal | autosubliminal/parsers/__init__.py | Python | gpl-3.0 | 1,532 |
#pylint: disable=missing-docstring
#* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
#* https://www.gnu.org/... | harterj/moose | python/peacock/base/PeacockCollapsibleWidget.py | Python | lgpl-2.1 | 3,799 |
from unittest import TestCase
from operator import itemgetter
import simplejson as json
class TestItemSortKey(TestCase):
def test_simple_first(self):
a = {'a': 1, 'c': 5, 'jack': 'jill', 'pick': 'axe', 'array': [1, 5, 6, 9], 'tuple': (83, 12, 3), 'crate': 'dog',
'zeak': 'oh'}
self.as... | itielshwartz/BackendApi | lib/simplejson/tests/test_item_sort_key.py | Python | apache-2.0 | 1,154 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Common types, and routines for manually loading types from file
via GCC.
"""
import glob
import os
import subprocess
import sys
import gdb
import pwndbg.events
import pwndbg.gcc
import pwndbg.memoize
import pwndbg.tempfile
module = sys.modules[__name__]
def is_poi... | pwndbg/pwndbg | pwndbg/typeinfo.py | Python | mit | 5,577 |
from discord.ext import commands
import discord.utils
from __main__ import settings
#
# This is a modified version of checks.py, originally made by Rapptz
#
# https://github.com/Rapptz
# https://github.com/Rapptz/RoboDanny/tree/async
#
def is_owner_check(ctx):
_id = ctx.messag... | jicruz/heroku-bot | cogs/utils/checks.py | Python | gpl-3.0 | 2,890 |
total = 0
#loop from 1 to 1000
for i in range(1,1000):
#if remender is 0 after dividing by 3 or 5
if i %3 == 0 or i%5 == 0:
#i is added to total
total= i + total
print(total)
| vyadav22/cloudComputing | Euler/lab3.py | Python | mit | 196 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
import threading
from odoo import api, fields, models, tools, _
_logger = logging.getLogger(__name__)
class SmsSms(models.Model):
_name = 'sms.sms'
_description = 'Outgoing SMS'
_rec_name =... | jeremiahyan/odoo | addons/sms/models/sms_sms.py | Python | gpl-3.0 | 9,393 |
#!/usr/bin/env python
def main(request, response):
response.headers.set(b"Content-Type", b"text/plain")
response.headers.set(b"Access-Control-Allow-Origin", b"*")
response.content = b"PASS: Cross-domain access allowed."
| simartin/servo | tests/wpt/web-platform-tests/xhr/resources/access-control-basic-allow-star.py | Python | mpl-2.0 | 233 |
# -*- coding: utf-8 -*-
#
# OpenCraft -- tools to aid developing and hosting free software projects
# Copyright (C) 2015 OpenCraft <xavier@opencraft.com>
#
# 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 Soft... | brousch/opencraft | instance/api/instance.py | Python | agpl-3.0 | 2,133 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.