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 serial
import rospy
class GroveO2:
"""
Class that represents a Grove O2 sensor instance and provides functions
for interfacing with the sensor.
"""
def __init__(self, analog_port=0, serial_port='/dev/serial/by-id/usb-Numato_Systems_Pvt._Ltd._Numato_Lab_8_Channel_USB_GPIO_Module-if00', pseud... | davoclavo/openag_brain | src/openag_brain/peripherals/grove_o2.py | Python | gpl-3.0 | 2,153 |
""" Sahana Eden Module Automated Tests - HRM006 Add Staff To Office
@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 S... | vgupta6/Project-2 | modules/tests/hrm/add_staff_to_office.py | Python | mit | 2,514 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('questions', '0003_question_owner'),
]
operations = [
migrations.CreateModel(
name='Answer',
fields=[... | Kuzenkov/SimpleAnalogueStackOverflow | questions/migrations/0004_auto_20150211_0703.py | Python | mit | 997 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('commerce', '0002_commerceconfiguration'),
]
operations = [
migrations.AlterModelOptions(
name='commerceconfiguration',
options={},
),
]
| edx/edx-platform | lms/djangoapps/commerce/migrations/0003_auto_20160329_0709.py | Python | agpl-3.0 | 303 |
from flask import render_template
from app import app
@app.route('/')
@app.route('/index')
def index():
user = { 'nickname': 'Miguel' } # fake user
posts = [ # fake array of posts
{
'author': { 'nickname': 'John' },
'body': 'Beautiful day in Portland!'
},
{
... | pugong/microblog | app/index.py | Python | bsd-3-clause | 541 |
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
import racer
import matplotlib.pyplot as plt
speed = 2
wait_time = 0.1
start = racer.Point(2, 0)
goal = racer.Point(2, 4)
fig = plt.figure()
ax_dr = fig.add_subplot(111)
ag = racer.Agent(
racer.model.SinModel(2, 1, 1, 2),
... | wallarelvo/racer | tests/search_test.py | Python | apache-2.0 | 1,261 |
# Copyright 2013 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 app... | waltBB/neutron_read | neutron/db/portbindings_db.py | Python | apache-2.0 | 4,645 |
# coding:utf-8
"""
Created by 捡龙眼
3/4/2016
"""
from __future__ import absolute_import, unicode_literals, print_function
import public.special_exception
LOG_THREAD = "log_thread"
TIME_THREAD = "time_thread"
GLOBAL_THREAD = {}
def add_thread(key, thread_object):
if key in GLOBAL_THREAD:
raise pub... | yanjianlong/server_cluster | public/global_manager.py | Python | bsd-3-clause | 1,046 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('topics', '0005_auto_20150109_1605'),
]
operations = [
migrations.AlterModelOptions(
name='storypointer',
... | texastribune/txlege84 | txlege84/topics/migrations/0006_auto_20150309_1140.py | Python | mit | 380 |
#!/usr/bin/python
#-*- coding: utf-8 -*-
"""
(c) 2012 - Copyright Pierre-Yves Chibon <pingou@pingoured.fr>
Distributed under License GPLv3 or later
You can find a copy of this license on the website
http://www.gnu.org/licenses/gpl.html
This program is free software; you can redistribute it and/or modify
it und... | fedora-infra/fedocal | fedocal_cron.py | Python | gpl-3.0 | 4,708 |
# -*- coding: utf-8 -*-
"""
Catch-up TV & More
Copyright (C) 2018 SylvainCecchetto
This file is part of Catch-up TV & More.
Catch-up TV & More 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 Foundat... | SylvainCecchetto/plugin.video.catchuptvandmore | plugin.video.catchuptvandmore/resources/lib/channels/ch/becurioustv.py | Python | gpl-2.0 | 3,792 |
import logging
import requests
import string
import urllib.parse as parse
from pyquery import PyQuery as pq
class SoundcloudApi:
TRANS_TABLE = str.maketrans('', '', string.punctuation)
def __init__(self):
self.logger = logging.getLogger(__name__)
self.query_url = 'https://soundcloud.com/searc... | nick41496/Beatnik | beatnik/api_manager/clients/soundcloud_api.py | Python | gpl-3.0 | 1,622 |
# -*- coding: utf-8 -*-
##Copyright (C) [2003] [Jürgen Hamel, D-32584 Löhne]
##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 versi... | CuonDeveloper/cuon | cuon_client/cuon/bin/cuon/Addresses/SingleScheduling.py | Python | gpl-3.0 | 3,563 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from nose.tools import ok_
from nose.tools import raises
import os
from py_reporter.utilities import get_named_range
from py_reporter.utilities import get_workbook
import unittest
class TestUtilities(unittest.TestCase):
def setUp(self):
self.cwd = os.path.di... | ryankanno/py-reporter | tests/test_utilities.py | Python | mit | 881 |
# * *************************************************************
# *
# * Soft Active Mater on Surfaces (SAMoS)
# *
# * Author: Rastko Sknepnek
# *
# * Division of Physics
# * School of Engineering, Physics and Mathematics
# * University of Dundee
# *
# * (c) 2013, 2014
# *
# * School of Scienc... | sknepneklab/SAMoS | utils/RastkoVisu/dat2vtp.py | Python | gpl-3.0 | 10,485 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import easy_thumbnails.fields
from django.conf import settings
import userena.models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),... | infinity1207/thirtylol | src/accounts/migrations/0001_initial.py | Python | mit | 2,612 |
# Generated by Django 2.2.1 on 2019-05-18 10:46
from django.db import migrations
def remove_empty(apps, schema_editor):
Certificate = apps.get_model('django_ca', 'Certificate')
Certificate.objects.filter(revoked_reason='').update(revoked_reason='unspecified')
CertificateAuthority = apps.get_model('django... | mathiasertl/django-ca | ca/django_ca/migrations/0014_auto_20190518_1046.py | Python | gpl-3.0 | 677 |
from rect import Rect
class QuadTree(object):
""" QuadTree data structure of simulated objects
"""
#def __init__(self, xywh):
# self.rect = Rect(xywh)
def __init__(self, items=None, depth=8, bounding_rect=None):
"""Creates a quad-tree.
@param items:
A... | ZhuangER/robot_path_planning | scripts/quadtree.py | Python | mit | 5,344 |
"""
Copyright 2014 Michael Seiler
Boston University
miseiler@gmail.com
This file is part of Crosstalker.
Crosstalker 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 ... | miseiler/crosstalker | auc_perm.py | Python | gpl-3.0 | 7,525 |
import logging
import re
import subprocess
from operator import itemgetter
from shutil import which
from streamlink import logger
from streamlink.exceptions import StreamError
from streamlink.stream.streamprocess import StreamProcess
from streamlink.utils import escape_librtmp, rtmpparse
log = logging.getLogger(__nam... | beardypig/streamlink | src/streamlink/stream/rtmpdump.py | Python | bsd-2-clause | 5,251 |
#!/usr/bin/env python
from __future__ import unicode_literals
# Allow direct execution
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import copy
from test.helper import FakeYDL, assertRegexpMatches
from youtube_dl import YoutubeDL
from youtube_d... | marado/youtube-dl | test/test_YoutubeDL.py | Python | unlicense | 15,690 |
# -*- coding: utf-8 -*-
import os, logging
from celery import Celery
from redis import StrictRedis, exceptions
from flask import Flask
app = Flask(__name__, instance_relative_config=True)
app.config.from_object('config')
app.config.from_pyfile('config.py')
# configure logging
logging.basicConfig(
filename=app.config... | marcusmchale/breedcafs | app/__init__.py | Python | gpl-3.0 | 1,878 |
# -*- test-case-name: twisted.positioning.test.test_base,twisted.positioning.test.test_sentence -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Generic positioning base classes.
@since: 14.0
"""
from __future__ import absolute_import, division
from functools import partial
from operat... | EricMuller/mynotes-backend | requirements/twisted/Twisted-17.1.0/src/twisted/positioning/base.py | Python | mit | 28,410 |
from __future__ import absolute_import, print_function
from knit.conf import get_host_port, infer_extra_params, DEFAULTS, get_config
def test_get_host_port():
host, port = get_host_port('hdfs://foo.bar.com:8080')
assert host == 'foo.bar.com'
assert port == 8080
host, port = get_host_port('foo.bar.co... | blaze/knit | knit/tests/test_conf.py | Python | bsd-3-clause | 1,942 |
'''
Created on Oct 7, 2013
@author: lakmal
'''
import uno,wap,unohelper
from com.sun.star.awt import XActionListener
from PIL import Image
import FileHandler as fh
class MyActionListener( unohelper.Base, XActionListener ):
def __init__(self, eventObject):
self.eventObject = eventObject ... | tmtlakmal/EasyTuteLO | src/pythonpaths/FormulaListDialog.py | Python | lgpl-3.0 | 18,611 |
# Copyright 2012 IBM Corp.
# Copyright 2014 Mirantis 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.... | openstack/manila | manila/tests/api/v2/test_services.py | Python | apache-2.0 | 11,187 |
"""DNS Authenticator for Google Cloud DNS."""
import json
import logging
from typing import Any
from typing import Callable
from typing import Dict
from typing import Optional
from googleapiclient import discovery
from googleapiclient import errors as googleapiclient_errors
import httplib2
from oauth2client.service_ac... | letsencrypt/letsencrypt | certbot-dns-google/certbot_dns_google/_internal/dns_google.py | Python | apache-2.0 | 13,492 |
# 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... | mavenlin/tensorflow | tensorflow/contrib/data/python/kernel_tests/map_dataset_op_test.py | Python | apache-2.0 | 22,580 |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2015 Dariusz Suchojad <dsuch at zato.io>
Licensed under LGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# stdlib
from contextlib import closing
# Zato
from zato.common.broker_message i... | ivaano/zato | code/zato-server/src/zato/server/service/internal/channel/stomp.py | Python | gpl-3.0 | 2,297 |
"""
Test LMS Notes
"""
import random
from datetime import datetime
from unittest import skip
from uuid import uuid4
from flaky import flaky
from nose.plugins.attrib import attr
from common.test.acceptance.fixtures.course import CourseFixture, XBlockFixtureDesc
from common.test.acceptance.fixtures.edxnotes import EdxN... | fintech-circle/edx-platform | common/test/acceptance/tests/lms/test_lms_edxnotes.py | Python | agpl-3.0 | 59,950 |
# 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/extra/__init__.py | Python | mit | 1,234 |
DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
CASSANDRA_ADDRESS = 'cassandra.cloudbrain.rocks'
RABBITMQ_ADDRESS = 'rabbitmq.cloudbrain.rocks'
WEBSERVER_ADDRESS = 'webserver.cloudbrain.rocks'
WEBSERVER_PORT = 8080
MOCK_DEVICE_ID = "mock"
# Metric metadata of wearable devices accepted by CloudBrain.
DEVICE_METADATA = [
{'device... | prescottprue/cloudbrain | cloudbrain/settings.py | Python | agpl-3.0 | 3,785 |
import os
import mock
from uuid import uuid4
from urllib.request import urlopen
import datetime
from django.test import TestCase
from django.core.files.base import ContentFile
from django.conf import settings
from django.core.files.storage import FileSystemStorage
from boto.s3.key import Key
from storag... | peterseymour/django-storages-1.1.8 | storages/tests/s3boto.py | Python | bsd-3-clause | 8,692 |
# Convert a single layer from a netCDF variable to a flt file.
# It is assumed that the netCDF variable dimensions are longitude,
# latitude and, optionally, a third dimension such as time or
# channel/waveength
import sys
import os.path
import numpy
import netCDF3
import nc3_handler as nh
def nctoflt(ncfile, fltst... | KimberleyOpie/common-tools | nc_to_formats/nctoflt.py | Python | apache-2.0 | 2,664 |
#!/usr/bin/env python
#
# Copyright 2004,2005 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your opt... | trnewman/VT-USRP-daughterboard-drivers_python | gr-atsc/src/python/fpll.py | Python | gpl-3.0 | 2,429 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012-2013 Yury Konovalov <YKonovalov@gmail.com>
#
# This file is part of SSP.
#
# SSP 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, o... | mdcic/ssp | ssp/chassis/wbem/scanner.py | Python | gpl-3.0 | 3,776 |
from compmod.models import RingCompression
from abapy import materials
from abapy.misc import load
import matplotlib.pyplot as plt
import numpy as np
import pickle, copy
import platform
#PAREMETERS
inner_radius, outer_radius = 45.18 , 50.36
Nt, Nr, Na = 20, 4, 8
Ne = Nt * Nr * Na
disp = 10
nFrames = 100
thickness = 2... | lcharleux/compmod-doc | doc/example_code/models/ring_compression_3D_compart.py | Python | gpl-2.0 | 3,987 |
#!/usr/bin/python
'''
Extract _("...") strings for translation and convert to Qt4 stringdefs so that
they can be picked up by Qt linguist.
'''
from subprocess import Popen, PIPE
import glob
import operator
import os
OUT_CPP="src/qt/iQcoinstrings.cpp"
EMPTY=['""']
def parse_po(text):
"""
Parse 'po' format prod... | iQcoin/iQcoin | share/qt/extract_strings_qt.py | Python | mit | 1,897 |
# Copyright 2018 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | prasanna08/oppia | core/controllers/custom_landing_pages_test.py | Python | apache-2.0 | 3,649 |
# coding: utf-8
from __future__ import (absolute_import, division, print_function, unicode_literals)
import json
import logging
import boto3
from boto3.dynamodb.conditions import Attr
import os
import sys
import uuid
import re
# Path to modules needed to package local lambda function for upload
currentdir = os.path.d... | alanwill/aws-tailor | sam/functions/talr-accountupdate-vpcflowlogs/handler.py | Python | gpl-3.0 | 6,571 |
# -*- 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):
# Deleting field 'Investigator.location'
db.delete_column(u'survey_investigator', 'location_id')
def b... | antsmc2/mics | survey/migrations/0126_auto__del_field_investigator_location.py | Python | bsd-3-clause | 38,033 |
# coding: utf-8
"""
Copyright 2015 SmartBear Software
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... | eshijia/magnum | magnum/common/pythonk8sclient/swagger_client/models/v1_persistent_volume_claim_list.py | Python | apache-2.0 | 5,511 |
from struct import pack, unpack
from operator import itemgetter
class Sentinel(object):
pass
class Message(tuple):
__slots__ = ()
_initialized = False
def __new__(_cls, *args, **kwargs):
if not _cls._initialized:
for i, x in enumerate(_cls._fields):
setattr(_cls, x,... | giannitedesco/funky | funky/message.py | Python | gpl-3.0 | 7,453 |
'''
Copyleft Sep 05, 2016 Arya Iranmehr, PhD Student, Bafna Lab, UC San Diego, Email: airanmehr@gmail.com
'''
import numpy as np;
np.set_printoptions(linewidth=200, precision=5, suppress=True)
import pandas as pd;
pd.options.display.max_rows = 40;
pd.options.display.expand_frame_repr = False
import os;
home = os.pa... | airanmehr/bio | Scripts/TimeSeriesPaper/Plot/likelihood.py | Python | mit | 1,120 |
# This file is part of the Minecraft Overviewer.
#
# Minecraft Overviewer 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... | CounterPillow/Minecraft-Overviewer | overviewer_core/assetmanager.py | Python | gpl-3.0 | 9,291 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 distrib... | Microvellum/Fluid-Designer | win64-vc/2.78/scripts/startup/bl_ui/properties_data_mesh.py | Python | gpl-3.0 | 15,183 |
#!/usr/bin/env python
'''
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")... | arenadata/ambari | ambari-server/src/test/python/stacks/2.1/STORM/test_storm_nimbus_prod.py | Python | apache-2.0 | 6,401 |
"""
Generated by 'django-admin startproject' using Django 1.9.12.
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/
"""
import os
# Build paths inside the project like ... | chriscz/django-webpack-helper | settings.py | Python | mpl-2.0 | 2,881 |
from decimal import *
class PI:
#Sets decimal to 25 digits of precision
getcontext().prec = 1000
@staticmethod
def factorial(n):
# if n<1:
# return 1
# else:
# return n * PI.factorial(n-1)
result = 1
for i in xrange(2, n+1):
result *=... | susemeee/Chunsabot-framework | chunsabot/pi.py | Python | mit | 1,587 |
import sys, socket, re, time, os.path, os
#from pyrrd.rrd import DataSource, RRA, RRD
#from pyrrd.graph import DEF, LINE, GPRINT, Graph
RRD_DB_LOCATION = '/www/rrdtool'
RRD_IMAGES_LOCATION = '/www/rrdtool'
def get_energy():
tx_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
tx_sock.setsockopt(socket.S... | araines/energymonitor | energymonitor.py | Python | mit | 2,340 |
# Copyright (c) 2013-2014 Parallels, 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 ... | CloudServer/pcs-nova-driver | pcsnovadriver/pcs/utils.py | Python | apache-2.0 | 6,694 |
# Copyright 2018 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... | asimshankar/tensorflow | tensorflow/contrib/distribute/python/combinations.py | Python | apache-2.0 | 15,137 |
from __future__ import print_function
import os
from bs4 import BeautifulSoup
import requests
import sys
import pkgutil
import pprint
def parse(content, no_request):
soup = BeautifulSoup(content, 'lxml')
data = {'global': {
'title': '',
'desc': '',
'picture_url': '... | fgaudin/Embeder | embeder/embed.py | Python | lgpl-3.0 | 1,554 |
# Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework 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
... | jaloren/robotframework | src/robot/parsing/settings.py | Python | apache-2.0 | 10,412 |
import sys
import types
import unittest2
if sys.version_info[:2] == (2,3):
from sets import Set as set
from sets import ImmutableSet as frozenset
class Test_TestLoader(unittest2.TestCase):
### Tests for TestLoader.loadTestsFromTestCase
################################################################... | supercheetah/diceroller | pyinstaller/PyInstaller/lib/unittest2/test/test_loader.py | Python | artistic-2.0 | 49,503 |
# [START all]
import argparse
from apiclient.discovery import build
from apiclient.errors import HttpError
from oauth2client.client import GoogleCredentials
def main(project_id):
# [START build_service]
# Grab the application's default credentials from the environment.
credentials = GoogleCredentials.get... | napsternxg/GenderPrediction | data_download.py | Python | gpl-3.0 | 1,931 |
"""
WSGI config for letusorderit project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "letusorderit.settings")
from dja... | mfa/letusorderit | letusorderit/letusorderit/wsgi.py | Python | gpl-3.0 | 399 |
import re
# Examines non-YAML text (probably from a J2 template file?) for
# variable references.
class TextAnalyzer(object):
def __init__(self):
self.references = set()
def get_references(self):
return self.references
def add_text(self, text):
refs = re.findall('{{\s+([^\s]+)\s... | lostbearlabs/ansible-vars | lib/ansiblevars/text_analyzer.py | Python | unlicense | 530 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interpreter version: python 2.7
#
# Imports =====================================================================
# Functions & classes =========================================================
def _by_attr(xdom, attr):
"""
From `xdom` pick element with attri... | edeposit/cz-urnnbn-api | src/cz_urnnbn_api/api_structures/modes.py | Python | mit | 2,772 |
# -*- coding: utf-8 -*-
#
# pyspark documentation build configuration file, created by
# sphinx-quickstart on Thu Aug 28 15:17:47 2014.
#
# 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... | cloud-fan/spark | python/docs/source/conf.py | Python | apache-2.0 | 12,894 |
# Copyright (c) 2020, Djaodjin Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... | djaodjin/djaodjin-multitier | multitier/urlresolvers.py | Python | bsd-2-clause | 11,381 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
"""
Creates a country database with ISO 2 and ISO 3 character codes, ISO number,
name and international dialing codes.
The data comes from three sources:
* United Nations statistics
* WorldAtlas.com
* Wikipedia
This code merges data from the three sources, con... | Rethought/globaldict | build.py | Python | bsd-3-clause | 13,459 |
__author__ = 'kennyjoseph'
from utility_code.run_helpers import *
from utility_code.evaluation import *
from gensim.models.word2vec import Word2Vec
from twitter_dm.utility.general_utils import tab_stringify_newline as tsn
CONLL_FILE = "processed_data/final_all_conll_w_all_features.txt"
model, all_dictionaries, ark... | kennyjoseph/identity_extraction_pub | python/12_run_final_model_on_pub_data.py | Python | mit | 4,401 |
# Copyright (c) 2014 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | DavidPurcell/murano_temp | murano/engine/system/net_explorer.py | Python | apache-2.0 | 7,838 |
#!/usr/bin/env python
import os, sys, pyexiv2
from pyexiv2.utils import make_fraction
import argparse
from lib.geo import compute_bearing, dms_to_decimal, offset_bearing
from lib.sequence import Sequence
from lib.exifedit import ExifEdit
'''
Interpolates the direction of an image based on the coordinates stored in
th... | gisma/uavRmp | inst/python/interpolate_direction.py | Python | gpl-3.0 | 2,118 |
#!/usr/bin/env python
"""
This is a time sharing example...
The main code of this example is like an operating system that shares time
between the two 'threads' or 'processes'. Each one has a state,stack and all.
This is a co-operative system: if one of the processes never calls yield or goes
into a blocking call then... | veltzer/demos-python | src/examples/short/generators/yield_advanced.py | Python | gpl-3.0 | 1,038 |
# 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... | nttcom/eclcli | eclcli/monitoring/monitoringclient/client.py | Python | apache-2.0 | 19,427 |
#!/usr/bin/python
from mininet.net import Mininet
from mininet.topo import Topo,SingleSwitchTopo
from mininet.cli import CLI
from mininet.node import UserSwitch,RemoteController
from mininet.term import makeTerm
import os, time
######Starting controller
os.system("xterm -e 'ryu-manager ~/ryu/ryu/app/openstate/forwar... | Tesi-Luca-Davide/ryu | ryu/app/openstate/playground/start_1_to_many.py | Python | apache-2.0 | 1,415 |
#!/usr/bin/env python
'''
simple rover simulator core
'''
from aircraft import Aircraft
import util, time, math
from math import degrees, radians, sin, cos, pi, asin
from rotmat import Vector3, Matrix3
class Rover(Aircraft):
'''a simple rover'''
def __init__(self,
max_speed=20,
... | MagicAttacker/APM602 | Tools/autotest/pysim/rover.py | Python | gpl-3.0 | 5,483 |
import collections
import raco.algebra
import raco.scheme as scheme
import raco.myrial.myrial_test as myrial_test
from raco import types
class ReachableTest(myrial_test.MyrialTestCase):
edge_table = collections.Counter([
(1, 2),
(2, 3),
(3, 4),
(4, 3),
(3, 5),
(4... | uwescience/raco | raco/myrial/reachable_tests.py | Python | bsd-3-clause | 2,583 |
from datetime import timedelta
from datetime import datetime
from collections import defaultdict
import requests
import os
import urllib
import logging
import arrow
from impactstoryanalytics.widgets.widget import Widget
from impactstoryanalytics.lib import mixpanel_export
import uservoice
logger = logging.getLogger("... | Impactstory/impactstory-analytics | impactstoryanalytics/widgets/widget_api_helpers.py | Python | mit | 13,794 |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | citrix-openstack-build/django_openstack_auth | openstack_auth/backend.py | Python | apache-2.0 | 8,852 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | andhit-r/opnsynid-accounting-report | opnsynid_balance_sheet_aeroo_report/__init__.py | Python | agpl-3.0 | 1,022 |
# -*- coding: utf-8 -*-
# ***********************************
# Author: Pedro Jorge De Los Santos
# E-mail: delossantosmfq@gmail.com
# License: MIT License
# ***********************************
import numpy as np
from nusa.core import *
from nusa.model import *
from nusa.element import *
def test5():
"""
... | JorgeDeLosSantos/nusa | examples/beam/beam_5.py | Python | mit | 1,354 |
import os
import os.path
import struct
import pytest
from file_manip_toolkit.unfman.CustomFormat import CustomFormat, interleave, deinterleave
# This is probably gonna get deleted/moved to other places
TESTDATA = bytearray.fromhex('0A 0B 0C 0D A0 B0 C0 D0')
TESTDATA2 = bytearray.fromhex('FA FB FC FD AF BF CF DF')
TE... | goosechooser/file-manip-toolkit | tests/file_manip_test.py | Python | mit | 1,899 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#----------------------------------------------------------------------------
# Download OSM data covering the area of a slippy-map tile
#
# Features:
# * Recursive (downloads are all at z15, and merged if necessary to get
# a larger area)
# * Cached (all downloads stored... | ryfx/modrana | modules/pyrender/OsmTileData.py | Python | gpl-3.0 | 3,691 |
"""
Representations of the structure of a static directory being served by holtz.
"""
from holtz import compat
class Directory(object):
"""
A directory being served.
"""
def __init__(self):
self.subdirectories = compat.OrderedDict()
self.entries = []
class Entry(object):
"""
... | lvh/holtz | holtz/structure.py | Python | isc | 460 |
from pyqtcss import available_styles, get_style
if len(available_styles()) == 0:
from setup import compile_css
compile_css() | sommerc/pyqt-stylesheets | __init__.py | Python | bsd-3-clause | 133 |
#
# Copyright 2008,2009 Free Software Foundation, Inc.
#
# This application 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, or (at your option)
# any later version.
#
# This application is ... | koppa/gr-air-modes | python/__init__.py | Python | gpl-3.0 | 3,039 |
from os import path
from undine.database.sqlite import SQLiteConnector
from undine.server.driver.base_driver import BaseDriver
from undine.server.information import ConfigInfo, WorkerInfo, InputInfo
from undine.server.information import TaskInfo
from undine.utils.exception import UndineException
class SQLiteDriver(Ba... | Sungup/Undine | undine/server/driver/sqlite.py | Python | mit | 3,538 |
#(C) Copyright Syd Logan 2019-2020
#(C) Copyright Thousand Smiles Foundation 2019-2020
#
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#
#You may obtain a copy of the License at
#http://www.apache.org/licenses/LICENSE-2.0
#
#Unless req... | slogan621/tscharts | tschartslib/entdiagnosisextra/entdiagnosisextra.py | Python | apache-2.0 | 18,912 |
# Copyright 2017 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 a... | powervm/pypowervm | pypowervm/tests/tasks/hdisk/test_rbd.py | Python | apache-2.0 | 2,335 |
# Copyright 2015 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | tswast/google-cloud-python | bigquery/tests/unit/test_table.py | Python | apache-2.0 | 132,151 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2002-2006 Zuza Software Foundation
#
# This file is part of translate.
# The file was copied from the Python 2.5 source.
#
# translate is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published b... | jagg81/translate-toolkit | translate/misc/contextlib.py | Python | gpl-2.0 | 5,557 |
__author__ = 'Administrator'
# 1.preper the music data in 'musics' file, and the music format must be '.wav'
# 2.run the pkl_music_featuer_lable to pkl the dataset
# 3.run DBN | daleloogn/BUG-Theano-DBN | use_dbn_on_bigset/__init__.py | Python | gpl-2.0 | 181 |
# $Id: 300_ice_1_1.py 2084 2008-06-27 23:53:00Z bennylp $
#
from inc_cfg import *
# ICE mismatch
test_param = TestParam(
"Callee=use ICE, caller=use ICE",
[
InstanceParam("callee", "--null-audio --use-ice --max-calls=1", enable_buffer=True),
InstanceParam("caller", "--null-audio --use-ice --max-calls=1", ena... | halex2005/pjproject | tests/pjsua/scripts-call/300_ice_1_1.py | Python | gpl-2.0 | 345 |
from mido import MidiFile, MidiTrack, Message
from keras.layers import LSTM, Dense, Activation, Dropout
from keras.preprocessing import sequence
from keras.models import Sequential
from keras.optimizers import RMSprop
from sklearn.preprocessing import MinMaxScaler
import numpy as np
import mido
########### PROCESS MID... | anandha2017/udacity | nd101 Deep Learning Nanodegree Foundation/DockerImages/26_sirajs_text_summarisation/notebooks/02-rudimentary-ai-composer/createmusic.py | Python | mit | 3,179 |
"""
Unit tests for DVCS wrapper.
Simplified BSD-license. (c) Kevin Dunn, 2011.
"""
from django.test import TestCase
from scipy_central import utils
# Python imports
import os
import shutil
import tempfile
import scipy_central.filestorage.dvcs_wrapper as dvcs
class DVCS_Tests(TestCase):
def setUp(self):
... | Srisai85/SciPyCentral | scipy_central/filestorage/tests.py | Python | bsd-3-clause | 5,122 |
import logging
try:
from configparser import ConfigParser
except ImportError:
# Python 2 support
from ConfigParser import ConfigParser
logger = logging.getLogger("packges.knightos.org")
logger.setLevel(logging.DEBUG)
sh = logging.StreamHandler()
sh.setLevel(logging.DEBUG)
formatter = logging.Formatter("%... | KnightOS/packages.knightos.org | packages/config.py | Python | mit | 619 |
#---------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#---------------------------------------------------------------------... | BurtBiel/azure-cli | src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/tests/test_api_check.py | Python | mit | 2,871 |
# app.routing.tasks
import logging, json, re, pytz
from time import sleep
from bson import ObjectId as oid
from flask import g
from dateutil.parser import parse
from datetime import datetime, date, time, timedelta
from app import celery, get_keys, get_group
from app.lib import gcal, gdrive, timer
from app.lib.utils im... | SeanEstey/Bravo | app/routing/tasks.py | Python | gpl-2.0 | 6,613 |
import html.parser
import urllib.parse
import markdown_dictionary as m
class Htmlparser(html.parser.HTMLParser):
# History of tag,attrs to get attrs-data at handle_endtag()
pathList = []
# The markdown string which will get build over time
result = ''
# The current data from the current opened tag... | Tinywave/polarbytebot | overwatch_html2markdown.py | Python | mit | 6,973 |
"""The MIT License (MIT)
Copyright (c) 2016 Robert A. Brown (www.robbtech.com)
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,... | robb-brown/IntroToDeepLearning | tfs/tfs/TensorFlowInterface.py | Python | mit | 15,513 |
import functools
import numpy
import chainer
from chainer.backends import cuda
from chainer.testing import attr
class BackendConfig(object):
_props = [
('use_cuda', False),
('use_cudnn', 'never'),
('cudnn_deterministic', False),
('autotune', False),
('use_ideep', 'never'... | aonotas/chainer | chainer/testing/backend.py | Python | mit | 3,973 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "TesisApp.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the... | scairi/Eevee | TesisApp/manage.py | Python | apache-2.0 | 806 |
"""
URL filter and manipulation tools
http://github.com/adbar/courlan
"""
import re
from pathlib import Path
from setuptools import setup
def get_version(package):
"Return package version as listed in `__version__` in `init.py`"
# version = Path(package, '__init__.py').read_text() # Python >= 3.5
with ... | adbar/url-tools | setup.py | Python | gpl-2.0 | 3,075 |
class Scheduler(object):
"""Define a domain."""
def __init__(self, matches, problem):
""".
PARAMETERS TYPE Potential Arguments
-----------------------------------------------
"""
self.matches = matches
schedule = []
self.allSchedules = []... | renatorangel/scheduler | src/structures/scheduler.py | Python | apache-2.0 | 566 |
from sourcemash.database import db
class Feed(db.Model):
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(250))
url = db.Column(db.String(2083), index=True, unique=True)
description = db.Column(db.Text)
image_url = db.Column(db.String(2083))
last_updated = db.Column(db.... | sourcemash/Sourcemash | sourcemash/feeds/models.py | Python | gpl-2.0 | 618 |
# Copyright 2013 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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | alanquillin/quark | quark/tests/plugin_modules/test_floating_ips.py | Python | apache-2.0 | 30,810 |
import sales_order_notes
| OpusVL/odoo_line_notes_field | line_notes_field/__init__.py | Python | agpl-3.0 | 25 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.