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 |
|---|---|---|---|---|---|
"""Sequence-to-sequence model with an attention mechanism."""
import random
import numpy as np
import tensorflow as tf
from tensorflow.models.rnn import rnn_cell
from tensorflow.models.rnn import seq2seq
from tensorflow.models.rnn.translate import data_utils
class Seq2SeqModel(object):
"""Sequence-to-sequence m... | rickyHong/Tensorflow_modi | tensorflow/models/rnn/translate/seq2seq_model.py | Python | apache-2.0 | 12,766 |
def comb(*sequences):
'''
combinations of multiple sequences so you don't have
to write nested for loops
>>> from pprint import pprint as pp
>>> pp(comb(['Guido','Larry'], ['knows','loves'], ['Phyton','Purl']))
[['Guido', 'knows', 'Phyton'],
['Guido', 'knows', 'Purl'],
['Guido', '... | ActiveState/code | recipes/Python/502199_Another_generator_arbitrary_number/recipe-502199.py | Python | mit | 2,632 |
#####################################################################
#
# metro.py
#
# Copyright (c) 2016, Eran Egozy
#
# Released under the MIT License (http://opensource.org/licenses/MIT)
#
#####################################################################
from clock import kTicksPerQuarter, quantize_tick_up
cla... | rusch95/calypso | src/common/metro.py | Python | bsd-3-clause | 2,521 |
"""Custom topologies for Mininet
author: Brandon Heller (brandonh@stanford.edu)
To use this file to run a RipL-specific topology on Mininet. Example:
sudo mn --custom ~/ripl/ripl/mn.py --topo ft,4
"""
from ripl.dctopo import FatTreeTopo, JellyfishTopo
topos = { 'ft': FatTreeTopo, 'jf': JellyfishTopo }
| XianliangJ/collections | Jellyfish/ripl/ripl/mn.py | Python | gpl-3.0 | 311 |
# Copyright 2015 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... | sjperkins/tensorflow | tensorflow/contrib/rnn/python/ops/rnn_cell.py | Python | apache-2.0 | 83,473 |
import time
from collections import deque
from copy import deepcopy
import numpy as np
import pposgd_mpi.common.tf_util as U
import tensorflow as tf
from mpi4py import MPI
from pposgd_mpi.common import Dataset, explained_variance, fmt_row, zipsame
from pposgd_mpi.common import logger
from pposgd_mpi.common.mpi_adam im... | nottombrown/rl-teacher | agents/pposgd-mpi/pposgd_mpi/pposgd_simple.py | Python | mit | 11,088 |
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
from emukit.__version__ import __version__
| EmuKit/emukit | emukit/__init__.py | Python | apache-2.0 | 156 |
# Copyright 2015 NEC 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
#
# Unless required ... | openstack/python-magnumclient | magnumclient/v1/clusters_shell.py | Python | apache-2.0 | 10,762 |
import tangelo
import tangelo.util
from tangelo.server import analyze_url
from tangelo.server import Content
def run(*path, **query):
if len(path) == 0:
tangelo.http_status(400, "Missing Path")
return {"error": "missing path to config file"}
required = query.get("required") is not None
u... | Kitware/tangelo | tangelo/tangelo/pkgdata/plugin/config/web/config.py | Python | apache-2.0 | 1,351 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | rpc/rpc_agent.py | Python | apache-2.0 | 8,111 |
__version__ = "1.0.0"
from client import ReadyMap | pelicanmapping/readymap-python | readymap/__init__.py | Python | mit | 52 |
import PetscBinaryIO
import numpy as np
from mpl_toolkits.axes_grid1 import make_axes_locatable
import matplotlib.pyplot as plt
dataDirectory='../run/output/'
logname=dataDirectory+"particles.log"
log = np.loadtxt(logname)
nplot=log.size/2;
#iPlot=raw_input("iPlot = ?");
#iP=or... | yxchenyq/Q-PIC | script/plot_particle_velocity.py | Python | gpl-2.0 | 975 |
from django.db import models
from behaviors.behaviors import (Authored, Editored, Published, Released,
Slugged, Timestamped, StoreDeleted)
from behaviors.managers import (AuthoredManager, EditoredManager,
PublishedManager, ReleasedManager,
... | audiolion/django-behaviors | tests/models.py | Python | mit | 2,363 |
from django.contrib.auth.models import AbstractUser
from django.db import models
class MemoUser(AbstractUser):
pass
class Game(models.Model):
STATUS_VALUES = [
('WA', 'WaitingForPlayers'),
('PR', 'InProgress'),
('FI', 'Finished'),
]
state = models.CharField(max_length=2, nul... | galuszkak/djangodash | game/models.py | Python | gpl-2.0 | 1,522 |
#! /usr/bin/env python
########################################################################
# $HeadURL$
# File : dirac-admin-bdii-ce-state
# Author : Adria Casajus
########################################################################
"""
Check info on BDII for CE state
"""
__RCSID__ = "$Id$"
from DIRAC imp... | avedaee/DIRAC | Core/scripts/dirac-admin-bdii-ce-state.py | Python | gpl-3.0 | 2,001 |
import collections
import json
import re
from dcos import util
from dcos.errors import DCOSException
logger = util.get_logger(__name__)
def parse_json_item(json_item, schema):
"""Parse the json item based on a schema.
:param json_item: A JSON item in the form 'key=value'
:type json_item: str
:param... | genome21/dcos-cli | dcos/jsonitem.py | Python | apache-2.0 | 7,404 |
#------------------------------------------
# Sample Tropo.com multi-channel weather app, specifically optimized for Twitter
#
# Copyright (c) 2010 Voxeo Corp.
# Created by Dan York
# See the LICENSE file for distribution and usage
#
# This is a variation of the sample app found at:
#
# http://github.com/voxeo/tropo-sa... | tropo/tropo-twitter-samples | yahooweather.py | Python | mit | 2,787 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | iemejia/incubator-beam | sdks/python/apache_beam/io/sources_test.py | Python | apache-2.0 | 4,193 |
__author__ = 'kevin'
#
# # -*- coding: utf-8 -*-
# from selenium import webdriver
# from selenium.webdriver.common.by import By
# from selenium.webdriver.common.keys import Keys
# from selenium.webdriver.support.ui import Select
# from selenium.common.exceptions import NoSuchElementException
# from selenium.common.exce... | kevyin/nbnfinder | test/test_search.py | Python | apache-2.0 | 2,519 |
from datetime import datetime
def easter_sunday(year):
y = year
a = y % 19
b = y / 100
c = y % 100
d = b / 4
e = b % 4
g = (8 * b + 13) / 25
h = (19 * a + b - d - g + 15) % 30
j = c / 4
k = c % 4
m = (a + 11 * h) / 319
r = (2 * e + 2 * j - k - h + m + 32) % 7
n = (h - m + r + 90) / 25 # mes
p = (h - m + ... | vfcardoso3/pasco | app/util/holiday.py | Python | mit | 467 |
# -*- Mode: python; coding: utf-8; tab-width: 8; indent-tabs-mode: t; -*-
#
# Copyright (C) 2009 Jonathan Matthew <jonathan@d14n.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 ve... | mssurajkaiga/rhythmbox | plugins/artsearch/lastfm.py | Python | gpl-2.0 | 5,171 |
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
from django.core.urlresolvers import rever... | harisubramaniam/taskbuster-boilerplate | functional_tests/test_all_auth.py | Python | mit | 2,872 |
#!/usr/bin/python
"""
####################################################################################################
TITLE : HPE XP7 Migration, Prepare
DESCRIPTION : Prepare does the setup and start of the CaJ replication
AUTHOR : Koen Schets / StorageTeam
VERSION : Based on previous ODR framework
1.... | kschets/XP_migrator | xpmig_prepare.py | Python | mit | 23,064 |
# coding: utf-8
from __future__ import unicode_literals
import re
import time
import xml.etree.ElementTree as etree
from .common import InfoExtractor
from ..compat import (
compat_kwargs,
compat_urlparse,
)
from ..utils import (
unescapeHTML,
urlencode_postdata,
unified_timestamp,
ExtractorErr... | rg3/youtube-dl | youtube_dl/extractor/adobepass.py | Python | unlicense | 41,407 |
"""Implementation of JSONDecoder
"""
from __future__ import absolute_import
import re
import sys
import struct
from .compat import fromhex, b, u, text_type, binary_type, PY3, unichr
from .scanner import make_scanner, JSONDecodeError
def _import_c_scanstring():
try:
from ._speedups import scanstring
... | prashanthr/wakatime | wakatime/packages/simplejson/decoder.py | Python | bsd-3-clause | 14,721 |
# 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/search/azure-search-documents/azure/search/documents/indexes/_generated/models/_search_client_enums.py | Python | mit | 61,806 |
# setup.py script for pyparted
# Copyright (C) 2011-2013 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.... | vojtechtrefny/pyparted | setup.py | Python | gpl-2.0 | 3,101 |
#!/usr/bin/env python3
from gi.repository import GObject
import dbus
import dbus.service
import dbus.glib
import syslog
import random
syslog.openlog("BlueMock-DBus")
session_bus = dbus.SessionBus()
service = dbus.service.BusName("org.bluem", bus=session_bus)
def _log(text):
syslog.syslog(syslog.LOG_ALERT, text)... | highmobility/bluex | test/bluem-dbus/bluem-service.py | Python | mit | 7,508 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""Youtubedlg __init__ file.
Responsible on how the package looks from the outside.
Example:
In order to load the GUI from a python script.
import youtube_dl_gui
youtube_dl_gui.main()
"""
from __future__ import unicode_literals
import sys
import... | pr0d1r2/youtube-dl-gui | youtube_dl_gui/__init__.py | Python | unlicense | 1,625 |
from __future__ import unicode_literals
import io
import json
import traceback
import hashlib
import os
import subprocess
import sys
from zipimport import zipimporter
from .compat import (
compat_str,
compat_urllib_request,
)
from .utils import make_HTTPS_handler
from .version import __version__
def rsa_ver... | apllicationCOM/youtube-dl-api-server | youtube_dl_server/youtube_dl/update.py | Python | unlicense | 7,467 |
import zeit.cms.testing
import zeit.content.cp
import zeit.content.cp.centerpage
class TestMail(zeit.cms.testing.BrowserTestCase):
layer = zeit.content.cp.testing.ZCML_LAYER
def setUp(self):
super(TestMail, self).setUp()
self.centerpage = zeit.content.cp.centerpage.CenterPage()
self.... | ZeitOnline/zeit.content.cp | src/zeit/content/cp/browser/blocks/tests/test_mail.py | Python | bsd-3-clause | 1,873 |
# -*- coding: utf-8 -*-
# Copyright 2016 LasLabs Inc.
# License MIT (https://opensource.org/licenses/MIT).
import enum
class EnumOrderState(enum.Enum):
""" It provides PEP-0435 compliant Carepoint State Enumerable """
entered = 10
verified = 20
adjudicated = 30
processed = 35
approved = 40
... | laslabs/Python-Carepoint | carepoint/models/state.py | Python | mit | 354 |
from __future__ import absolute_import
import re
import logging
import zlib
import json
import ast
try:
from vcr.serializers import yamlserializer
except ImportError:
yamlserializer = None
from .exceptions import ConfigItemMissing
logging.basicConfig()
class ConfigDict(dict):
def __getitem__(self, key... | ctripcorp/tars | rest_client/utils.py | Python | apache-2.0 | 3,973 |
#
# Copyright 2007 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 option)
# any later version.
#
#... | trdean/grEME | gnuradio-runtime/python/gnuradio/gr/top_block.py | Python | gpl-3.0 | 6,677 |
import hyperion, time, colorsys, random
# get args
sleepTime = float(hyperion.args.get('speed', 1.0))
saturation = float(hyperion.args.get('saturation', 1.0))
ledData = bytearray()
# Initialize the led data
for i in range(hyperion.ledCount):
ledData += bytearray((0,0,0))
# Start the write data loop
while not hy... | ntim/hyperion | effects/random.py | Python | mit | 638 |
import app_settings
from django.core.urlresolvers import reverse
from django.contrib import admin
from forms import EmailForm, FileForm, SubmissionForm
from models import Submission, Email, File, FileArchive
import os
#global callables
def delete_row(obj):
return '<a href="%s/delete">Delete</a>' % obj.id
delete_row.a... | django-bft/django-bft | bft/admin.py | Python | gpl-3.0 | 3,384 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class GoogleAppSetup(Document):
pass
| saurabh6790/google_integration | google_integration/google_connect/doctype/google_app_setup/google_app_setup.py | Python | mit | 280 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
#
# Copyright (c) 2014 Noviat nv/sa (www.noviat.com). All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under... | kailIII/emaresa | trunk.pe/account_move_line_report_xls/account_move_line.py | Python | agpl-3.0 | 2,319 |
# -*- coding: utf-8 -*-
"""
Barcodes for Python - Module for writing.
Copyright 2009 Peter Gebauer
Cairo backend for writing barcodes.
"Barcodes for Python" 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, eithe... | funkring/fdoo | addons-funkring/report_aeroo/barcodes/write.py | Python | agpl-3.0 | 8,543 |
"""
WSGI config for codemood project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION``... | mindinpanic/codingmood | codemood/codemood/wsgi.py | Python | mit | 1,564 |
"""Tests for tensorflow.ops.data_flow_ops.FIFOQueue."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import random
import re
import time
import tensorflow.python.platform
import numpy as np
from six.moves import xrange # pylint: disable=redefined-built... | arunhotra/tensorflow | tensorflow/python/kernel_tests/fifo_queue_test.py | Python | apache-2.0 | 37,721 |
# -*- coding:utf-8 -*-
from django.conf.urls import url
from ..exceptions import (
ActionTypeException
)
from .action import ServiceAction
class Service(object):
def __init__(self, name):
self._name = name
self._actions = {}
self._paths = {}
self._url_patterns = []
def ... | Alexoner/health-care-demo | careHealth/earth/api/service/service.py | Python | gpl-2.0 | 1,107 |
# encoding: 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):
db.rename_column('hansards_document', 'wordoftheday', 'most_frequent_word')
# Deleting field 'Document.se... | twhyte/openparliament | parliament/hansards/migrations/0009_document_fields.py | Python | agpl-3.0 | 9,924 |
#-*- coding: utf-8 -*_
__author__ = 'Arvin'
import time, logging
import db
#save the database's name and type
class Field(object):
_count = 0
def __init__(self, **kw):
self.name = kw.get('name', None)
self._default = kw.get('default', None)
self.primary_key = kw.get('primary_key', False)
self.nullable = kw... | arvinls/webapp | www/transwarp/orm_wrong.py | Python | gpl-2.0 | 7,285 |
# Dataset created from this:
# Elements of Statistical Learning 2nd Ed.; Hastie, Tibshirani, Friedman; Feb 2011
# example 10.2 page 357
# Ten features, standard independent Gaussian. Target y is:
# y[i] = 1 if sum(X[i]) > .34 else -1
# 9.34 is the median of a chi-squared random variable with 10 degrees of freedom
# ... | janezhango/BigDataMachineLearning | py/testdir_single_jvm_fvec/test_KMeans_hastie_shuffle_fvec.py | Python | apache-2.0 | 5,510 |
'''
urlresolver XBMC Addon
Copyright (C) 2016 Gujal
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 program is di... | felipenaselva/felipe.repository | script.module.urlresolver.xxx/resources/plugins/gotporn.py | Python | gpl-2.0 | 1,105 |
# standard imports
import os
import logging
import traceback
# Qt imports
from PyQt5.QtCore import pyqtSignal, pyqtSlot
from PyQt5.QtWidgets import QPlainTextEdit
# toolbox imports
from dltb.util.debug import edit
# GUI imports
from ..utils import protect
# logging
LOG = logging.getLogger(__name__)
class QLogHa... | Petr-By/qtpyvis | qtgui/widgets/logging.py | Python | mit | 5,929 |
from foo import *
print hello
print world
print fengbo
| fengbohello/practice | python/__all__/test-a.py | Python | lgpl-3.0 | 58 |
"""
spelchek
--------
A cheap-ass, pure-python spellchecker based on Peter Norvig's python bayes demo at http://norvig.com/spell-correct.html
The interesting external methods are
* known() filters a list of words and returns only those in the dictionary,
* correct() returns the best guess for the supplied wor... | theodox/spelchek | spelchek/checker.py | Python | mit | 5,090 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
# metadata
from __future__ import unicode_literals
import frappe, os
from frappe.model.meta import Meta
from frappe.modules import scrub, get_module_path, load_doctype_module
from frappe.model.workflow import get_wo... | gangadharkadam/v5_frappe | frappe/desk/form/meta.py | Python | mit | 6,283 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | caltrain/glm_modeling/glmmodel.py | Python | apache-2.0 | 12,918 |
from __future__ import division
import numpy as np
def masterbias(image, skip = 0):
"""
Create an average master bias frame.
Parameters
----------
image : numpy array
3D bias array from CHIMERA
skip : int
Number of frames of skip from start. Default is 0 (no fra... | caltech-chimera/pychimera | chimera/calibrate.py | Python | mit | 3,887 |
#
# This code is part of Ansible, but is an independent component.
#
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complet... | jmehnle/ansible | lib/ansible/module_utils/nxos.py | Python | gpl-3.0 | 13,388 |
import sys
if sys.version_info >= (2,7):
import unittest
else:
import unittest2 as unittest
| hypriot/compose | tests/__init__.py | Python | apache-2.0 | 102 |
#!/usr/bin/env python3
"""
setup.py for installing F2PY
Usage:
pip install .
Copyright 2001-2005 Pearu Peterson all rights reserved,
Pearu Peterson <pearu@cens.ioc.ee>
Permission to use, modify, and distribute this software is given under the
terms of the NumPy License.
NO WARRANTY IS EXPRESSED OR IMPLIED. USE A... | WarrenWeckesser/numpy | numpy/f2py/setup.py | Python | bsd-3-clause | 2,386 |
"""Class for storing shared keys."""
from utils.cryptomath import *
from utils.compat import *
from mathtls import *
from Session import Session
from BaseDB import BaseDB
class SharedKeyDB(BaseDB):
"""This class represent an in-memory or on-disk database of shared
keys.
A SharedKeyDB can be passed to a s... | edisonlz/fruit | web_project/base/site-packages/gdata/tlslite/SharedKeyDB.py | Python | apache-2.0 | 1,914 |
from utils import bold_utils
import pretty_markdown
class ConvertBoldCommand(pretty_markdown.PrettyMarkdownCommand):
def modify(self, text):
"""Converts any bold implementation into the one defined in the settings."""
bold_character = pretty_markdown.settings().get('bold_character')
retu... | Brickstertwo/pretty-markdown | bolds.py | Python | mit | 370 |
import os
from subprocess import call
from . import glob2
pwd = os.path.dirname(__file__)
def get_files_from_path(path, ext):
# use set to remove duplicate files. weird...but it happens
if os.path.isfile(path): return set([os.path.abspath(path)])
else: # i.e., folder
files = glob2.glob(os.path.a... | plum-umd/java-sketch | jskparser/jskparser/util.py | Python | mit | 3,586 |
from online import *
| ff0000/red-start | red_start/templates/project/ff0000/project/settings/hosts/dev-server.py | Python | mit | 21 |
#! /usr/bin/env python
usage = """%prog Version of 6th September, 2011
(c) Mark Johnson
Usage: %prog [options]"""
import optparse, re, sys
import lx
consonants = "bcdDfghGklmnNprsStTvwyzZ4"
vowels = "a&AOQ69EeIio7UuR2"
syllabicconsonants = "mnNS"
def read_data(inf, max_nlines=0):
prefixes = se... | SnippyHolloW/contextual_word_segmentation | mark_scripts/topicsandcollocations/write-grammar.py | Python | mit | 54,337 |
"""Base class for undirected graphs.
The Graph class allows any hashable object as a node
and can associate key/value attribute pairs with each undirected edge.
Self-loops are allowed but multiple edges are not (see MultiGraph).
For directed graphs see DiGraph and MultiDiGraph.
"""
# Copyright (C) 2004-2015 by
# ... | valiantljk/graph-partition | classes/graph.py | Python | gpl-2.0 | 59,127 |
# -*- coding: utf8 -*-
"""
tomber - a python Tomb (the Crypto Undertaker) wrapper
To use tomber you need to install Tomb (https://github.com/dyne/Tomb)
Copyright © 2014, Federico reiven <reiven_at_gmail.com>
Licensed under BSD License.
See also LICENSE file
"""
from subprocess import Popen, PIPE
from tools import ... | arrchid/Tomb | extras/tomber/tomber/tomber.py | Python | gpl-3.0 | 4,899 |
import android,time
droid=android.Android()
droid.startLocating(50000)
time.sleep(60)
print(droid.readLocation().result)
droid.stopLocating() | Bolt64/my_code | android_scripts/locate.py | Python | mit | 141 |
# Generated by Django 2.2.24 on 2021-08-20 19:18
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('course_goals', '0006_add_unsubscribe_token'),
]
operations = [
migrations.AlterField(
model_name='coursegoal',
... | eduNEXT/edx-platform | lms/djangoapps/course_goals/migrations/0007_set_unsubscribe_token_default.py | Python | agpl-3.0 | 870 |
import os
from qgis.PyQt.QtCore import pyqtSignal, QSize, Qt
from qgis.PyQt.QtGui import QPixmap
from qgis.PyQt.QtWidgets import QListWidgetItem, QWidget
import roam.api
import roam.api.utils
import roam.project
import roam.updater
import roam.utils
from roam.ui.ui_listmodules import Ui_ListModules
from roam.ui.ui_pr... | DMS-Aus/Roam | src/roam/listmodulesdialog.py | Python | gpl-2.0 | 7,739 |
# This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django.db import models
from django.utils.translation import ugettext_lazy as _
class Project(models.Model):
""" A project, tracked for funding purposes.... | fnp/redakcja | src/documents/models/project.py | Python | agpl-3.0 | 665 |
"""
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
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
d... | googleinterns/adversarial-0th-order-optimization | discretezoo/loss/semantic_similarity.py | Python | apache-2.0 | 9,072 |
# -*- coding: utf-8 -*-
"""Generic support for iptables firewall management.
@author: Tobias Hunger <tobias.hunger@gmail.com>
"""
from ...exceptions import GenerateError
from ...location import Location
from ...systemcontext import SystemContext
from ..file import create_file
import os
import textwrap
import typing... | hunger/cleanroom | cleanroom/helper/archlinux/iptables.py | Python | gpl-3.0 | 6,382 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2017-03-23 22:10
# Django
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0022_receiptemail'),
]
operations = [
migrations.AddField(
model_name='profile',
... | MuckRock/muckrock | muckrock/accounts/migrations/0023_profile_org_share.py | Python | agpl-3.0 | 559 |
# The code in this files is borrowed from Gedit Synctex plugin.
#
# Copyright (C) 2010 Jose Aliste
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public Licence as published by the Free Software
# Foundation; either version 2 of the Licence, or (at your... | xdega/.dotfiles | .vim/.vim/R/synctex_evince_forward.py | Python | mit | 5,473 |
from softlayer_storage import SoftLayerStorage | joshisa/django-softlayer | src/django_softlayer/__init__.py | Python | mit | 46 |
from office365.runtime.client_result import ClientResult
from office365.runtime.client_value import ClientValue
from office365.runtime.queries.service_operation_query import ServiceOperationQuery
from office365.sharepoint.base_entity import BaseEntity
from office365.sharepoint.principal.principal_source import Principa... | vgrem/Office365-REST-Python-Client | office365/sharepoint/ui/applicationpages/client_people_picker.py | Python | mit | 6,656 |
#!/usr/bin/env python
###############################################################################
##
## Big Data - Final Project
## mapper1.py
## Join fares and trips and search the zipcodes using rtree
## contact: drp354@nyu.edu
##
###############################################################################
i... | vzmehta/BigData2016 | py/mapper_zip3.py | Python | mit | 3,927 |
import base64
from suds.client import Client
class Victor(object):
def __init__(self, url, username, password):
self.client = Client(url)
self._initialize_session(username, password)
def _initialize_session(self, username, password):
""" Retrieve a session token from Victor """
... | thetoine/eruditorg | erudit/erudit/victor.py | Python | gpl-3.0 | 1,550 |
# __init__.py vi:ts=4:sw=4:expandtab:
#
# Scalable Periodic LDAP Attribute Transmogrifier
# Authors:
# Will Barton <wbb4@opendarwin.org>
# Landon Fuller <landonf@opendarwin.org>
#
# Copyright (c) 2005, 2006 Three Rings Design, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms... | threerings/splatd | splat/helpers/test/__init__.py | Python | bsd-3-clause | 1,985 |
import models
import views
import urls
__all__ = ['models', 'views', 'urls'] | hobson/pug-dj | pug/dj/miner/__init__.py | Python | mit | 78 |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... | mahabs/nitro | nssrc/com/citrix/netscaler/nitro/resource/stat/feo/feo_stats.py | Python | apache-2.0 | 11,337 |
import pandas as pd
import numpy as np
import pyaf.ForecastEngine as autof
import pyaf.Bench.TS_datasets as tsds
import logging
import logging.config
#logging.config.fileConfig('logging.conf')
logging.basicConfig(level=logging.INFO)
#get_ipython().magic('matplotlib inline')
b1 = tsds.load_ozone()
df = b1.mPastDa... | antoinecarme/pyaf | tests/neuralnet/test_ozone_rnn_only_MLP.py | Python | bsd-3-clause | 1,417 |
"""Auth models."""
from datetime import datetime, timedelta
import secrets
from typing import Dict, List, NamedTuple, Optional
import uuid
import attr
from homeassistant.util import dt as dt_util
from . import permissions as perm_mdl
from .const import GROUP_ID_ADMIN
TOKEN_TYPE_NORMAL = "normal"
TOKEN_TYPE_SYSTEM =... | postlund/home-assistant | homeassistant/auth/models.py | Python | apache-2.0 | 3,865 |
# Copyright (c) 2015 Spotify AB
#
# 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... | spotify/drserv | drserv/client.py | Python | apache-2.0 | 3,221 |
#
# Copyright 2008 The ndb 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 l... | GoogleCloudPlatform/datastore-ndb-python | ndb/stats_test.py | Python | apache-2.0 | 13,947 |
"""Support for Litter-Robot "Vacuum"."""
from __future__ import annotations
from typing import Any
from pylitterbot.enums import LitterBoxStatus
from pylitterbot.robot import VALID_WAIT_TIMES
import voluptuous as vol
from homeassistant.components.vacuum import (
STATE_CLEANING,
STATE_DOCKED,
STATE_ERROR,... | kennedyshead/home-assistant | homeassistant/components/litterrobot/vacuum.py | Python | apache-2.0 | 5,158 |
def getLocation(line):
# Get the position from the current line
if line == "":
# There is nothing left in the file
return [("", 0), True]
lineElements = line.strip().split()
otherPosition = (lineElements[0], int(lineElements[1]))
return [otherPosition, False]
def getClosestPeakSummitAndDist(positio... | imk1/IMKTFBindingCode | getClosestPeakSummitAndDist.py | Python | mit | 4,370 |
import json
import pytest
from indy import crypto, error
@pytest.mark.asyncio
async def test_pack_message_and_unpack_message_authcrypt_works(wallet_handle, identity_my1, identity_steward1,
pack_message):
# setup keys
_, sender_vk = identity_my1
... | peacekeeper/indy-sdk | wrappers/python/tests/crypto/test_unpack_message.py | Python | apache-2.0 | 2,085 |
# Copyright (c) 2010 Google 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | danakj/chromium | third_party/WebKit/Tools/Scripts/webkitpy/common/prettypatch.py | Python | bsd-3-clause | 2,809 |
"""
Copyright (c) 2012-2013 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor 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 la... | gkadillak/rockstor-core | src/rockstor/storageadmin/tests/test_oauth_app.py | Python | gpl-3.0 | 4,159 |
'''
Copyright (C) 2013 Travis DeWolf
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 program is distributed in the hope t... | studywolf/control | studywolf_control/controllers/gc.py | Python | gpl-3.0 | 2,945 |
# Copyright 2018 Capital One Services, 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... | kapilt/cloud-custodian | tools/c7n_azure/c7n_azure/resources/access_control.py | Python | apache-2.0 | 13,383 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | twalpole/selenium | py/selenium/webdriver/edge/options.py | Python | apache-2.0 | 1,794 |
from abc import ABC
import configargparse
from sklearn.externals import joblib
from termcolor import colored
class ScikitBase(ABC):
"""
Base class for AI strategies
"""
arg_parser = configargparse.get_argument_parser()
arg_parser.add('-p', '--pipeline', help='trained model/pipeline (*.pkl file)', ... | miti0/mosquito | strategies/ai/scikitbase.py | Python | gpl-3.0 | 1,418 |
import unittest, doctest, operator
import inspect
from test import test_support
from collections import namedtuple, Counter, OrderedDict
from test import mapping_tests
import pickle, cPickle, copy
from random import randrange, shuffle
import keyword
import re
import sys
from collections import Hashable, Iterable, Iter... | qenter/vlc-android | toolchains/arm/lib/python2.7/test/test_collections.py | Python | gpl-2.0 | 43,508 |
from __future__ import absolute_import
import pymongo
from bson import ObjectId
import argparse
import sys
import os
sys.path.append(os.path.abspath(".."))
from common_utils import get_object_in_collection
# def CreateJpegThumb(binary_jpeg_image, channel_threshold=245):
# TODO: Currently depends on wx, this routine s... | SlideAtlas/SlideAtlas-Server | Utils/fix_thumbs.py | Python | apache-2.0 | 2,742 |
import wikiquote
import unittest
class SearchTest(unittest.TestCase):
"""
Test wikiquote.search()
"""
def test_search(self):
for lang in wikiquote.supported_languages():
results = wikiquote.search("Matrix", lang=lang)
self.assertTrue(len(results) > 0)
def test_uns... | federicotdn/python-wikiquotes | tests/test_search.py | Python | mit | 635 |
'''
Created on Jan 15, 2011
@author: vahid
'''
import os
from setuptools import setup, find_packages
import re
# reading package version (same way sqlalchemy does)
with open(os.path.join(os.path.dirname(__file__),'khayyam', '__init__.py')) as v_file:
package_version = re.compile(r".*__version__ = '(.*?)'",re.S... | 183amir/khayyam | setup.py | Python | gpl-3.0 | 1,428 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import pytest
import six
from argon2 import PasswordHasher, Type, extract_parameters
from argon2._password_hasher import _ensure_bytes
from argon2.exceptions import InvalidHash
class TestEnsureBytes(object):
def test_is_by... | hynek/argon2_cffi | tests/test_password_hasher.py | Python | mit | 3,582 |
# (c) 2018, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
''' unit tests for Ansible module: na_ontap_vscan_scanner_pool '''
from __future__ import print_function
import json
import pytest
from units.compat import unittest
from units.compat.mock import patch... | alxgu/ansible | test/units/modules/storage/netapp/test_na_ontap_vscan_scanner_pool.py | Python | gpl-3.0 | 6,534 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright (C) 2005-2008 Francisco José Rodríguez Bogado, #
# (pacoqueen@users.sourceforge.net) #
# ... | pacoqueen/ginn | ginn/formularios/custom_widgets/__init__.py | Python | gpl-2.0 | 2,329 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Readfq(Package):
"""Readfq is a collection of routines for parsing the FASTA/FASTQ format.... | rspavel/spack | var/spack/repos/builtin/packages/readfq/package.py | Python | lgpl-2.1 | 663 |
"""
Tests the backend response generators
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
import ga4gh.backend as backend
import ga4gh.datamodel.reads as reads
import ga4gh.datamodel.variants as variants
import ga4gh.exceptions as excep... | macieksmuga/server | tests/unit/test_response_generators.py | Python | apache-2.0 | 7,668 |
# Copyright (C) 2013 Google 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | was4444/chromium.src | third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/breakpad/dump_reader_win.py | Python | bsd-3-clause | 5,533 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.