text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
# 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... | snnn/tensorflow | tensorflow/contrib/distribute/__init__.py | Python | apache-2.0 | 2,737 | 0.001827 |
# Generated by Django 1.11.15 on 2019-01-29 15:32
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('course_metadata', '0149_auto_20190201_1515'),
]
operations = [
migrations.AddField(
model_na... | edx/course-discovery | course_discovery/apps/course_metadata/migrations/0150_curriculum_program.py | Python | agpl-3.0 | 545 | 0.001835 |
#!/usr/bin/env python3
#
# Copyright 2014 Simone Campagna
#
# 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 ... | simone-campagna/rubik | rubik/application/rubik.py | Python | apache-2.0 | 37,260 | 0.004321 |
import datetime
import os
from django.conf import settings
import mock
from nose.tools import eq_, ok_
from pyquery import PyQuery as pq
import amo
import amo.tests
from amo.tests import req_factory_factory
from mkt.comm.models import CommunicationNote
from mkt.constants.applications import DEVICE_TYPES
from mkt.dev... | ngokevin/zamboni | mkt/developers/tests/test_views_versions.py | Python | bsd-3-clause | 30,543 | 0 |
"""
Copyright 2008, Red Hat, Inc
Adrian Likins <alikins@redhat.com>
also see AUTHORS
This software may be freely redistributed under the terms of the GNU
general public license.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, In... | mpdehaan/func | func/overlord/base_command.py | Python | gpl-2.0 | 1,892 | 0.006871 |
import numpy
import tables
import scipy
import matplotlib
import matplotlib.pyplot as plt
import collections
import scipy.signal
import csv
import egan_vorpalUtil as egan
import os
from mpl_toolkits.axes_grid1 import host_subplot
import mpl_toolkits.axisartist as AA
import sys
#sys.path.append('/scr_verus/wernerg/vrun/... | akegan/plasmoids | pplot.py | Python | mit | 13,037 | 0.04794 |
"""
get_links.py - get all the links
The path is NB -> TER -> NEO4J.
"""
import requests
from base64 import b64encode
url = "http://localhost:8088/api/v1/links"
headers = {
'Content-Type': 'application/json',
'Authorization': 'Basic %s' % b64encode(b"kilda:kilda").decode("ascii")
}
#
# This models one of the... | nikitamarchenko/open-kilda | services/topology-engine-rest/app/app/tests/get_links.py | Python | apache-2.0 | 694 | 0.004323 |
import json
import unittest
import billboard
class TestCurrentGreatestHot100Singles(unittest.TestCase):
"""Checks that the ChartData object for the current Greatest Hot 100
Singles chart has entries and instance variables that are valid and
reasonable. Does not test whether the data is actually correct.
... | jameswenzel/billboard-charts | tests/test_greatest_hot_100_singles.py | Python | mit | 1,451 | 0 |
from __future__ import annotations
from .. import ImmutableSequence
class Condition(ImmutableSequence):
def subsumes(self, other) -> bool:
for ci, oi in zip(self, other):
if ci != self.WILDCARD and oi != self.WILDCARD and ci != oi:
return False
return True
@prope... | ParrotPrediction/pyalcs | lcs/agents/xcs/Condition.py | Python | mit | 616 | 0 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import funct... | mdhaman/superdesk-core | apps/archive/commands.py | Python | agpl-3.0 | 19,764 | 0.004453 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Ship()
result.template = "object/ship/shared_rebel_gunboat_tier5.iff"
result.attribute_template_id = -1
result.s... | anhstudios/swganh | data/scripts/templates/object/ship/shared_rebel_gunboat_tier5.py | Python | mit | 416 | 0.050481 |
# Generated by Django 2.0.10 on 2019-05-12 17:44
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('userprofile', '0020_auto_20190507_0150'),
('news', '0019_auto_20190512_1608'),
]
operations = [
mi... | hackerspace-ntnu/website | news/migrations/0020_auto_20190512_1744.py | Python | mit | 780 | 0.002564 |
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
# Author: illuz <iilluzen[at]gmail.com>
# File: AC_simulation_n.py
# Create Date: 2015-07-30 09:41:51
# Usage: AC_simulation_n.py
# Descripton:
class Solution:
# @param {integer} n
# @return {string}
def countAndSay(self, n):
res... | bssrdf/leetcode-7 | solutions/038.Count_and_Say/AC_simulation_n.py | Python | gpl-2.0 | 737 | 0.005427 |
#!/usr/bin/env python
import pyppp
if __name__ == '__main__':
print 'PyPPP Version: %s' % pyppp.__version__
p = pyppp.PyPPP()
print 'PPP Specification Version: %s' % p.__version__
p.generate_random_sequence_key()
print 'PPP Key: %s' % p.key
passcode = 5
print 'Passcode: %d' % passcode
p... | kylef/pyppp | test.py | Python | bsd-2-clause | 362 | 0 |
from include import IncludeManager
from django.apps import apps
from django.db import models
from django.utils import timezone
from osf.models.base import BaseModel, ObjectIDMixin
from osf.utils.datetime_aware_jsonfield import DateTimeAwareJSONField
from osf.utils.fields import NonNaiveDateTimeField
from website.util ... | binoculars/osf.io | osf/models/nodelog.py | Python | apache-2.0 | 7,092 | 0.002679 |
import _plotly_utils.basevalidators
class NticksValidator(_plotly_utils.basevalidators.IntegerValidator):
def __init__(
self, plotly_name="nticks", parent_name="funnel.marker.colorbar", **kwargs
):
super(NticksValidator, self).__init__(
plotly_name=plotly_name,
parent_n... | plotly/plotly.py | packages/python/plotly/plotly/validators/funnel/marker/colorbar/_nticks.py | Python | mit | 466 | 0.002146 |
#!/usr/bin/env python
'''
access satellite map tile database
some functions are based on code from mapUtils.py in gmapcatcher
Andrew Tridgell
May 2012
released under GNU GPL v3 or later
'''
import collections
import errno
import hashlib
import sys
import math
import threading
import os
import string
import time
impo... | monkeypants/MAVProxy | MAVProxy/modules/mavproxy_map/mp_tile.py | Python | gpl-3.0 | 23,042 | 0.004427 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('mainapp', '0007_auto_20151023_1012'),
]
operations = [
migrations.AddField(
model_n... | heolin123/day_or_night | mainapp/migrations/0008_auto_20151023_1317.py | Python | gpl-2.0 | 650 | 0 |
# -*- coding: utf-8 -*-
#
# This file is part of Zenodo.
# Copyright (C) 2015 CERN.
#
# Zenodo is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later v... | tiborsimko/zenodo | zenodo/modules/deposit/config.py | Python | gpl-2.0 | 1,816 | 0 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants_test.cont... | manasapte/pants | contrib/python/tests/python/pants_test/contrib/python/checks/tasks/checkstyle/test_new_style_classes.py | Python | apache-2.0 | 1,026 | 0.004873 |
from PyQt4 import QtCore, QtGui
class Page(QtGui.QWidget):
""" A container and dropevent catcher for widgets """
def __init__(self, parent, pihud):
super(Page, self).__init__(parent)
self.setAcceptDrops(True)
self.pihud = pihud # normally, this would simply be the parent()
se... | brendan-w/piHud | pihud/Page.py | Python | lgpl-2.1 | 846 | 0.004728 |
# -*- coding: utf-8 -*-
# Natural Language Toolkit: Machine Translation
#
# Copyright (C) 2001-2017 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>, Tah Wei Hoon <hoon.tw@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
Experimental features for machine translation.
These ... | sdoran35/hate-to-hugs | venv/lib/python3.6/site-packages/nltk/translate/__init__.py | Python | mit | 913 | 0 |
# -*- coding: utf-8 -*-
"""
Raw Text Corpus manager
"""
# This code is a part of coolisf library: https://github.com/letuananh/intsem.fx
# :copyright: (c) 2014 Le Tuan Anh <tuananh.ke@gmail.com>
# :license: MIT, see LICENSE for more details.
import os
import json
from texttaglib.chirptext import FileHelper
from tex... | letuananh/intsem.fx | coolisf/dao/textcorpus.py | Python | mit | 5,974 | 0.002009 |
import io
import logging
import os
import re
log = logging.getLogger(__name__)
class file2(io.TextIOWrapper):
"""
Provides tools useful for navigating through and finding data
in the output files
"""
def __init__(self, name, mode='r', *args, **kwargs):
# super().__init__(*args, **kwargs)... | talipovm/terse | terse/Tools/file2.py | Python | mit | 5,523 | 0.00163 |
from landscape.client.tests.helpers import LandscapeTest
from landscape.client.manager.store import ManagerStore
class ManagerStoreTest(LandscapeTest):
def setUp(self):
super(ManagerStoreTest, self).setUp()
self.filename = self.makeFile()
self.store = ManagerStore(self.filename)
... | CanonicalLtd/landscape-client | landscape/client/manager/tests/test_store.py | Python | gpl-2.0 | 2,217 | 0 |
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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... | openstack/octavia | octavia/amphorae/backends/agent/api_server/amphora_info.py | Python | apache-2.0 | 7,469 | 0 |
# Copyright 2014 Objectif Libre
# Copyright 2015 DotHill Systems
#
# 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
#
# U... | CloudServer/cinder | cinder/volume/drivers/san/hp/hpmsa_client.py | Python | apache-2.0 | 931 | 0 |
from django.contrib.auth.backends import ModelBackend
from .client import remote_user_client
class WocatCMSAuthenticationBackend(ModelBackend):
"""
Authentication against new (2017) wocat website.
"""
def authenticate(self, username=None, password=None, **kwargs):
"""
Custom authentic... | CDE-UNIBE/qcat | apps/accounts/authentication.py | Python | apache-2.0 | 589 | 0 |
from sys import maxint
class BellmanFord( object ):
def __init__( self ):
'''
Constructor
'''
def singleSourceShortestPath( self, weight, source ) :
# auxiliary constants
SIZE = len( weight )
EVE = -1; # to indicate no predecessor
INFINITY = maxint
# declare and initializ... | salman-bhai/DS-Algo-Handbook | Algorithms/Graph_Algorithms/Bellman_Ford/bellman_ford.py | Python | mit | 1,400 | 0.042857 |
#!/usr/bin/env python
########################################################################
# $HeadURL$
# File : dirac-accounting-report-cli
# Author : Adria Casajus
########################################################################
"""
Command line interface to DIRAC Accounting ReportGenerator Service.
""... | Andrew-McNab-UK/DIRAC | AccountingSystem/scripts/dirac-accounting-report-cli.py | Python | gpl-3.0 | 788 | 0.013959 |
#!/usr/bin/env python
# coding=utf-8
import sys
import os
from qtpy import QtGui, QtWidgets, QtCore
from appbase.MultiWorkspaceWindow import MultiWorkspaceWindow
from appbase.Application import Application
from fancytools.os.PathStr import PathStr
from imgProcessor.reader.qImageToArray import qImageToArray
# from int... | radjkarl/dataArtist | dataArtist/gui.py | Python | gpl-3.0 | 20,228 | 0.000395 |
from oauth2_provider.settings import oauth2_settings
from oauthlib.common import generate_token
from django.http import JsonResponse
from oauth2_provider.models import AccessToken, Application, RefreshToken
from django.utils.timezone import now, timedelta
def get_token_json(access_token):
"""
Takes an AccessT... | light940929/omics_api | bio/tools.py | Python | mit | 2,096 | 0.000477 |
#!/usr/bin/python
class Solution:
# @param {string} s
# @return {boolean}
def isValid(self, s):
slist=' '.join(s).split(' ')
print slist
stack=[]
for item in slist:
if item in ('[','{','('):
stack.append(item)
else:
if len(stack)==0:
return False
elif stack[-1:][0]==self.rev(item):... | aertoria/MiscCode | stack.py | Python | apache-2.0 | 585 | 0.080342 |
# =========================================================================
# Copyright 2012-present Yunify, Inc.
# -------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this work except in compliance with the Licens... | yunify/qingcloud-sdk-python | qingcloud/iaas/actions/instance_groups.py | Python | apache-2.0 | 6,153 | 0.002438 |
import io
import os
import socket
import tempfile
import threading
import mock
import pytest
from .. import server, util
from ..ssh import protocol
def test_socket():
path = tempfile.mktemp()
with server.unix_domain_socket_server(path):
pass
assert not os.path.isfile(path)
class FakeSocket:
... | romanz/trezor-agent | libagent/tests/test_server.py | Python | lgpl-3.0 | 3,380 | 0 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^(?P<typed_letter>[a-zA-Z]+[0-9]{0,3})$', views.gethint, name='hint'),
] | superpenshine/RipMyProfessor | gethint/urls.py | Python | mit | 150 | 0.013333 |
from django.db import models
from inventory.models import Product_variant
from suppliers.models import Supplier
# Create your models here.
class Purchase_order( models.Model ):
supplier_id = models.ForeignKey(Supplier)
created_at = models.DateTimeField('date published')
class Item( models.Model ):
purchase = m... | sodhancha/Godown | purchase_orders/models.py | Python | gpl-3.0 | 480 | 0.027083 |
import logging
import os
import re
import shutil
from autotest.client.shared import error
from avocado.utils import process
from virttest import libvirt_vm
from virttest import utils_libvirtd
from virttest import virsh
from virttest import utils_conn
def do_virsh_connect(uri, options):
"""
Execute connect ... | waynesun09/tp-libvirt | libvirt/tests/src/virsh_cmd/virsh_connect.py | Python | gpl-2.0 | 8,185 | 0 |
import unittest
import json
import requests
import sys
import string
import random
import config
import core.content.errors as errors
import core.api.main as main
import core.content.content as content
import core.pricing.pricing as pricing
import core.storage as storage
from core.util.test import *
class TestPricin... | oskgeek/liftpass | tests/pricing.py | Python | apache-2.0 | 10,307 | 0.036286 |
# encoding: utf-8
__author__ = "Nils Tobias Schmidt"
__email__ = "schmidt89 at informatik.uni-marburg.de"
'''
Loader exceptions
'''
from androlyze.error.WrapperException import WrapperException
from androlyze.model.android.Constants import MANIFEST_FILENAME
from androlyze.error.AndroLyzeLabError import AndroLyzeLab... | nachtmaar/androlyze | androlyze/loader/exception/__init__.py | Python | mit | 2,440 | 0.007377 |
from . import fatturapa_common
from . import test_fatturapa_xml_validation
| OCA/l10n-italy | l10n_it_fatturapa_out_sp/tests/__init__.py | Python | agpl-3.0 | 75 | 0 |
"""Functions for Input/Output (IO) Operations.
Classes
-------
- Keys - Provide convenience for classes used as enumerated dictionary keys.
- StreamCapture - Class to capture/redirect output to stdout and stderr.
Functions
---------
- bytes_string - Return a humanized ... | lzkelley/zcode | zcode/inout/inout_core.py | Python | mit | 30,163 | 0.00315 |
"""This module contains an interface for using the GPy library in ELFI."""
# TODO: make own general GPRegression and kernel classes
import copy
import logging
import GPy
import numpy as np
logger = logging.getLogger(__name__)
logging.getLogger("GP").setLevel(logging.WARNING) # GPy library logger
class GPyRegress... | lintusj1/elfi | elfi/methods/bo/gpy_regression.py | Python | bsd-3-clause | 12,384 | 0.001534 |
# PyAlgoTrade
#
# Copyright 2011-2015 Gabriel Martin Becedillas Ruiz
#
# 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... | Yam-cn/potato | testcases/btcharts_test.py | Python | apache-2.0 | 4,240 | 0.003302 |
#!/usr/bin/env python
"""
Copyright 2012 GroupDocs.
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... | liosha2007/temporary-groupdocs-python3-sdk | groupdocs/models/SignatureFormResourcesResponse.py | Python | apache-2.0 | 1,182 | 0.007614 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) cgstudiomap <cgstudiomap@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms... | cgstudiomap/cgstudiomap | main/local_modules/res_partner_phone_missing_details/__openerp__.py | Python | agpl-3.0 | 1,443 | 0 |
# 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 | kws_streaming/models/ds_tc_resnet_test.py | Python | apache-2.0 | 3,076 | 0.002276 |
#!/usr/bin/env python3
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Copyright (c) 2015-2017 The Bitcoin Unlimited developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import test_framework.loginit
#
# Test pruning ... | BitcoinUnlimited/BitcoinUnlimited | qa/rpc-tests/pruning.py | Python | mit | 18,143 | 0.005677 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'ContentMetadata.iphone_gallery_id'
db.add_column(u'content_metadata_contentmetadata', 'iphon... | drawquest/drawquest-web | website/drawquest/apps/content_metadata/migrations/0004_auto__add_field_contentmetadata_iphone_gallery_id.py | Python | bsd-3-clause | 1,633 | 0.007961 |
# -*- coding: utf-8 -*-
"""
InformationMachineAPILib.Models.UserData
"""
from InformationMachineAPILib.APIHelper import APIHelper
class UserData(object):
"""Implementation of the 'UserData' model.
TODO: type model description here.
Attributes:
email (string): TODO: type description her... | information-machine/information-machine-api-python | InformationMachineAPILib/Models/UserData.py | Python | mit | 2,966 | 0.003034 |
from .logic import LogicAdapter
from chatterbot.conversation import Statement
from chatterbot.utils.pos_tagger import POSTagger
import re
import forecastio
class WeatherLogicAdapter(LogicAdapter):
"""
A logic adapter that returns information regarding the weather and
the forecast for a specific location.... | imminent-tuba/thesis | server/chatterbot/chatterbot/adapters/logic/weather.py | Python | mit | 2,362 | 0.000847 |
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
# SECURITY WARNING: keep th... | abogushov/django-admin-json-editor | example/project/settings.py | Python | mit | 2,826 | 0.001415 |
from django.db import models
# Create your models here.
class Task(models.Model):
created_date = models.DateTimeField(auto_now_add=True)
due_date = models.DateField(null=True, blank=True)
description = models.CharField(max_length=100)
completed = models.BooleanField(default=False)
archived = mode... | criloz/todo-app | todoapp/models.py | Python | mit | 350 | 0.002857 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of AudioLazy, the signal processing Python package.
# Copyright (C) 2012-2014 Danilo de Jesus da Silva Bellini
#
# AudioLazy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# ... | antiface/audiolazy | examples/dft_pitch.py | Python | gpl-3.0 | 3,525 | 0.013333 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2018, Will Thames <@willthames>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | azaghal/ansible | test/support/integration/plugins/modules/k8s_info.py | Python | gpl-3.0 | 5,086 | 0.002359 |
#!/usr/bin/env python
from __future__ import division
from __future__ import print_function
print('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++')
print('+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++... | meteoswiss-mdr/precipattractor | pyscripts/maple_machine-learning_predict-maps.py | Python | gpl-3.0 | 13,253 | 0.009658 |
class Item(object):
def __init__(self, name, description, location):
self.name = name
self.description = description
self.location = location
location.here.append(self)
actions = ['look']
def look(self, player, noun):
""" Looking at the object """
... | AnthonyBriggs/Python-101 | hello_python_source_py3/chapter 06/3/item.py | Python | mit | 357 | 0.011204 |
# -*- coding: utf-8 -*-
from utils import log, register
from plexapi import CONFIG
# TODO: test_navigation/test_navigate_to_movie
# FAIL: (500) internal_server_error
# @register()
def test_navigate_to_movie(account, plex):
result_library = plex.library.get(CONFIG.movie_title)
result_movies = plex.library.sect... | Hellowlol/plexapi | tests/test_navigation.py | Python | bsd-3-clause | 3,622 | 0.004694 |
from __future__ import print_function
import csv
import timeit
import datetime
import plugin_interface as plugintypes
class PluginCSVCollect(plugintypes.IPluginExtended):
def __init__(self, file_name="collect.csv", delim=",", verbose=False):
now = datetime.datetime.now()
self.time_stamp = '%d-%d-... | OpenBCI/OpenBCI_Python | openbci/plugins/csv_collect.py | Python | mit | 1,932 | 0.000518 |
#
# Copyright 2014 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
import time
from gnuradio import gr_unittest, blocks, gr, analog
from gnuradio.gr.hier_block2 import _multiple_endpoints, _optional_endpoints
import pmt
class test_hblk(gr.hier_bloc... | jdemel/gnuradio | gnuradio-runtime/python/gnuradio/gr/qa_hier_block2.py | Python | gpl-3.0 | 4,084 | 0.006856 |
# -*- coding: utf-8 -*-
"""
Created on Wed May 18 18:22:12 2016
@author: ajaver
"""
import os
import cv2
import tables
import numpy as np
from tierpsy.helper.params import read_fps
from tierpsy.helper.misc import TimeCounter, print_flush
def getSubSampleVidName(masked_image_file):
#used by AnalysisPoints.py an... | ver228/tierpsy-tracker | tierpsy/analysis/vid_subsample/createSampleVideo.py | Python | mit | 4,145 | 0.015923 |
from django.core.urlresolvers import reverse
from django.shortcuts import redirect
from django.conf import settings
from mc2.controllers.base.views import ControllerCreateView, ControllerEditView
from mc2.views import HomepageView
from mc2.organizations.models import Organization
from mc2.organizations.utils import ac... | praekeltfoundation/mc2-freebasics | freebasics/views.py | Python | bsd-2-clause | 2,964 | 0 |
# 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 writing, so... | SVilgelm/CloudFerry | cloudferry/condensation/utils.py | Python | apache-2.0 | 1,549 | 0 |
from __future__ import unicode_literals
from .. import Provider as PhoneNumberProvider
class Provider(PhoneNumberProvider):
formats = (
'(351) 91# ### ###',
'(351) 92# ### ###',
'(351) 93# ### ###',
'(351) 96# ### ###',
'(351) 2## ### ###',
'(351) 91#######',
... | deanishe/alfred-fakeum | src/libs/faker/providers/phone_number/pt_PT/__init__.py | Python | mit | 1,053 | 0 |
import f90nml
# Adapted from the original core.nml and phys.nml files included in 2006 codebase.
# where the value is the same as the default in the code base, it is commented out
# and therefore not included in the namelist.
# Where the value is different, the code default is shown in an inline comment
basic = f90n... | Alexander-P/Isca | exp/python_gfdl/namelists.py | Python | gpl-3.0 | 6,032 | 0.008289 |
import numpy as np
import torch
import hyperchamber as hc
import inspect
from torch.autograd import Variable
from hypergan.trainers.alternating_trainer import AlternatingTrainer
class AccumulateGradientTrainer(AlternatingTrainer):
""" G gradients accumulate over many D steps """
def _create(self):
sel... | 255BITS/HyperGAN | hypergan/trainers/accumulate_gradient_trainer.py | Python | mit | 3,338 | 0.003895 |
"""The fail2ban component."""
| aronsky/home-assistant | homeassistant/components/fail2ban/__init__.py | Python | apache-2.0 | 30 | 0 |
from subprocess import Popen, PIPE
def is_class(file):
return file.endswith(".class") and not file.startswith("META-INF")
def modified_paths(patch):
p = Popen(["jar", "-tf", patch], stdout=PIPE)
output, _ = p.communicate()
return filter(is_class, [file.decode() for file in output.split(b"\n")])
def ... | alepulver/changesets | patch_analyzer/patch_utils.py | Python | mit | 562 | 0.007117 |
from rest_framework import generics
from rest_framework.views import APIView
from django.views.generic.base import TemplateView
from rest_framework.renderers import JSONRenderer
from rest_framework.parsers import JSONParser
from rest_framework.response import Response
from rest_framework.authentication import SessionA... | trcm/stew | stew/views.py | Python | mit | 9,961 | 0.002711 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
"""
this migration will be used to add 2 field to deal with
things that will go wrong that will then trigger
mail to admin and author of the trig... | foxmask/django-th | th_twitter/migrations/0003_fav.py | Python | bsd-3-clause | 581 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from distutils.core import setup
setup(
name='django-timecode',
version='0.1.4',
description='Provides classes for working with timecodes (as used in the video industry).',
long_description=open('README.md').read(),
author='Joe Rickerby',
author_ema... | joerick/django-timecode | setup.py | Python | bsd-3-clause | 546 | 0.001832 |
"""
Create SQL statements for QuerySets.
The code in here encapsulates all of the SQL construction so that QuerySets
themselves do not have to (and could be backed by things other than SQL
databases). The abstraction barrier only works one way: this module has to know
all about the internals of models in order to get ... | gannetson/django | django/db/models/sql/query.py | Python | bsd-3-clause | 92,461 | 0.000908 |
#!/usr/bin/python3
import math
import random
def finding_prime(number):
num=abs(number)
if num<4: return True
for x in range(2,num):
if num%x == 0:
return False
return True
def finding_prime_sqrt(number):
num=abs(number)
if num<4: return True
for x in range(2,int(math.sqrt(num))+1):
if number%x == 0:
... | Urinx/SomeCodes | Python/others/practice/finding_if_prime.py | Python | gpl-2.0 | 995 | 0.074372 |
"""Spaces
An authentication space is a directory of resources with a defined set
of acceptable authentication realms, security provisions, and
algorithms.
"""
__copyright__ = "Copyright (C) 2014 Ivan D Vasin"
__docformat__ = "restructuredtext"
import re as _re
from spruce.collections import odict as _odict, uset a... | nisavid/bedframe | bedframe/auth/_spaces.py | Python | lgpl-3.0 | 4,671 | 0.000856 |
#
# gPrime - A web-based genealogy program
#
# Copyright (C) 2007-2008 Brian G. Matherly
# Copyright (C) 2008 Gary Burton
#
# 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 ... | sam-m888/gprime | gprime/plug/menu/_note.py | Python | gpl-2.0 | 1,763 | 0.002836 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "projects_morelab.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| OscarPDR/projects_morelab | manage.py | Python | gpl-3.0 | 259 | 0.003861 |
from django.conf.urls import patterns, include, url
from django.utils.translation import ugettext_lazy as _
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.views.ge... | praekelt/jmbo-foundry | foundry/urls.py | Python | bsd-3-clause | 12,605 | 0.001428 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
#
# 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
#... | traveloka/ansible | lib/ansible/modules/cloud/ovirt/ovirt_storage_domains.py | Python | gpl-3.0 | 17,259 | 0.001159 |
# coding=utf-8
# Copyright 2022 The TensorFlow Datasets 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 appl... | tensorflow/datasets | tensorflow_datasets/text/openbookqa.py | Python | apache-2.0 | 4,817 | 0.002076 |
def generate_concept_HTML(concept_title, concept_description):
html_text_1 = '''
<div class="concept">
<div class="concept-title">
''' + concept_title
html_text_2 = '''
</div>
<div class="concept-description">
''' + concept_description
html_text_3 = '''
</div>
</di... | DWilburn/automate-your-page | html_generator.py | Python | mit | 2,544 | 0.00511 |
# coding: iso-8859-1 -*-
"""
Created on Wed Oct 22 21:49:24 2014
@author: fábioandrews
"""
import facebook
from DadosDeAmigoEmComum import DadosDeAmigoEmComum
class AfinidadeLikesEscolaELocalidades:
def __init__(self,ACCESS_TOKEN_FACEBOOK):
self.token_do_facebook = ACCESS_TOKEN_FACEBOOK
self.meus... | Topicos-3-2014/friendlyadvice | AfinidadeLikesEscolaELocalidades.py | Python | epl-1.0 | 12,463 | 0.012116 |
'''
Python class on writing reusable code
'''
def func1():
'''Simple test function'''
print "Hello world"
class MyClass(object):
'''Simple test class'''
def __init__(self, var1, var2, var3):
self.var1 = var1
self.var2 = var2
self.var3 = var3
def hello(self):
'''Simp... | nonemaw/pynet | pyth_ans_ecourse/class9/exercise6/mytest/world.py | Python | gpl-2.0 | 1,292 | 0.00387 |
"""The tests for the MQTT automation."""
import unittest
import homeassistant.components.automation as automation
from tests.common import (
mock_mqtt_component, fire_mqtt_message, get_test_home_assistant)
class TestAutomationMQTT(unittest.TestCase):
"""Test the event automation."""
def setUp(self): # ... | justyns/home-assistant | tests/components/automation/test_mqtt.py | Python | mit | 2,684 | 0 |
from __future__ import division
import collect_ncs_files
from libtbx.command_line import easy_qsub
from glob import glob
import sys
import os
class run_queue_tests(object):
def __init__(self):
"""
Testing using: /work/NCS/ncs_paper/collect_ncs_files.py
"""
# set working environment
paths = "/ne... | youdar/work | work/NCS/ncs_paper/submit_model_vs_data_to_queue.py | Python | mit | 4,061 | 0.006156 |
#
# Solution to Project Euler problem 425
# Philippe Legault
#
# https://github.com/Bathlamos/Project-Euler-Solutions
from lib import primes_up_to
import heapq
# Use Dijkstra's algorithm to identify
# the path with smallest maximum number,
# based on the undirected graph of connected
# primes
def compute():
limit... | Bathlamos/Project-Euler-Solutions | solutions/p425.py | Python | mit | 1,249 | 0.030424 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License, Ver... | sparkslabs/kamaelia | Sketches/MPS/BugReports/FixTests/Kamaelia/Kamaelia/Apps/Europython09/BB/LineOrientedInputBuffer.py | Python | apache-2.0 | 2,466 | 0.005272 |
# -*- coding: utf-8 -*-
# © 2016 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import hr_employee
| VitalPet/hr | hr_employee_reference/models/__init__.py | Python | agpl-3.0 | 152 | 0 |
# Copyright 2015 Internap.
#
# 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, so... | internap/netman | netman/api/objects/vlan.py | Python | apache-2.0 | 2,413 | 0.000829 |
"""Emission python module
This module is for everyone who wants to build tools / systems for calculating vehicle
emissions for various types of vehicles (Trucks, Buses, Cars, Vans, scooters, ..).
The calculation and factors is provided by the EU EEA guidebook: http://www.eea.europa.eu/publications/emep-eea-guidebook-... | NPRA/EmissionCalculatorLib | emission/__init__.py | Python | bsd-2-clause | 1,488 | 0.014113 |
import pygame
from pygame.locals import *
import glob
# specify the image names and how many slices they have
# None for a icon
# ([1...3],[1...3]) for the number of slices an image is cut into.
IMAGES = {
'box.png': (2, 2),
'check.png':
'color.png':None,
'desktop.png': None,
'dot.p... | TurBoss/HostilPlanet | data/themes/itheme/build.py | Python | gpl-2.0 | 4,710 | 0.002335 |
from __future__ import print_function
from __future__ import division
import numpy as np
np.set_printoptions(threshold=np.inf)
import matplotlib.pyplot as plt
from matplotlib import cm
# from mpl_toolkits.mplot3d import axes3d
from matplotlib.colors import LogNorm
# import time
import math
# import cPickle
import gym... | febert/DeepRL | q_learning_sarsa/dqn_learning.py | Python | gpl-3.0 | 22,540 | 0.00661 |
import numpy
from chainer import configuration
from chainer import functions
from chainer import link
from chainer.utils import argument
class DecorrelatedBatchNormalization(link.Link):
"""Decorrelated batch normalization layer.
This link wraps the
:func:`~chainer.functions.decorrelated_batch_normaliza... | tkerola/chainer | chainer/links/normalization/decorrelated_batch_normalization.py | Python | mit | 5,209 | 0 |
#!/usr/bin/env python
# coding: utf-8
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__))))
from youtube_dl.compat import (
compat_getenv,
compat_setenv,
compat_etree_fromstrin... | fluxw42/youtube-dl | test/test_compat.py | Python | unlicense | 5,492 | 0.004066 |
"""Generate JSON files with dbnames per project
Just generates for wikipedias for now"""
from urllib2 import urlopen
import unicodecsv as csv
import json
def get_dbnames(wiki_class):
"""Return dbnames for all wikis in a particular wiki_class, such as 'wikipedias'"""
URL = "https://wikistats.wmflabs.org/api.p... | yuvipanda/edit-stats | dmz/generate_dbnames.py | Python | mit | 821 | 0.004872 |
import sys
import xbmc,xbmcaddon
import sqlite3
ADDON = xbmcaddon.Addon(id='script.tvguide.Vader')
channel = sys.argv[1]
start = sys.argv[2]
if ADDON.getSetting('playing.channel') != channel:
quit()
elif ADDON.getSetting('playing.start') != start:
quit()
ADDON.setSetting('playing.channel','')
ADDON.setSettin... | ledtvavs/repository.ledtv | script.tvguide.Vader/stop.py | Python | gpl-3.0 | 386 | 0.010363 |
"""
Instructor Tasks related to module state.
"""
import json
import logging
from time import time
from django.contrib.auth.models import User
from opaque_keys.edx.keys import UsageKey
from xblock.runtime import KvsFieldData
import dogstats_wrapper as dog_stats_api
from capa.responsetypes import LoncapaProblemError, ... | miptliot/edx-platform | lms/djangoapps/instructor_task/tasks_helper/module_state.py | Python | agpl-3.0 | 15,346 | 0.00417 |
# -*- coding: utf-8 -*-
#############################################################################
# File : ConfigCheck.py
# Package : rpmlint
# Author : Frederic Lepied
# Created on : Sun Oct 3 21:48:20 1999
# Purpose :
################################################################... | aborrero/pkg-rpmlint | ConfigCheck.py | Python | gpl-2.0 | 1,798 | 0.003893 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
import time
from os import listdir
from os.path import join
from Queue import Queue, Empty
from select import select
from threading import Thread, Lock
from odoo import http
import odoo.addons.hw_proxy.c... | chienlieu2017/it_management | odoo/addons/hw_scanner/controllers/main.py | Python | gpl-3.0 | 8,110 | 0.018989 |
#!/usr/bin/env python
# encoding: utf-8
"""
utils.py
Created by Elliot Kroo on 2009-12-25.
Copyright (c) 2009 Elliot Kroo. All rights reserved.
"""
import sys
import os
def toDict(tuples):
resultsDict = {}
for field, value in tuples:
if len(field) > 0 and field[0] != "-":
resultsDict[field] = value
... | robwebset/script.ebooks | resources/lib/mobi/utils.py | Python | gpl-2.0 | 340 | 0.014706 |
__author__ = "Rick Sherman"
import unittest2 as unittest
from nose.plugins.attrib import attr
from jnpr.junos.device import Device
from jnpr.junos.decorators import timeoutDecorator
from mock import patch, PropertyMock, call
from ncclient.manager import Manager, make_device_handler
from ncclient.transport import SS... | JamesNickerson/py-junos-eznc | tests/unit/test_decorators.py | Python | apache-2.0 | 1,937 | 0.001549 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.