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 smallsmilhandler
from xml.sax import make_parser
from xml.sax.handler import ContentHandler
import sys
import re
import json
import urllib
class KaraokeLocal:
def Inicializador(self, fichero):
parser = make_parser()
SmilHandler = smallsmilhandler.SmallSMILHandler()
parser.setConten... | DanielBarreno/ptavi-p3 | karaoke.py | Python | apache-2.0 | 1,836 |
"""
Code Sources Used:
https://github.com/gioGats/sudoku
http://norvig.com/sudoku.html
"""
import itertools
import sys
import time
import generate_sudoku as gs
# TODO Rewrite definite_fill and indefinite_fill into new functions: update_possible, fill_definite, indefinite_fill
# TODO modify indefinite_fill. BFS tes... | gioGats/sudoku | v0.1/brute_force.py | Python | gpl-3.0 | 7,084 |
# 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 agreed to in writing, ... | GoogleCloudPlatform/serverless-store-demo | app/helpers/orders/data_classes.py | Python | apache-2.0 | 2,324 |
# -*- coding: utf-8 -*-
import json
from unittest import mock
from pyquery import PyQuery as pq
from olympia import amo
from olympia.access.models import Group, GroupUser
from olympia.amo.tests import TestCase, user_factory
from olympia.amo.urlresolvers import reverse
from olympia.files.models import File
from olymp... | eviljeff/olympia | src/olympia/zadmin/tests/test_views.py | Python | bsd-3-clause | 7,199 |
from rest_framework import serializers
from ..upload_handling.serializers import ArticleImageSerializer
class ArticleSerializer(serializers.Serializer):
main_title = serializers.CharField(max_length=255)
sub_title = serializers.CharField(max_length=255)
author = serializers.CharField(max_length=255)
i... | REBradley/WineArb | winearb/articles/serializers.py | Python | bsd-3-clause | 435 |
# 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/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/models/_models.py | Python | mit | 1,715 |
from kv1_811 import *
from inserter import insert,version_imported,reject,setRefsDict,simple_dict_insert
from bs4 import BeautifulSoup
import urllib2
from datetime import datetime,timedelta
import logging
from settings.const import *
logger = logging.getLogger("importer")
getPool = getFakePool811
def getDataSource()... | bliksemlabs/bliksemintegration | importers/ret.py | Python | bsd-2-clause | 12,326 |
# Python3
# 有限制修改區域
def fixResult(result):
def fix(x):
return x // 10
return list(map(fix, result))
| RevansChen/online-judge | Codefights/arcade/python-arcade/level-6/36.Fix-Result/Python/solution1.py | Python | mit | 132 |
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
The downloader main module.
It creates a GUI window with the help of Mypanel class.
It import:
-wx
-Mypanel from class_Mypanel
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
"""Required modules"""
import wx
from cla... | curioswati/SJdownloader | sjdownloader/SJdownloader.py | Python | isc | 985 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Script de comprobación de entrega de ejercicio
Para ejecutarlo, desde la shell:
$ python check.py login_github
"""
import os
import random
import sys
ejercicio = 'X-Serv-16.4-contentPostApp'
student_files = []
repo_files = [
'contentapp.py'
'webapp.py',
... | CursosWeb/X-Serv-16.4-contentPostApp | check.py | Python | gpl-2.0 | 1,710 |
from deeplink import *
from google_apps import *
from salesforce import *
from signing import *
from views import *
| anentropic/django-saml2-idp | saml2idp/tests/__init__.py | Python | mit | 116 |
import datetime
import mock
from django.test import TestCase
from comics.aggregator import command
from comics.aggregator.crawler import CrawlerRelease
from comics.aggregator.exceptions import ComicsError
from comics.core.models import Comic
def create_comics():
Comic.objects.create(slug='xkcd')
Comic.objec... | datagutten/comics | comics/aggregator/tests/test_command.py | Python | agpl-3.0 | 6,333 |
# Copyright 2019 IBM Corp.
#
# 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... | open-power-ref-design-toolkit/cluster-genesis | scripts/python/lib/utilities.py | Python | apache-2.0 | 68,079 |
# -*- coding: utf-8 -*-
#
# Weblate documentation build configuration file, created by
# sphinx-quickstart on Wed Mar 7 14:48:43 2012.
#
# 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.
#
# A... | dtschan/weblate | docs/conf.py | Python | gpl-3.0 | 10,574 |
from .. import app
from flask_sqlalchemy import SQLAlchemy
# Introduce the database.
db = SQLAlchemy(app)
| AndrewNeudegg/CIMC | CIMC/database/__init__.py | Python | mit | 107 |
# -*- coding: utf-8 -*-
# Copyright 2013-2017 Pedro M. Baeza <pedro.baeza@tecnativa.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models, api
class BetterZipGeonamesImport(models.TransientModel):
_inherit = 'better.zip.geonames.import'
@api.model
def transfo... | factorlibre/l10n-spain | l10n_es_toponyms/wizard/geonames_import.py | Python | agpl-3.0 | 1,168 |
from api.mon.backends.zabbix.monitor import Zabbix, get_zabbix, del_zabbix
from api.mon.backends.zabbix.server import ZabbixMonitoringServer
get_monitoring = get_zabbix
del_monitoring = del_zabbix
MonitoringBackendClass = Zabbix
MonitoringServerClass = ZabbixMonitoringServer
__all__ = ('get_monitoring', 'del_monit... | erigones/esdc-ce | api/mon/backends/zabbix/__init__.py | Python | apache-2.0 | 379 |
#!/usr/bin/env python
# -*- coding: utf-8
import os
import sys
from jottalib.monitor import ArchiveEventHandler
def test_correct_url(tmpdir):
tmpdir = str(tmpdir)
aeh = ArchiveEventHandler(None, tmpdir, "/TEST_ROOT")
filepath = os.path.join(tmpdir, "subdir", "correct_url.txt")
jottapath = aeh.get_jot... | cowai/jottalib | tests/test_archiveEventHandler.py | Python | gpl-3.0 | 1,018 |
# Copyright 2015 Intel Corp
# Copyright 2016 Hewlett Packard Enterprise Development Company LP
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org... | klmitch/nova | nova/objects/console_auth_token.py | Python | apache-2.0 | 7,694 |
from rest_framework import serializers
from file_manager.models import FileManager
class FileManagerSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = FileManager
fields = ('id', 'url', 'name', 'file')
| craigbruce/drf_sandbox | file_manager/serializer.py | Python | bsd-3-clause | 246 |
#!/usr/bin/python
''' 510k pipeline for downloading, transforming to JSON and loading into
Elasticsearch.
'''
import collections
import glob
import logging
import os
from os.path import basename, dirname, join
import sys
import arrow
import elasticsearch
import luigi
import requests
import simplejson as json
fr... | HiTechIronMan/openfda | openfda/device_clearance/pipeline.py | Python | cc0-1.0 | 4,009 |
from kmediatorrent import plugin
from kmediatorrent.scrapers import scraper
from kmediatorrent.ga import tracked
from kmediatorrent.caching import cached_route
from kmediatorrent.utils import ensure_fanart
# Temporary, will be fixed later by them
BASE_URL = "%s/" % plugin.get_setting("base_nyaa")
HEADERS = {
"Ref... | jmarth/plugin.video.kmediatorrent | resources/site-packages/kmediatorrent/scrapers/nyaa.py | Python | gpl-3.0 | 3,074 |
import inspect
import logging
import torch
from pytorch_lightning.core.step_result import Result
from pytorch_lightning.overrides.data_parallel import LightningDistributedDataParallel
from pytorch_lightning.utilities.model_utils import is_overridden
from pytorch_lightning.trainer.model_hooks import TrainerModelHooksMi... | ray-project/ray | python/ray/util/sgd/torch/lightning_operator.py | Python | apache-2.0 | 20,906 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = [
'Click>=6.0',
# TODO: put package requirements here
]... | tartavull/trace | setup.py | Python | mit | 1,724 |
import _plotly_utils.basevalidators
class XpadValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name="xpad", parent_name="scatter.marker.colorbar", **kwargs
):
super(XpadValidator, self).__init__(
plotly_name=plotly_name,
parent_name=pa... | plotly/plotly.py | packages/python/plotly/plotly/validators/scatter/marker/colorbar/_xpad.py | Python | mit | 460 |
import click
import json
from kamcli.cli import pass_context
from kamcli.iorpc import command_ctl
@click.command("ps", short_help="Print the list of kamailio processes")
@pass_context
def cli(ctx):
"""Show details about running kamailio processes
\b
"""
command_ctl(ctx, "core.psx", [], {"func": cmd_p... | asipto/kamcli | kamcli/commands/cmd_ps.py | Python | gpl-2.0 | 743 |
#!/usr/bin/python
# Delete Wallpaper. By Anjan Momi.
# {simple python script to show and/or delete current wallpaper}
# Copyright (C) {2014} {Anjandev Momi}
# Contact me at anjan@momi.ca
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public Licen... | anjandev/deletewallpaper | wall.py | Python | gpl-3.0 | 2,496 |
import unittest
class Test_motion(unittest.TestCase):
pass
if __name__ == "__main__":
unittest.main() | rizen1892/SmartHomeSolutions-Web | app/motion_tests.py | Python | gpl-2.0 | 112 |
# -*- coding: utf-8 -*-
import atexit
import logging
import logging.handlers
from threading import Lock
import inspect
import sys
from django.db.models import Model
from types import ModuleType
import six
logger_cache = {}
logger_cache_lock = Lock()
logging.getLogger("requests").setLevel(logging.WARNING)
logging.get... | RedHatQE/cfme_tests | sprout/sprout/log.py | Python | gpl-2.0 | 3,202 |
# Copyright 2012 SINA 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 app... | jeffrey4l/nova | nova/tests/unit/api/openstack/compute/contrib/test_attach_interfaces.py | Python | apache-2.0 | 20,522 |
import re
def count_linenum(filename):
total_line = 0
comment_line = 0
blank_line = 0
with open(filename) as f:
lines = f.readlines()
total_line = len(lines)
line_index = 0
# 遍历每一行
while line_index < total_line:
line = lines[line_index]
# ... | pythonzhichan/DailyQuestion | 7zero/question_6.py | Python | mit | 1,077 |
"""Tests for the Config Entry Flow helper."""
from unittest.mock import patch, Mock
import pytest
from homeassistant import config_entries, data_entry_flow, setup
from homeassistant.helpers import config_entry_flow
from tests.common import (
MockConfigEntry, MockModule, mock_coro, mock_integration,
mock_entit... | aequitas/home-assistant | tests/helpers/test_config_entry_flow.py | Python | apache-2.0 | 8,951 |
# Copyright 2014 Microsoft 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 applicable law or agreed to in... | nathanleclaire/WALinuxAgent | tests/distro/test_loader.py | Python | apache-2.0 | 1,259 |
# Lookup Bitcoin value from exchanges
from exchanges.bitfinex import Bitfinex
import re
def bitcoinValue(msg):
val = Bitfinex().get_current_price()
formattedVal = "$" + "{:,.2f}".format(val)
if re.search(r"(?i)moon", msg):
return "To the moon! " + formattedVal
else:
return "Bitcoin: "... | bhipple/brobot | currency.py | Python | gpl-3.0 | 336 |
import unittest
import mock
import ddt
import octoprint.plugin
import octoprint.plugin.core
##~~ Helpers for testing mixin type extraction
class A(object):
pass
class A_1(A):
pass
class A_2(A):
pass
class A_3(A):
pass
class A1_1(A_1):
pass
class B(object):
pass
class B_1(B):
pass
class C(object)... | Jaesin/OctoPrint | tests/plugin/test_core.py | Python | agpl-3.0 | 12,641 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This file is part of cjklib.
#
# cjklib 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 later versi... | tomas-mazak/taipan | taipan/cjklib/test/readingoperator.py | Python | gpl-3.0 | 110,252 |
# 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 use ... | themarkypantz/kafka | tests/kafkatest/benchmarks/streams/streams_simple_benchmark_test.py | Python | apache-2.0 | 4,969 |
from django.core.context_processors import csrf
from django.shortcuts import render, render_to_response, get_object_or_404
from blog.models import makale, yorum, kategori
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from django.core.urlresolvers import reverse
from django.http import HttpResponse... | gencelo/tlog | app/blog/views.py | Python | mit | 1,558 |
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <codecell>
# -*- coding: utf-8 -*-
"""
Map tile acquisition
--------------------
Demonstrates cartopy's ability to draw map tiles which are downloaded on
demand from the MapQuest tile server. Internally these tiles are then combined
into a single image and display... | rsignell-usgs/notebook | Cartopy/Cartopy_terrain.py | Python | mit | 2,013 |
# Copyright 2011 VMware, 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 ... | yuewko/neutron | neutron/common/config.py | Python | apache-2.0 | 10,476 |
"""
`reconstruction_loop` originally part of CellProfiler,
code licensed under both GPL and BSD licenses.
Website: http://www.cellprofiler.org
Copyright (c) 2003-2009 Massachusetts Institute of Technology
Copyright (c) 2009-2011 Broad Institute
All rights reserved.
Original author: Lee Kamentsky
"""
# pythran export... | serge-sans-paille/pythran | pythran/tests/scikit-image/_greyreconstruct.py | Python | bsd-3-clause | 3,405 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2007,2009 Zuza Software Foundation
#
# This file is part of the Translate Toolkit.
#
# 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; e... | claudep/translate | translate/storage/ini.py | Python | gpl-2.0 | 4,052 |
# -*- coding: utf-8 -*-
from optionaldict import optionaldict
from wechatpy.client.api.base import BaseWeChatAPI
class WeChatKFMessage(BaseWeChatAPI):
"""
发送微信客服消息
https://work.weixin.qq.com/api/doc/90000/90135/94677
支持:
* 文本消息
* 图片消息
* 语音消息
* 视频消息
* 文件消息
* 图文链接
* 小程序
... | wechatpy/wechatpy | wechatpy/work/client/api/kf_message.py | Python | mit | 4,405 |
"""
OwO whats this?
"""
__author__ = ('Smurphicus')
COMMAND = 'owo'
from random import choice
substitutions = {'r':'w','R':'W','l':'w','L':'W','na':'nya','NA':'NYA','qu':'qw','QU':'QW'}
faces = [' OwO', ' owo', ' UwU', ' uwu', ' :3', ' :33', ' :333', '']
def owoify(message):
for key in substitutions.keys():
... | sentriz/steely | steely/plugins/owo.py | Python | gpl-3.0 | 679 |
import nose
import numpy as np
from scipy import sparse as sp
from sklearn.svm.bounds import l1_min_c
from sklearn.svm import LinearSVC
from sklearn.linear_model.logistic import LogisticRegression
from sklearn.svm.sparse import LinearSVC as SparseSVC
from sklearn.linear_model.sparse.logistic import LogisticRegression... | ominux/scikit-learn | sklearn/svm/tests/test_bounds.py | Python | bsd-3-clause | 2,389 |
# -*- coding: utf-8 -*-
"""
Tests specific to the local backend.
"""
import pytest
pytestmark = pytest.mark.usefixtures("teardown_cauldron")
from ..conftest import fail_if_not_teardown
@pytest.fixture
def backend(request):
"""Use the local backend."""
from Cauldron.api import use
use('mock')
request.... | alexrudy/Cauldron | Cauldron/tests/test_mock.py | Python | bsd-3-clause | 1,510 |
#!/usr/bin/python
import sys
import time
import FXOS8700CQR1 as imuSens
from ctypes import *
imuSens = imuSens.FXOS8700CQR1() #Configure chip in hybrid mode
def main(argv):
id = imuSens.getID() #Verify chip ID
print "Chip ID: 0x%02X. \r\n" % id
imuSens.standbyMode()
imuSens.activeMode()
id = imuSens... | sensorian/sensorian-firmware | Drivers_Python/FXOS8700CQR1/EX3_Orientation.py | Python | lgpl-3.0 | 1,196 |
from automlk.store import get_key_store, list_key_store, lpush_key_store
from automlk.config import *
dataset_id = '42'
round_id = 1
results = list_key_store('dataset:%s:rounds' % dataset_id)
for r in results:
if r['round_id'] == round_id:
# print(r)
# reinject this round in another dataset exper... | pierre-chaville/automlk | tests/test_inject.py | Python | mit | 685 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# LICENCE: GNU AFFERO GENERAL PUBLIC LICENSE v.3 https://github.com/dlfer/casengine/blob/master/LICENSE
# https://github.com/dlfer/casengine
# (C) DLFerrario http://www.dlfer.xyz
r"""
# Version: 2020-04-01
casengine.py [options] [filename]
a Pre-Processor for (La)TeX f... | dlfer/casengine | casengine.py | Python | agpl-3.0 | 19,507 |
# An extension of `list` that loops indices.
class Ring(tuple):
def __getitem__(self, key):
length = len(self)
# For slices, one index must still be in the usual range
# To trigger the special behaviour, the indices must be different and one must be outside the usual range
# To ge... | peterolph/hAIve | ponder/ring.py | Python | mit | 1,181 |
import urllib2
f=open('allarticles.txt','w')
searchstr='<h1 class="entry-title"><a href="'
l=len(searchstr)
urls=[]
for y in range(5):
for m in range(12):
if m<9:
urls.append('https://blogs.lt.vt.edu/engineeredu/index.php/20%d/0%d/'%(12+y,m+1))
else:
urls.append('https://blog... | aicentral/writestyle | Harvester.py | Python | mit | 1,228 |
import json
import logging
import random
import time
from typing import Callable, Optional, Union, cast
from requests import Response, Session
from requests.exceptions import ConnectionError
from jira.exceptions import JIRAError
logging.getLogger("jira").addHandler(logging.NullHandler())
def raise_on_error(r: Opti... | pycontribs/jira | jira/resilientsession.py | Python | bsd-2-clause | 8,330 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutAsserts(Koan):
def test_assert_truth(self):
"""
We shall contemplate truth by testing reality, via asserts.
"""
# Confused? This video should help:
#
# http://bit.ly/about_assert... | LeMeteore/python_koans | python2/koans/about_asserts.py | Python | mit | 2,275 |
import logging
import smtplib
import cgi
from socket import error as socket_error
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email import Encoders
from smtplib import SMTPRecipientsRefused
from pylons import config
log = logging.getLogg... | ViderumGlobal/ckanext-requestdata | ckanext/requestdata/emailer.py | Python | agpl-3.0 | 2,576 |
from raptiformica.shell.execute import COMMAND_TIMEOUT
from raptiformica.shell.raptiformica import run_raptiformica_command
from tests.testcase import TestCase
class TestRunRaptiformicaCommand(TestCase):
def setUp(self):
self.log = self.set_up_patch('raptiformica.shell.raptiformica.log')
self.exec... | vdloo/raptiformica | tests/unit/raptiformica/shell/raptiformica/test_run_raptiformica_command.py | Python | mit | 2,513 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2008-2016 University of Dundee & Open Microscopy Environment.
# All rights reserved.
#
# 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 F... | dpwrussell/openmicroscopy | components/tools/OmeroWeb/omeroweb/webclient/views.py | Python | gpl-2.0 | 172,591 |
"""
mweigert@mpi-cbg.de
"""
from __future__ import print_function, unicode_literals, absolute_import, division
from .ssim import ssim | maweigert/gputools | gputools/metrics/__init__.py | Python | bsd-3-clause | 134 |
#
# Copyright 2011 Red Hat, 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 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in th... | openSUSE/vdsm | vdsm/caps.py | Python | gpl-2.0 | 8,208 |
#!/usr/bin/env python
# http://oscon.com/oscon2012/public/schedule/detail/24416
# plus_a.py (by Wesley Chun under CC-SA3.0 license)
import os
import httplib2
from apiclient import discovery
from oauth2client import file as storage, client, tools
store = storage.Storage(settings.AUTH_FILE)
credz = store.get(... | YuxuanLing/trunk | trunk/code/study/python/core_python_appilication/ch15/plus_a.py | Python | gpl-3.0 | 1,067 |
class Solution(object):
def searchInsert(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
lo, hi = 0, len(nums) - 1
while lo <= hi:
mid = (lo + hi) // 2
if target < nums[mid]: hi = mid - 1
e... | rx2130/Leetcode | python/35 Search Insert Position.py | Python | apache-2.0 | 833 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
"""
FILE: sample_hello_world.py
DESCRIPTION:
This sample demonstrates the most basic operation that can be
performed - creation of a Farmer. Use this to understand how to
create the client object, how to authenticate it, and make s... | Azure/azure-sdk-for-python | sdk/agrifood/azure-agrifood-farming/samples/sample_hello_world.py | Python | mit | 2,076 |
# -*- coding: utf-8 -*-
# Copyright © 2012-2016 Roberto Alsina and others.
# 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 t... | wcmckee/nikola | nikola/plugins/command/auto/__init__.py | Python | mit | 17,275 |
from tkinter import *
from tkinter.filedialog import *
from tkinter.messagebox import *
from .binary import *
from .linear import *
"""
This file contains the searches GUI
"""
class SearchesGui(Tk):
"""
Searches GUI for Libuseful
"""
def __init__(self, *args, **kwargs):
"""
... | jcotton42/libuseful | searches/gui.py | Python | gpl-3.0 | 2,865 |
# Fibre Channel WWN initiator related facts collection for ansible.
#
# 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 o... | alxgu/ansible | lib/ansible/module_utils/facts/network/fc_wwn.py | Python | gpl-3.0 | 3,450 |
#!/usr/bin/env python
'''
This file is part of the ASNN eMail Suite.
ASNN-MDA is free software: you can redistribute it and/or modify
it under the terms of the version 2 GNU General Public License
as published by the Free Software Foundation.
ASNN-MDA is distributed in the hope that it will be us... | marvinglenn/asnn-mda | asnn_reduce_spamrating.py | Python | gpl-2.0 | 7,003 |
from __future__ import print_function
import pandas as pd
def RSI(prices, period=14):
"""
Developed J. Welles Wilder, the Relative Strength Index (RSI) is a
momentum oscillator that measures the speed and change of price
movements. RSI oscillates between zero and 100. Traditionally,
and according... | nwillemse/nctrader | nctrader/indicators.py | Python | mit | 1,091 |
#!/usr/bin/env python
#
# Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2013 YAMAMOTO Takashi <yamamoto at valinux co jp>
#
# 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... | StephenKing/summerschool-2015-ryu | ryu/cmd/of_config_cli.py | Python | apache-2.0 | 15,540 |
# -*- coding: UTF-8 -*-
import numpy as np
import pandas as pd
import os
from dateutil.parser import parse
def _macd(closes):
ema12 = _ema(closes, 12)
ema26 = _ema(closes, 26)
diff = ema12 - ema26
dea = _ema(diff, 9)
osc = diff - dea
return (osc * 2, diff, dea)
def _ma(closes, cycle=5):
... | m860/data-analysis-with-python | filter/Stock.py | Python | mit | 2,079 |
"""
Support for Broadlink RM devices.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.broadlink/
"""
from datetime import timedelta
from base64 import b64encode, b64decode
import asyncio
import binascii
import logging
import socket
import voluptuo... | ewandor/home-assistant | homeassistant/components/switch/broadlink.py | Python | apache-2.0 | 12,810 |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
import logging
import unittest
import urllib2
from webkitpy.common.net.rietveld import filter_latest_jobs
from webkitpy.common.net.rietveld impo... | danakj/chromium | third_party/WebKit/Tools/Scripts/webkitpy/common/net/rietveld_unittest.py | Python | bsd-3-clause | 4,193 |
# MiniLight Python : minimal global illumination renderer
#
# Harrison Ainsworth / HXA7241 and Juraj Sukop : 2007-2008, 2013.
# http://www.hxa.name/minilight
from math import log10
from vector3f import Vector3f
IMAGE_DIM_MAX = 4000
PPM_ID = 'P6'
MINILIGHT_URI = 'http://www.hxa.name/minilight'
DISPLAY_LUMINANCE_MA... | imapp-pl/golem | gnr/benchmarks/minilight/src/img.py | Python | gpl-3.0 | 2,157 |
# coding: utf-8
# Ref: http://learn101.org/xhosa_plural.php
from sua import *
data = {
'order': bantu['order'],
'order_triple': bantu['order_triple'],
'plural': {
'prefix': {'in': 'izin', 'um':'aba'},
},
'conjugate': {
'prefix': {
'default': {
'inf': 'uku',
'now_tdy': {JE:'nda... | kasahorow/kwl | data/sua_xhosa.py | Python | bsd-2-clause | 1,021 |
#!/bin/env python
"""Service to collect and maintain data from external devices."""
import os
import sys
sys.path.append("../..")
import time
import math
from math import sqrt, acos, degrees
from collections import namedtuple
from multiprocessing import Pipe
from multiprocessing import Process as MultiProcess
imp... | bhenne/MoSP | mosp/external_persons/external_data_manager.py | Python | gpl-3.0 | 18,566 |
from django.test import TestCase, Client
from organizations.models import Organization
# Create your tests here.
class ViewTests(TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_create_org(self):
c = Client()
response = c.post('/register/', {'username': '... | amacnair/team-toolkit | clubbr/organizations/tests.py | Python | mit | 3,992 |
import sys
import os.path
from sqlalchemy import Column, Integer, String
# setup path so we can import our own models and controllers
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from import_tool.models.base import Base
class CodeSystem(Base):
"""
CodeSystems class that keeps track of inf... | open-ods/import_tool | import_tool/models/CodeSystem.py | Python | gpl-3.0 | 844 |
#%%
import pytest
import numpy as np
from numpy.testing import assert_allclose
from natural_bm import components
import natural_bm.backend as B
#%%
def test_NeuralNetParts():
# initialize an abstract neural net part
name = 'test'
nnet = components.NeuralNetParts(name)
# add some weights to it
t... | alexhunterlang/natural_bm | tests/natural_bm/test_components.py | Python | mit | 3,599 |
#!/bin/env python
import sys
import os
services = os.environ['CONDRI_HAPROXY_SERVICES'].split(',')
for x in [x.split('::')[-1] for x in services]:
print x
| thefab/docker-consul-driven-haproxy | root/usr/local/bin/get_service_names.py | Python | mit | 161 |
#!/usr/bin/env python
import unittest
import os
import sys
import signal
import subprocess
import platform
import datetime
import logging
import time
import tempfile
import json
import traceback
abs_file = os.path.abspath(__file__)
abs_dir = os.path.dirname(abs_file)
sys.path.append(abs_dir + '/..')
sys.path.append(a... | TrailingDots/async_py_messaging | async_py_messaging/test/testLogging.py | Python | gpl-3.0 | 35,340 |
from numpy import int_
from platform import system
import serial, time, glob
import sys
def disp_ports():
print "Found ports:"
for name in list_serial_ports(): print name
def list_serial_ports():
if system() == 'Windows':
# Scan for avilable ports
available = []
for ix in range(... | kalleknast/GU_scan | tmca_control.py | Python | mit | 10,007 |
# -*- test-case-name: twisted.names.test.test_names -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from __future__ import absolute_import, division
__all__ = ['SecondaryAuthority', 'SecondaryAuthorityService']
from twisted.internet import task, defer
from twisted.names import dns
from tw... | EricMuller/mynotes-backend | requirements/twisted/Twisted-17.1.0/src/twisted/names/secondary.py | Python | mit | 6,085 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.7.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | djkonro/client-python | kubernetes/test/test_batch_api.py | Python | apache-2.0 | 830 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2014 Didotech SRL (info at didotech.com)
# All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole re... | iw3hxn/LibrERP | export_customers/__openerp__.py | Python | agpl-3.0 | 2,043 |
import numpy as np
import h5py
# value is a list
# converts anything numeric into a float
def processMetadataValue(value):
if len(value) < 2:
return ''
try:
return float(value[1])
except ValueError:
return value[1]
# a fuction to parse txtXY files
# will parse files with or witho... | BiRG/Omics-Dashboard | compute-images/spectra-processing/src/textparsers.py | Python | mit | 1,831 |
#!/usr/bin/env python2.7
import socket
import sys
import struct
import string
import random
import time
# Spawns a reverse cisco CLI
cliShellcode = (
"\x60\xc7\x02\x90\x67\xb9\x09\x8b\x45\xf8\x8b\x40\x5c\x8b\x40\x04"
"\x8b\x40\x08\x8b\x40\x04\x8b\x00\x85\xc0\x74\x3b\x50\x8b\x40\x08"
"\x8b\x40\x04\x8d\x9... | pesaply/sarafu | donot.py | Python | mit | 18,176 |
'''
Created on Apr 2, 2012
@author: Paul Klingelhuber - s1010455@students.fh-hagenberg.at
'''
import os
import Util
import sys
import traceback
from SimpleMailer import SimpleMailer
import Config
class Alarms(object):
'''
The Alarms class is responsible for discovering and running the alarm trigger checkers
... | NoUsername/PyReport | PyReport/Alarms.py | Python | bsd-3-clause | 4,199 |
import os
def get_excluded_files(root):
excluded_files = [
"ert/__init__.py",
"res/analysis/enums/__init__.py",
"ert/config/__init__.py",
"res/analysis/enums/analysis_module_load_status_enum.py",
"ert/enkf/export/__init__.py",
"res/analysis/enums/analysis_module_opt... | Statoil/libres | python/tests/excluded_files.py | Python | gpl-3.0 | 14,799 |
from django.utils import six
from djsw_wrapper.router import SwaggerRouter
from djsw_wrapper.errors import SwaggerValidationError, SwaggerGenericError
import flex
import os
import re
class Swagger():
# handle is local filename, file object, string or url
def __init__(self, handle, module):
self.schema... | ErintLabs/django-openapi-gen | djsw_wrapper/core.py | Python | mit | 1,957 |
# Copyright 2012 Loris Corazza, Sakis Christakidis
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | schristakidis/p2ner | p2ner/components/engine/comboclient/comboclient/__init__.py | Python | apache-2.0 | 813 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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, publish,
... | azverkan/scons | test/packaging/convenience-functions.py | Python | mit | 2,276 |
# -*- coding: utf-8 -*-
from factory import Sequence, PostGenerationMethodCall
from factory.alchemy import SQLAlchemyModelFactory
from flaskapp.user.models import User
from flaskapp.database import db
class BaseFactory(SQLAlchemyModelFactory):
class Meta:
abstract = True
sqlalchemy_session = db.s... | skipallmighty/flask-app | tests/factories.py | Python | bsd-3-clause | 603 |
import hashlib
import os
from django.db import models
from django.contrib.auth.models import User
def set_questionpapername(instance, filename):
hashout = hashlib.md5()
filenamesplit = os.path.splitext(filename)
input_filename = filenamesplit[0].replace(
' ', '_').replace(',', '_').replace('.', '... | balasankarc/vijnana | repository/models.py | Python | gpl-3.0 | 3,885 |
"""
Test Cache decorator
@copyright: 2010-2012
@author: Joseph Tallieu <joseph_tallieu@dell.com>
@organization: Dell Inc. - PG Validation
@license: GNU LGLP v2.1
"""
# This file is part of WSManAPI.
#
# WSManAPI is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Gen... | jtallieu/dell-wsman-client-api-python | wsman/test_cache.py | Python | gpl-3.0 | 1,120 |
# coding=utf-8
# Copyright (c) 2015 EMC Corporation.
# 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
#
#... | emc-openstack/storops | storops/unity/resource/storage_resource.py | Python | apache-2.0 | 1,481 |
# -*- coding: iso-8859-15 -*-
"""
This is BTMS, Bigwood Ticket Management System,
just reserve, sell and print tickets....
"""
# copyright Jakob Laemmle, the GNU GENERAL PUBLIC LICENSE Version 2 license applies
# Kivy's install_twisted_reactor MUST be called early on!
from kivy.support import install_twisted_reactor... | jaques30081983/btms_suite | btms_pos_display/main.py | Python | gpl-2.0 | 9,128 |
import numpy as np
import pandas as pd
from lexos.models.rolling_window_model import RollingWindowsModel, \
RWATestOptions
from lexos.receivers.rolling_window_receiver import RWAFrontEndOptions, \
WindowUnitType, RWATokenType, RWARatioTokenOptions, RWAWindowOptions, \
RWAAverageTokenOptions, RWAPlotOptions
... | WheatonCS/Lexos | test/unit_test/test_rolling_windows_model.py | Python | mit | 12,643 |
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redi... | spxtr/bazel | third_party/protobuf/3.4.0/python/google/protobuf/text_format.py | Python | apache-2.0 | 50,504 |
# Bulletproof Arma Launcher
# Copyright (C) 2016 Lukasz Taczuk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# b... | overfl0/Bulletproof-Arma-Launcher | src/utils/metadatafile.py | Python | gpl-3.0 | 4,301 |
from flask.ext.testing import TestCase
from sample_application.app import create_app
from sample_application.models import db, FavoriteColor
class TestDatabase(TestCase):
"""
Test flask-sqlalchemy database operations
"""
def create_app(self):
"""
Called once at the beginning of the tes... | jonnybazookatone/adsabs-webservices-blueprint | sample_application/tests/unittests/test_database.py | Python | mit | 1,557 |
# -*- coding: utf-8 -*-
# Dioptas - GUI program for fast processing of 2D X-ray diffraction data
# Principal author: Clemens Prescher (clemens.prescher@gmail.com)
# Copyright (C) 2014-2019 GSECARS, University of Chicago, USA
# Copyright (C) 2015-2018 Institute for Geology and Mineralogy, University of Cologne, Germany
... | erangre/Dioptas | dioptas/tests/unit_tests/test_ImgModel.py | Python | gpl-3.0 | 14,066 |
#!/usr/bin/env python
import sys
import csv
csv.field_size_limit(sys.maxsize) # make sure we can write very large csv fields
import os
import argparse
import colored_traceback.always
# if you move this script, you'll need to change this method of getting the imports
partis_dir = os.path.dirname(os.path.realpath(__fil... | psathyrella/partis | bin/parse-output.py | Python | gpl-3.0 | 16,139 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.