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 |
|---|---|---|---|---|---|---|
# Standard modules
import os
import socket
import subprocess
import threading
# XBMC modules
import xbmc
import xbmcaddon
import xbmcgui
class OSMC_Communicator(threading.Thread):
''' Class to setup and manage the socket to allow communications between OSMC settings modules and external scripts.
For example, this... | srmo/osmc | package/mediacenter-addon-osmc/src/script.module.osmccommon/resources/lib/osmc_comms.py | Python | gpl-2.0 | 3,448 | 0.032193 |
"""
Functions for calculating LOFAR hardware specific properties.
"""
import tkp.telescope.lofar.antennaarrays
import tkp.telescope.lofar.beam
import tkp.telescope.lofar.noise
import tkp.telescope.lofar.quality
| bartscheers/tkp | tkp/telescope/lofar/__init__.py | Python | bsd-2-clause | 211 | 0 |
#! /usr/bin/python
# Basic Matrix factorization
import numpy as np
class bmf():
def __init__(self, k = 100, rounds = 50, alpha = 0.005, beta = 0.02, train_fn = '', validate_fn = '', pred_fn = '', output = ''):
self.k = k
self.rounds = rounds
self.alpha = alpha
self.beta = beta
self.train_fn = train_f... | xunzhang/roraima | tools/mf.py | Python | apache-2.0 | 3,744 | 0.044605 |
import re
import string
import nltk
from bs4 import BeautifulSoup
__author__ = 'nolram'
class NewsItem:
def __init__(self, news, stop_words):
self.all_words = []
self.stop_words = stop_words
self.regex = re.compile('[%s]' % re.escape(string.punctuation))
if "titulo" in news and... | nolram/news_crawler | classificador/news_item.py | Python | mit | 3,574 | 0.001399 |
import itertools
from django.core.management.base import BaseCommand
from django.db import models, connection
qn = connection.ops.quote_name
def fix(table_name, field):
d = {'table': table_name, 'field': qn(field.column), 'sql': sql(field)}
update = "UPDATE {table} SET {field}='' WHERE {field} IS NULL".form... | jpetto/olympia | src/olympia/amo/management/commands/fix_charfields.py | Python | bsd-3-clause | 1,744 | 0 |
# -*- coding: utf-8 -*-
#
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
from common.fields import StringManyToManyField
from common.serializers import AdaptedBulkListSerializer
from orgs.mixins.serializers import BulkOrgResourceModelSerializer
from ..models import User... | sdgdsffdsfff/jumpserver | apps/users/serializers/group.py | Python | gpl-2.0 | 2,119 | 0.000944 |
# Configuration file example for L1L2Signature
# version: '0.2.2'
import l1l2py
#~~ Data Input/Output ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Data assumed csv with samples and features labels
# * All the path are w.r.t. config file path
data_matrix = 'data/gedm.csv'
labels = 'data/labels.csv'
de... | slipguru/l1l2py | cuda/32bit/config.py | Python | gpl-3.0 | 1,967 | 0.006609 |
#! /usr/bin/env python
# (Force the script to use the latest build.)
#
# test_parser.py
import parser, traceback
_numFailed = 0
def testChunk(t, fileName):
global _numFailed
print '----', fileName,
try:
ast = parser.suite(t)
tup = parser.ast2tuple(ast)
# this discards the first ... | xbmc/xbmc-antiquated | xbmc/lib/libPython/Python/Demo/parser/test_parser.py | Python | gpl-2.0 | 1,193 | 0.004191 |
# View more python learning tutorial on my Youtube and Youku channel!!!
# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
# Youku video tutorial: http://i.youku.com/pythontutorial
"""
Please note, this code is only for python 3+. If you are using python 2+, please modify the code acco... | MediffRobotics/DeepRobotics | DeepLearnMaterials/tutorials/tensorflowTUT/tf12_plot_result/full_code.py | Python | gpl-3.0 | 2,272 | 0.004401 |
# Copyright 2016 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... | hfp/tensorflow-xsmm | tensorflow/python/keras/losses_test.py | Python | apache-2.0 | 48,998 | 0.002694 |
#-----------------------------------------------------------------------------
# Copyright (c) 2008-2012, David P. D. Moss. All rights reserved.
#
# Released under the BSD license. See the LICENSE file for details.
#-----------------------------------------------------------------------------
import netaddr
name ... | ashmastaflash/gwdetect | dependencies/netaddr-0.7.10/release.py | Python | mit | 5,263 | 0.00076 |
# -*- coding: utf-8 -*-
"""build_manpage command -- Generate man page from setup()"""
import datetime
from distutils.command.build import build
from distutils.core import Command
from distutils.errors import DistutilsOptionError
import optparse
class build_manpage(Command):
description = 'Generate man page fro... | andialbrecht/crunchyfrog | utils/command/build_manpage.py | Python | gpl-3.0 | 4,464 | 0.000224 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
from test_sms import TestSms
def all(handler):
env = environment.get(InProcessTestEnvironment)
suite = unittest... | andreastt/certtest | semiauto/tests/__init__.py | Python | mpl-2.0 | 411 | 0.002433 |
# (c) 2015, Jon Hadfield <jon@lessknown.co.uk>
"""
Description: This lookup takes an AWS region and an RDS instance
name and returns the endpoint port.
Example Usage:
{{ lookup('aws_rds_endpoint_port_from_instance_name', ('eu-west-1', 'mydb')) }}
"""
from __future__ import (absolute_import, division, print_function)
_... | jonhadfield/ansible-lookups | aws_rds_endpoint_port_from_instance_name.py | Python | mit | 1,218 | 0.004926 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from OpenSSL import crypto
from .base import BaseNetworkServiceScanModel
from ..types import *
from ..mixin import DomainNameMixin, S3Mixin
from lib import ConversionHelper
class SslSupportModel(BaseNetworkServiceScanModel):
"""
This is an Elast... | lavalamp-/ws-backend-community | wselasticsearch/models/services/ssl.py | Python | gpl-3.0 | 34,499 | 0.002058 |
import django.dispatch
signal_fetch_latest_metadata = django.dispatch.Signal()
| audreyr/opencomparison | package/signals.py | Python | mit | 82 | 0.012195 |
# Copyright (c) 2011 OpenStack, LLC
# Copyright (c) 2015 Rushil Chugh
# Copyright (c) 2015 Clinton Knight
# 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
#
# ... | bswartz/manila | manila/tests/scheduler/test_host_manager.py | Python | apache-2.0 | 43,579 | 0 |
#!/usr/bin/env python
import time, logging, argparse, json, sys
from es_manager import ElasticsearchSnapshotManager, get_parser
from elasticsearch import exceptions
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger('elasticsearch')
def take_snapshot(options):
esm = ElasticsearchSnapshotManager(o... | DomainGroupOSS/elasticsearch-snapshots | es_backup.py | Python | mit | 1,826 | 0.005476 |
# Copyright (c) 2007, Robert Coup <robert.coup@onetrackmind.co.nz>
# 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,
#... | Vvucinic/Wander | venv_2_7/lib/python2.7/site-packages/Django-1.9-py2.7.egg/django/contrib/gis/measure.py | Python | artistic-2.0 | 12,272 | 0.002445 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | larroy/mxnet | tests/python/gpu/test_gluon_transforms.py | Python | apache-2.0 | 4,081 | 0.003921 |
import json
import io
from lxml import html
from django.test import TestCase, tag
from celery_djangotest.unit import TransactionTestCase
from dashboard.tests.factories import (
DataGroupFactory,
DataDocumentFactory,
ExtractedHPDocFactory,
)
from dashboard.tests.loader import load_model_objects, fixtures_... | HumanExposure/factotum | dashboard/tests/functional/test_datagroup_detail.py | Python | gpl-3.0 | 22,500 | 0.001244 |
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 22 12:07:53 2014
@author: Gouthaman Balaraman
"""
import requests
import pandas as pd
from bs4 import BeautifulSoup
import re
import numpy as np
import os
#####################################################
# A bunch of constants used throught the script. #
########... | gouthambs/OpenData | src/longbeach_crime_stats.py | Python | mit | 10,310 | 0.022599 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/yeison/Documentos/python/developing/pinguino/pinguino-ide/qtgui/gide/bloques/widgets/control_slider.ui'
#
# Created: Wed Mar 4 01:39:58 2015
# by: pyside-uic 0.2.15 running on PySide 1.2.2
#
# WARNING! All changes made in this fi... | emmanuelol/pinguino-ide | qtgui/gide/bloques/widgets/control_slider.py | Python | gpl-2.0 | 2,130 | 0.001878 |
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
import collections
import datetime
import json
from decimal import Decimal
import elasticsearch
import pytest
import pytablewriter as ptw
from .._common import print_test_result
from ..data import headers, value_matrix
inf = Decimal("Infinity... | thombashi/pytablewriter | test/writer/test_elasticsearch_writer.py | Python | mit | 6,308 | 0.001268 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from smartcard.CardMonitoring import CardObserver, CardMonitor
from smartcard.System import readers
import smartcard
from types import MethodType
from datetime import datetime
MAP_MOIS = {
"JANV" : "01",
"JAN" : "01",
"FEVR" : "02",
"FEV" : "02",
"M... | Lapin-Blanc/pythonbeid | beid.py | Python | gpl-3.0 | 5,421 | 0.011621 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.... | samsu/neutron | openstack/common/policy.py | Python | apache-2.0 | 21,618 | 0 |
# Yith Library Server is a password storage server.
# Copyright (C) 2012-2013 Yaco Sistemas
# Copyright (C) 2012-2013 Alejandro Blanco Escudero <alejandro.b.e@gmail.com>
# Copyright (C) 2012-2013 Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com>
#
# This file is part of Yith Library Server.
#
# Yith Library Server is... | lorenzogil/yith-library-server | yithlibraryserver/user/__init__.py | Python | agpl-3.0 | 2,517 | 0.000397 |
import collections
import random
# Set the random seed so we see the same output each time
# the script is run.
random.seed(1)
d1 = collections.deque(maxlen=3)
d2 = collections.deque(maxlen=3)
for i in range(5):
n = random.randint(0, 100)
print('n =', n)
d1.append(n)
d2.appendleft(n)
print('D1... | jasonwee/asus-rt-n14uhp-mrtg | src/lesson_data_structures/collections_deque_maxlen.py | Python | apache-2.0 | 349 | 0 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Daniel Reis, 2013
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, eith... | vrenaville/project-service | project_issue_baseuser/__openerp__.py | Python | agpl-3.0 | 1,603 | 0 |
from random import randint
board = []
for x in range(5):
board.append(["O"] * 5)
def print_board(board):
for row in board:
print " ".join(row)
print "Let's play Battleship!"
print_board(board)
def random_row(board):
return randint(0, len(board) - 1)
def random_col(board):
return randint(0,... | oliverwreath/Wide-Range-of-Webs | Python/Battleship/15. Guess 4 turns.py | Python | agpl-3.0 | 1,187 | 0.005897 |
"""
Zappa Async Tasks
Example:
```
from zappa.async import task
@task(service='sns')
def my_async_func(*args, **kwargs):
dosomething()
```
For SNS, you can also pass an `arn` argument to task() which will specify which SNS path to send it to.
Without `service='sns'`, the default service is 'lambda' which will c... | juanantoniofm12/toonai | Zappa/zappa/async.py | Python | mit | 11,154 | 0.00251 |
#!/usr/bin/env python3
"""Convert FASTA to PHYLIP"""
import sys
from Bio import SeqIO
print("Convert FASTA to PHYLIP")
infile = sys.argv[1]
outfile = sys.argv[2]
sequence_list = [] # To keep order of sequence
sequence_dict = {}
for record in SeqIO.parse(open(infile, "rU"), "fasta"):
tab = record.id.split(" "... | romainstuder/evosite3d | convert_fasta2phylip.py | Python | gpl-3.0 | 1,829 | 0.001093 |
from __future__ import with_statement
import logging
import warnings
import django
from django.conf import settings
from django.conf.urls.defaults import patterns, url
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned, ValidationError
from django.core.urlresolvers import NoReverseMatch, rev... | VishvajitP/django-tastypie | tastypie/resources.py | Python | bsd-3-clause | 84,667 | 0.001937 |
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
from nose.tools import * # noqa
from tests.base import OsfTestCase
from tests.factories import RegistrationFactory
from tests.factories import UserFactory
from scripts.approve_registrations import main
class TestApproveRegistrations(OsfTestCase):
... | ckc6cz/osf.io | scripts/tests/test_approve_registrations.py | Python | apache-2.0 | 3,410 | 0.002053 |
import os
import re
from collections import Callable
missing = object()
class cached_property(object):
def __init__(self, func):
self.func = func
self.__name__ = func.__name__
self.__doc__ = func.__doc__
self.__module__ = func.__module__
def __get__(self, obj, type=None):
... | gears/gears | gears/utils.py | Python | isc | 1,323 | 0 |
from quex.engine.generator.languages.address import Address
from quex.blackboard import E_EngineTypes, E_AcceptanceIDs, E_StateIndices, \
E_TransitionN, E_PostContextIDs, E_PreContextIDs, \
... | coderjames/pascal | quex-0.63.1/quex/engine/generator/state/drop_out.py | Python | bsd-2-clause | 4,373 | 0.011891 |
import time
import plugins
import hangups
def _initialise(bot):
plugins.register_handler(on_hangout_call, type="call")
def on_hangout_call(bot, event, command):
if event.conv_event._event.hangout_event.event_type == hangups.schemas.ClientHangoutEventType.END_HANGOUT:
lastcall = bot.conversation_me... | ravrahn/HangoutsBot | hangupsbot/plugins/humor_hangoutcalls.py | Python | gpl-3.0 | 1,755 | 0.006838 |
#!/usr/bin/env python
"""
The scripts that compose this module contains a set of functions
needed to process properly a background subtraction of each camera
of a dataset
"""
import cbackground
import cv2
import numpy as np
import sys
from gui import trackbar
from threedgeometry import frameretriever
| lacatus/TFM | bgsubtraction/__init__.py | Python | apache-2.0 | 305 | 0 |
#!/usr/bin/env python
"""
Undistort image.
(C) 2016-2018 1024jp
"""
import math
import os
import sys
import cv2
import numpy as np
from modules import argsparser
from modules.datafile import Data
from modules.undistortion import Undistorter
from modules.projection import Projector
# constants
SUFFIX = "_calib"
c... | 1024jp/LensCalibrator | createimage.py | Python | mit | 6,006 | 0.000167 |
from __future__ import unicode_literals
from django.db import models
class Attendance(models.Model):
pass
| cloudartisan/dojomaster | apps/attendance/models.py | Python | mit | 113 | 0 |
#1/usr/bin/env python3
import setuptools
setuptools.setup(
name = 'rheedsim',
version = '0.1.0',
packages = ['rheedsim'],
entry_points = {
'console_scripts':[
'rheedsim = rheedsim.__main__:main'
]
},
)
| chanjr/rheedsim | src/setup.py | Python | mit | 305 | 0.036066 |
from ..braille import from_unicode
def _render(width, height, text):
# text must already be i18n-ed to Unicode.
data = []
lines = tuple(from_unicode(l) for l in text.split('\n'))
for line in lines:
data.append(line)
# pad page with empty rows
while len(data) % height:
data.a... | Bristol-Braille/canute-ui | ui/book/help.py | Python | gpl-3.0 | 2,528 | 0.000396 |
import datetime
from django.core.management.base import NoArgsCommand
from django.conf import settings as django_settings
from askbot import models
from askbot import const
from askbot.conf import settings as askbot_settings
from django.utils.translation import ugettext as _
from django.utils.translation import ungette... | tvenkat/askbot-devel | askbot/management/commands/send_accept_answer_reminders.py | Python | gpl-3.0 | 3,704 | 0.011609 |
import sys
import os
import io
from pkg_resources import parse_version
import wx
if parse_version(wx.__version__) < parse_version('2.9'):
tmpApp = wx.PySimpleApp()
else:
tmpApp = wx.App(False)
from psychopy import experiment
from psychopy.experiment.components import getAllComponents
# usage: generate or com... | psychopy/psychopy | psychopy/tests/test_experiment/needs_wx/genComponsTemplate.py | Python | gpl-3.0 | 4,702 | 0.001489 |
# -*- coding: utf-8 -*-
"""
handler base
~~~~~~~~~~~~
Presents a reasonable base class for a ``Handler`` object, which handles
responding to an arbitrary "request" for action. For example, ``Handler``
is useful for responding to HTTP requests *or* noncyclical realtime-style
requests, and acts as a base c... | momentum/canteen | canteen/base/handler.py | Python | mit | 17,022 | 0.004935 |
# -*- coding: utf-8 -*-
import logging
if __name__ == '__main__':
logging.basicConfig()
_log = logging.getLogger(__name__)
import pyxb.binding.generate
import pyxb.utils.domutils
from xml.dom import Node
import os.path
xsd='''<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLS... | CantemoInternal/pyxb | tests/trac/test-trac-0116.py | Python | apache-2.0 | 834 | 0.013189 |
#!/usr/bin/env python
from distutils.core import setup
version='1.0.1'
setup(
name='funny-codes',
version=version,
author='Mikhail Korobov',
author_email='kmike84@gmail.com',
packages=['funny_codes'],
url='https://bitbucket.org/kmike/funny-codes/',
license = 'MIT license',
descriptio... | kmike/funny-codes | setup.py | Python | mit | 712 | 0.009831 |
import json
from google.appengine.api import users
from raceways.handler import BaseHandler, using_template
from stravalib import unithelper
class HomepageHandler(BaseHandler):
@using_template('test.html')
def get(self):
# basic user login
strava_auth_uri = None
if self.user:
... | alecf/strava-raceways | raceways/handlers/homepage.py | Python | mit | 1,439 | 0.000695 |
import autocomplete_light
from association.models import Word
from django.utils.translation import ugettext as _
class WordAutocomplete(autocomplete_light.AutocompleteModelBase):
search_fields=['name']
choice_html_format = '<span class="block os" data-value="%s">%s (%s)</span>'
attrs={
'placeholde... | Tima-Is-My-Association/TIMA | association/autocomplete_light_registry.py | Python | lgpl-3.0 | 694 | 0.010086 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | GoogleCloudPlatform/gsutil | gslib/tests/test_wrapped_credentials.py | Python | apache-2.0 | 4,593 | 0.003048 |
n = int(raw_input('Ingrese n: '))
es_primo = True
d = 2
while d < n:
if n % d == 0:
es_primo = False
d = d + 1
if es_primo:
print(n, 'es primo')
else:
print(n, 'es compuesto')
| sebastiandres/iwi131 | ipynb/06-Funciones/iwi131_code/es_primo_v1.py | Python | cc0-1.0 | 200 | 0 |
"""Test zha sensor."""
from unittest import mock
import pytest
import zigpy.zcl.clusters.general as general
import zigpy.zcl.clusters.homeautomation as homeautomation
import zigpy.zcl.clusters.measurement as measurement
import zigpy.zcl.clusters.smartenergy as smartenergy
from homeassistant.components.sensor import D... | titilambert/home-assistant | tests/components/zha/test_sensor.py | Python | apache-2.0 | 10,606 | 0.001037 |
from settings import *
import sys
from os.path import abspath, dirname, join
MEDIA_ROOT = '/home/xiaoye/workspace/douquan/site_media'
ADMIN_MEDIA_ROOT = '/home/xiaoye/workspace/douquan/admin_media/'
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always ... | masiqi/douquan | xiaoye.py | Python | mit | 1,068 | 0.005618 |
h1hoft = TimeSeries.fetch_open_data('H1', 'Sep 14 2015 09:50:29', 'Sep 14 2015 09:51:01')
ax = plot.gca()
ax.plot(h1hoft)
plot.refresh()
| gwpy/gwpy.github.io | docs/v0.5/timeseries/plot-4.py | Python | gpl-3.0 | 137 | 0.007299 |
class Solution:
def isValidSerialization(self, preorder):
"""
:type preorder: str
:rtype: bool
"""
arr_pre_order = preorder.split(',')
stack = []
for node in arr_pre_order:
stack.append(node)
while len(stack) > 1 and stack[-1] ... | MingfeiPan/leetcode | stack/331.py | Python | apache-2.0 | 615 | 0.003252 |
"""
Django settings for SciMs project.
Generated by 'django-admin startproject' using Django 1.10.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
... | BdTNLM/SciMS | SciMs/settings.py | Python | mit | 3,325 | 0.001805 |
# Simulate data
if 0:
read("d.nex")
d = Data()
if 1:
nTax = 5
taxNames = list(string.uppercase[:nTax])
a = func.newEmptyAlignment(dataType='dna', taxNames=taxNames, length=200)
d = Data([a])
if 0:
read("t.nex")
t = var.trees[0]
#t.taxNames = taxNames
if 0:
read('(B:0.5, ((D:0.4,... | blaiseli/p4-phylogenetics | share/Examples/W_recipes/sSim.py | Python | gpl-2.0 | 819 | 0.002442 |
"""
WSGI config for photoboard 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.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_S... | photoboard/photoboard-django | photoboard/wsgi.py | Python | mit | 398 | 0 |
#!/usr/bin/env python
from binary_tools.constants import *
from binary_tools.binary import kicks
from binary_tools.binary.orbits import *
import matplotlib.pyplot as plt
from scipy.stats import maxwell
from scipy.integrate import quad
import random as rd
import numpy as np
__author__ = "Kaliroe Pappas"
__credits__ = [... | orlox/binary_tools | binary/tests/test_kicks.py | Python | gpl-3.0 | 32,399 | 0.019815 |
"""Test iterating through a vtkCollection with the standard python syntax"""
import vtk
from vtk.test import Testing
class TestIterateCollection(Testing.vtkTest):
def setUp(self):
self.vtkObjs = [vtk.vtkObject() for _ in range(30)]
self.collection = vtk.vtkCollection()
for obj in self.vt... | keithroe/vtkoptix | Common/Core/Testing/Python/TestIterateCollection.py | Python | bsd-3-clause | 1,600 | 0.001875 |
# -*- coding: utf-8 -*-
'''
script.screensaver.football.panel - A Football Panel for Kodi
RSS Feeds, Livescores and League tables as a screensaver or
program addon
Copyright (C) 2016 enen92
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Gener... | enen92/script.screensaver.football.panel | resources/lib/common_addon.py | Python | gpl-2.0 | 2,346 | 0.005968 |
from collections import defaultdict
import logging
import math
logger = logging.getLogger('lobster.algo')
class Algo(object):
"""A task creation algorithm
Attempts to be fair when creating tasks by making sure that tasks are
created evenly for every category and every workflow in each category
bas... | matz-e/lobster | lobster/core/create.py | Python | mit | 5,617 | 0.00178 |
import re
import datetime
import dateutil.parser
from django.conf import settings
from django.utils import feedgenerator
from django.utils.html import linebreaks
from apps.social.models import MSocialServices
from apps.reader.models import UserSubscription
from utils import log as logging
from vendor.facebook import Gr... | AlphaCluster/NewsBlur | utils/facebook_fetcher.py | Python | mit | 9,072 | 0.006944 |
#!/usr/bin/python
# write an experiment that raises an exception
import sys
import os
BOREALISPATH = os.environ['BOREALISPATH']
sys.path.append(BOREALISPATH)
import experiments.superdarn_common_fields as scf
from experiment_prototype.experiment_prototype import ExperimentPrototype
from experiment_prototype.decimati... | SuperDARNCanada/borealis | experiments/testing_archive/test_taps_not_list.py | Python | gpl-3.0 | 2,729 | 0.004397 |
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.contrib.auth import authenticate, login, logout
from django.http import HttpResponseRedirect, HttpResponse
from django.contrib.auth.decorators import login_required
from datetime import datetime
from hexwick.forms i... | dperconti/hexwick_python | hexwick/views.py | Python | agpl-3.0 | 3,890 | 0 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe, copy
import os
import json
from frappe.utils import cstr, flt, getdate
from frappe import _
from frappe.utils.file_manager import save_f... | bpshetty/erpnext | erpnext/setup/setup_wizard/setup_wizard.py | Python | gpl-3.0 | 18,648 | 0.030566 |
#!/usr/bin/env python
import nest
# Example of uses
def set_duration(duration=15):
if nest.get_variable('is_online') == True:
if nest,get_variable('has_fan') == True:
nest.get_variable('fan_timer_duration', duration)
return True
return False
def fan_on():
if nest.get_varia... | gb1035/simple_nest | examples.py | Python | gpl-3.0 | 855 | 0.014035 |
from django.template import Library, Node, resolve_variable, TemplateSyntaxError
from django.core.urlresolvers import reverse
register = Library()
@register.simple_tag
def active(request, pattern):
import re
if re.search(pattern, request.get_full_path()):
return 'active'
return '' | Kami/munin_exchange | munin_exchange/apps/core/templatetags/navclass.py | Python | bsd-3-clause | 307 | 0.013029 |
# 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 ... | rjschwei/azure-sdk-for-python | azure-mgmt-powerbiembedded/azure/mgmt/powerbiembedded/models/check_name_request.py | Python | mit | 1,018 | 0.001965 |
from __future__ import unicode_literals
import os.path
import optparse
import shlex
import sys
from .downloader.external import list_external_downloaders
from .compat import (
compat_expanduser,
compat_get_terminal_size,
compat_getenv,
compat_kwargs,
)
from .utils import (
preferredencoding,
w... | lulufei/youtube-dl | youtube_dl/options.py | Python | unlicense | 36,996 | 0.002054 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | aristanetworks/arista-ovs-nova | nova/tests/test_metadata.py | Python | apache-2.0 | 17,823 | 0.000673 |
import os
from scytale import create_app
from scytale.ciphers import MixedAlphabet, Playfair, Fleissner, Trifid, Myszkowski
from scytale.models import db, Group, Message
from scytale.forms import MessageForm
def create_group(name):
print("Creating admin group ({})".format(name))
group = Group()
group.nam... | WilliamMayor/scytale.xyz | scripts/seed/seeder.py | Python | mit | 13,201 | 0.001667 |
# mesa - toolkit for building dynamic python apps with zero downtime
# basis: package is inspected for all instances of specified abc and each added to internal mesa list
# Casa is a mesa obj is instantiated as holder of dynamic obj list, one for each abc type in specified package
# m = mesa.Casa(hideExceptions=False) ... | rutherford/mesa | TODO.py | Python | bsd-2-clause | 2,149 | 0.008841 |
import os
import re
import nltk
from nltk.tag import tnt
from modules import cleaner
class Location:
def __init__(self):
train_data = []
with open(os.path.join(os.path.dirname(__file__), 'tagged_locations.txt'), 'r') as f:
for line in f:
train_data.append([nltk.tag.st... | dwiajik/twit-macet-mining-v2 | modules/location.py | Python | mit | 1,393 | 0.003589 |
#
# Author: Endre Karlson <endre.karlson@gmail.com>
#
# 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 o... | billingstack/python-fakturo | fakturo/core/cli/base.py | Python | apache-2.0 | 3,279 | 0 |
{
'name': "Tag Project/Task View",
'version': "1.0",
'author': 'TAG Small Biz Community',
'website': 'http://www.smallbiz.community',
'category': "Tools",
'data': ['task_view.xml','project_view.xml'
],
'demo': [],
'depends': ['project'],
'installable': True,
} | smartforceplus/SmartForceplus | openerp/addons/tag_project_tasks/__openerp__.py | Python | agpl-3.0 | 311 | 0.009646 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# complexity documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# ... | westurner/pkgsetcomp | docs/conf.py | Python | bsd-3-clause | 8,492 | 0.005299 |
# coding:utf-8
import os
from db.MysqlHelper import MySqlConnection
from common.JsonHelper import loadJsonConfig
MYSQLCONNECTION = None
def initMysql():
global MYSQLCONNECTION
config = loadJsonConfig(os.path.abspath(os.path.join(os.getcwd(), "../config/db.json")))
MYSQLCONNECTION = MySqlConnection(confi... | zwffff2015/stock | db/MysqlUtil.py | Python | mit | 850 | 0.002353 |
# coding: utf-8
from __future__ import unicode_literals
from ...strings import StringStore
import pytest
def test_string_hash(stringstore):
'''Test that string hashing is stable across platforms'''
ss = stringstore
assert ss.add('apple') == 8566208034543834098
heart = '\U0001f499'
print(heart)
... | aikramer2/spaCy | spacy/tests/stringstore/test_stringstore.py | Python | mit | 3,384 | 0.000887 |
#! /usr/bin/env python
# Copyright (C) 2012 Club Capra - capra.etsmtl.ca
#
# This file is part of CapraVision.
#
# CapraVision 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 versio... | clubcapra/Ibex | src/seagoatvision_ros/scripts/CapraVision/server/filters/implementation/mti880.py | Python | gpl-3.0 | 5,241 | 0.006487 |
#!/usr/bin/env python
#
# SearchLIR.py
#
# Searches a local LIR file for RNA fragments that fits.
#
# http://iimcb.genesilico.pl/moderna/
#
__author__ = "Magdalena Rother, Tomasz Puton, Kristian Rother"
__copyright__ = "Copyright 2008, The Moderna Project"
__credits__ = ["Janusz Bujnicki"]
__license__ = "GPL"
__maintai... | mmagnus/rna-pdb-tools | rna_tools/tools/mini_moderna3/moderna/fragment_library/SearchLIR.py | Python | gpl-3.0 | 21,344 | 0.014618 |
"""
Batch processors
These commands implements the 'batch-command' and 'batch-code'
processors, using the functionality in src.utils.batchprocessors.
They allow for offline world-building.
Batch-command is the simpler system. This reads a file (*.ev)
containing a list of in-game commands and executes them in sequence... | TaliesinSkye/evennia | src/commands/default/batchprocess.py | Python | bsd-3-clause | 24,488 | 0.002654 |
from django import template
register = template.Library()
class RepeatNode(template.Node):
def __init__(self, nodelist, count):
self.nodelist = nodelist
self.count = template.Variable(count)
def render(self, context):
output = self.nodelist.render(context)
return output * ... | julcollas/django-smokeping | smokeping/templatetags/repeat.py | Python | gpl-2.0 | 1,004 | 0.010956 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 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.or... | yamt/neutron | quantum/plugins/nec/db/api.py | Python | apache-2.0 | 7,759 | 0 |
# -*- coding: utf-8 -*-
"""
werkzeug.debug
~~~~~~~~~~~~~~
WSGI application traceback debugger.
:copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import os
import re
import sys
import uuid
import json
import time... | pcu4dros/pandora-core | workspace/lib/python3.5/site-packages/werkzeug/debug/__init__.py | Python | mit | 17,737 | 0.000056 |
from __future__ import absolute_import
class Newsletter(object):
__all__ = ('is_enabled', 'get_subscriptions', 'update_subscription',
'create_or_update_subscription')
DEFAULT_LIST_ID = 1
enabled = False
def is_enabled(self):
return self.enabled
def get_subscriptions(self... | JamesMura/sentry | src/sentry/newsletter/base.py | Python | bsd-3-clause | 571 | 0 |
"""
"""
import difflib
import hashlib
import math
import os
import socket
import time
# global variables
settings_filename = "/home/fa11en/.config/synk/synk-settings.conf"
server_ip_field = "server_ip"
server_port_field = "server_port"
local_project_loc_field = "local_project_location"
server_project_loc_field = "s... | Eternali/synk | synk-pre/synk2cp2.py | Python | gpl-3.0 | 618 | 0 |
# Copyright 2012 Nebula, 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 agree... | bigswitch/nova | nova/tests/unit/api/openstack/compute/test_flavor_rxtx.py | Python | apache-2.0 | 3,454 | 0.000579 |
# This file is simply here to make sure that everything is running just as
# fast under the virtualbox as under the host OS. There should be no
# performance degradation. This takes me (Ben) approximately 1.2sec outside my
# virtual machine and appx 1.15sec inside the virtual machine. WHY IT IS
# FASTER inside the VM?!... | tbenthompson/codim1 | test/test_speed.py | Python | mit | 524 | 0.003817 |
# -*- coding: utf-8 -*-
"""
Grill logging module.
"""
# standard
from __future__ import annotations
import logging
from pathlib import Path
from naming import NameConfig
from grill.names import DateTimeFile
_LOG_FILE_SUFFIX = 'log'
class ErrorFilter(logging.Filter):
"""
Pass any message meant for stderr.
... | chrizzFTD/grill | grill/logger/model.py | Python | gpl-3.0 | 1,265 | 0 |
# -*- coding: utf-8 -*-
"""Installer for the plone.formbuilder package."""
from setuptools import find_packages
from setuptools import setup
long_description = '\n\n'.join([
open('README.rst').read(),
open('CONTRIBUTORS.rst').read(),
open('CHANGES.rst').read(),
])
setup(
name='plone.formbuilder',
... | tareqalam/plone.formbuilder | setup.py | Python | gpl-3.0 | 1,905 | 0 |
# -*- coding: utf-8 -*-
"""
Industrial Dual Analog In Plugin
Copyright (C) 2015 Olaf Lüke <olaf@tinkerforge.com>
Copyright (C) 2015-2016 Matthias Bolte <matthias@tinkerforge.com>
industrial_dual_analog_in.py: Industrial Dual Analog In Plugin Implementation
This program is free software; you can redistribute it and/or... | Tinkerforge/brickv | src/brickv/plugin_system/plugins/industrial_dual_analog_in/industrial_dual_analog_in.py | Python | gpl-2.0 | 9,465 | 0.002959 |
###########################################################
#
# Copyright (c) 2010, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... | Southpaw-TACTIC/TACTIC | src/tactic/ui/app/system_info_wdg.py | Python | epl-1.0 | 19,736 | 0.007499 |
#### 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 = Intangible()
result.template = "object/draft_schematic/structure/shared_generic_house_player_small_style_02_floorp... | anhstudios/swganh | data/scripts/templates/object/draft_schematic/structure/shared_generic_house_player_small_style_02_floorplan_02.py | Python | mit | 487 | 0.045175 |
# Borrowed liberally from awscli.
"""
AWS-NMAP
----
A Universal Command Line Environment for Amazon Web Services.
"""
import os
__version__ = '0.0.1'
#
# Get our data path to be added to botocore's search path
#
_awscli_data_path = []
if 'AWS_DATA_PATH' in os.environ:
for path in os.environ['AWS_DATA_PATH'].split... | sporkmonger/aws-nmap | awsnmap/__init__.py | Python | apache-2.0 | 930 | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Date : 2017/10/19 12:52
# @Author : xxc727xxc (xxc727xxc@foxmail.com)
# @Version : 1.0.0
from datetime import datetime
import time
from core.template.jinja2.init import jinja_filter
@jinja_filter('datetime')
def datetime_filter(t):
delta = int(time.time() - ... | DreamerBear/awesome-py3-webapp | www/core/template/jinja2/filters.py | Python | gpl-3.0 | 667 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Urwid escape sequences common to curses_display and raw_display
# Copyright (C) 2004-2011 Ian Ward
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free ... | urwid/urwid | urwid/escape.py | Python | lgpl-2.1 | 15,967 | 0.01691 |
import metrics
import node
import slm_ratios as slm
version = "1.0"
slm.set_clks_event_name("CPU_CLK_UNHALTED.THREAD")
smt_enabled = False
class CyclesPerUop(slm.CyclesPerUop):
server = True
# LEVEL 1
class FrontendBound(slm.FrontendBound):
server = True
class BackendBound(slm.BackendBound):
server = ... | andikleen/pmu-tools | knl_ratios.py | Python | gpl-2.0 | 2,582 | 0.005035 |
# -*- coding:utf-8 -*-
import argparse
from nlp.ner.idcnn.train import train
from nlp.ner.idcnn.predict import predict
def main(args):
if args.train:
train(args)
else:
predict(args)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--train', type=boo... | koala-ai/tensorflow_nlp | nlp/ner/idcnn/run.py | Python | apache-2.0 | 3,000 | 0.009333 |
from nose.tools import (raises, assert_raises, assert_true,
assert_equal, assert_not_equal, assert_almost_equal)
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
from deepjets.preprocessing import zoom_image, pixel_edges
def test_zoom():
edges =... | deepjets/deepjets | deepjets/tests/test_preprocessing.py | Python | bsd-3-clause | 1,088 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.