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 |
|---|---|---|---|---|---|---|
''' direct
.. moduleauthor:: Edwin Tye <Edwin.Tye@gmail.com>
'''
from __future__ import division, print_function, absolute_import
from .sqp import *
from .ip import *
from .ipBar import *
from .ipPD import *
from .ipPDC import *
from .ipPDandPDC import *
from .approxH import *
from .trust import *
__all__ = [s for ... | edwintye/pygotools | pygotools/convex/__init__.py | Python | gpl-2.0 | 412 | 0.002427 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
#
# 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 you... | SNoiraud/gramps | gramps/gen/filters/rules/family/_hasreltype.py | Python | gpl-2.0 | 2,354 | 0.005098 |
def d(n):
tp = (n>>4) + (n>>3)
if tp < 64:
tp = 64
if tp > 2048:
tp = 2048
print[n,tp]
for x in range(0, 9999, 512):
d(x)
| dw/scratch | overalloc.py | Python | mit | 161 | 0.018634 |
import re
import SourceModel.SM_CaseStmt
import SourceModel.SM_Class
import SourceModel.SM_Constants as SMCONSTS
import SourceModel.SM_Define
import SourceModel.SM_Define
import SourceModel.SM_Element
import SourceModel.SM_Exec
import SourceModel.SM_FileResource
import SourceModel.SM_IfStmt
import SourceModel.SM_Inclu... | tushartushar/Puppeteer | SourceModel/SM_File.py | Python | apache-2.0 | 17,577 | 0.004153 |
import pytest
import cryptopals.common as common
def test_base64_from_hex():
assert 'SGVsbG8sIHdvcmxkIQ==' == common.base64_from_hex('48656c6c6f2c20776f726c6421')
@pytest.mark.parametrize('first_bytes, second_bytes, expected_output', [
(b'Hello,', b'World!', 17),
(b'foo', b'bar', 8),
(b'baz', b'qux... | edwardsdl/cryptopals | cryptopals/tests/test_common.py | Python | mit | 1,109 | 0.003607 |
# -*- coding: utf-8; -*-
#
# @file models.py
# @brief coll-gate accession module models.
# @author Frédéric SCHERMA (INRA UMR1095), Medhi BOULNEMOUR (INRA UMR1095)
# @date 2016-09-01
# @copyright Copyright (c) 2016 INRA/CIRAD
# @license MIT (see LICENSE file)
# @details
import re
from django.contrib.auth.models impor... | coll-gate/collgate | server/accession/models.py | Python | mit | 31,423 | 0.002355 |
import unittest
import slowboy.gpu
import slowboy.interrupts
from tests.mock_interrupt_controller import MockInterruptController
STAT_IE_ALL_MASK = (slowboy.gpu.STAT_LYC_IE_MASK |
slowboy.gpu.STAT_OAM_IE_MASK |
slowboy.gpu.STAT_HBLANK_IE_MASK |
slowboy.gp... | zmarvel/slowboy | tests/test_gpu.py | Python | mit | 7,556 | 0.000794 |
try:
from scapy.all import *
except ImportError:
sys.stderr.write("ERROR: You must have scapy installed.\n")
sys.stderr.write("You can install it by running: sudo pip install -U 'scapy>=2.3,<2.4'")
exit(1)
try:
from scapy.layers import http
except ImportError:
sys.stderr.write("ERROR: You must have scapy-http ins... | thesecuritystoic/Packet2Snort | packet2snort.py | Python | gpl-3.0 | 9,018 | 0.026503 |
'''This module contains differnet implementations of distributed average consensus'''
| ZacBlanco/adac | adac/consensus/__init__.py | Python | mit | 86 | 0.011628 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | timj/scons | test/packaging/strip-install-dir.py | Python | mit | 2,169 | 0.003688 |
from os import listdir
from os.path import isfile, join
import unittest
from parse_apache_configs import parse_config
import pprint
class testParseConfig(unittest.TestCase):
#print "ENTERING TEST_PARSE_CONFIG" + "-"*8
def test_parse_config(self):
test_files = [ f for f in listdir("./test_conf_fil... | alextricity25/parse_apache_configs | parse_apache_configs/test/test_parse_config.py | Python | apache-2.0 | 1,118 | 0.013417 |
from ..errors import InvalidVersion
from ..utils import check_resource, minimum_version
from ..utils import version_lt
from .. import utils
class NetworkApiMixin(object):
@minimum_version('1.21')
def networks(self, names=None, ids=None, filters=None):
"""
List networks. Similar to the ``docker... | vpetersson/docker-py | docker/api/network.py | Python | apache-2.0 | 10,566 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from unittest import TestLoader, TextTestRunner
from potcommuntests import Tests
runner = TextTestRunner()
testsSuite = TestLoader().loadTestsFromTestCase(Tests)
#testsSuite = TestLoader().loadTestsFromName("potcommuntests.Tests.test_with_some_missing_items")
runner.run(t... | manuco/Pot-commun | testrunner.py | Python | gpl-3.0 | 332 | 0.009036 |
# -*- coding: utf-8 -*-
# Authors: Eric Larson <larson.eric.d@gmail.com>
# License: BSD (3-clause)
import numpy as np
from ..utils import check_fname, _check_fname
def read_fine_calibration(fname):
"""Read fine calibration information from a .dat file.
The fine calibration typically includes improved sens... | Teekuningas/mne-python | mne/preprocessing/_fine_cal.py | Python | bsd-3-clause | 2,954 | 0 |
#!/usr/bin/env python3
# McDermott
# March 2020
# first, make sure the macfp module directory is in your path
# if not, uncomment the lines below and replace <path to macfp-db>
# with the path (absolute or relative) to your macfp-db repository
import sys
# sys.path.append('<path to macfp-db>/macfp-db/Utilities/')
sys... | MaCFP/macfp-db | Buoyant_Plumes/Sandia_Helium_Plume/Computational_Results/2021/SNL/SNL_plot_results.py | Python | mit | 754 | 0.005305 |
#!/usr/bin/env python2.6
import cgi
import time
import os
import subprocess
"""
problem: cgi scripts run as user 'nobody'
how can we handle signaling the daemon ?
"""
form = cgi.FieldStorage()
print "Content-Type: text/html" # HTML is following
print
print "<TITLE>CGI script output</TITLE>"
print "Hey... | danduggan/hltd | cgi/harakiri_cgi.py | Python | lgpl-3.0 | 593 | 0.005059 |
#!/usr/bin/python
# Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].
class Solution(object):
# @param {integer[]} nums
# @return {integer[]}
def productExceptSelf(self, nums):
p = 1
... | ravyg/algorithms | python/238_productArrayExceptSelf.py | Python | gpl-3.0 | 721 | 0.015257 |
#! /usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions... | mcanthony/nupic | src/nupic/data/CategoryFilter.py | Python | agpl-3.0 | 2,276 | 0.003954 |
#!/usr/bin/env python
from pathlib import Path
import nbrun
default_notebook_name = 'smFRET-PAX_single_pop.ipynb'
def run_analysis(data_filename, input_notebook=None, save_html=False,
working_dir=None, suffix='', dry_run=False):
"""
Run analysis notebook on the passed data file.
Argume... | multispot-software/transfer_convert | analyze.py | Python | mit | 3,069 | 0.000326 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | jss-emr/openerp-7-src | openerp/addons/account/account_move_line.py | Python | agpl-3.0 | 70,268 | 0.005764 |
import itertools
def with_metaclass(meta_class, base_class=object):
"""
:param meta_class: The desired metaclass to use
:param base_class: The desired base class to use, the default one is object
:type base_class: Type
:return: Metaclass type to inherit from
:Example:
.. code-block:: pyt... | leapp-to/prototype | leapp/utils/meta.py | Python | lgpl-2.1 | 1,358 | 0.001473 |
class FakeFetcher(object):
"""
Used i.e. in Harvest tracker when we need credentials but don't fetcher
"""
def __init__(self, *args, **kwargs):
pass
def fetch_user_tickets(self, *args, **kwargs):
pass
def fetch_all_tickets(self, *args, **kwargs):
pass
def fetch_b... | stxnext/intranet-open | src/intranet3/intranet3/asyncfetchers/fake.py | Python | mit | 416 | 0 |
# -*- encoding: utf-8 -*-
# pilas engine - a video game framework.
#
# copyright 2010 - hugo ruscitti
# license: lgplv3 (see http://www.gnu.org/licenses/lgpl.html)
#
# website - http://www.pilas-engine.com.ar
import pilas
from pilas import colores
try:
import Box2D as box2d
except ImportError:
print "No esta... | cristian99garcia/pilas-activity | pilas/fisica.py | Python | gpl-3.0 | 14,319 | 0.003006 |
# Copyright 2014 Rackspace Inc.
#
# Author: Tim Simmons <tim.simmons@rackspace.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
#
# Unl... | ramsateesh/designate | designate/backend/agent_backend/impl_bind9.py | Python | apache-2.0 | 5,255 | 0 |
#!/usr/bin/env python
"""Perform object finding and association."""
import os, glob
from os.path import exists, join
import time
import fitsio
import numpy as np
from ugali.analysis.pipeline import Pipeline
from ugali.analysis.search import CandidateSearch
import ugali.candidate.associate
from ugali.utils.logger imp... | DarkEnergySurvey/ugali | ugali/pipeline/run_04.0_peak_finder.py | Python | mit | 4,508 | 0.013088 |
# Copyright (c) 2013 Christian Schwede <christian.schwede@enovance.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 b... | notmyname/swift | test/unit/cli/test_recon.py | Python | apache-2.0 | 44,459 | 0.000135 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Script to convert an ICCD TRC file to CSV format.
The input file is assumed to be UTF-8 with UNIX line ending.
"""
#
# (C) Federico Leva, 2016
#
# Distributed under the terms of the MIT license.
#
__version__ = '0.1.0'
import codecs
import unicodecsv as csv
from collectio... | nemobis/bots | iccd-trc2csv.py | Python | gpl-3.0 | 4,621 | 0.01926 |
"""
WSGI config for cbe 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.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_... | Semprini/cbe | cbe/cbe/wsgi.py | Python | apache-2.0 | 383 | 0 |
"""
IOStore class originated here
https://github.com/BD2KGenomics/hgvm-graph-bakeoff-evaluations/blob/master/scripts/toillib.py
and was then here:
https://github.com/cmarkello/toil-lib/blob/master/src/toil_lib/toillib.py
In a perfect world, this would be deprecated and replaced with Toil's stores.
Actually did t... | vgteam/toil-vg | src/toil_vg/iostore.py | Python | apache-2.0 | 36,706 | 0.009562 |
""" A fast conditional independence test.
This implementation uses the joblib library to parallelize test
statistic computation over all available cores. By default, num_perm=8
(instead of num_perm=10 in the non-parallel version) as 8 cores is a
common number on current architectures.
Reference:
Chalupka, Krzysztof a... | kjchalup/dtit | fcit/fcit.py | Python | mit | 7,474 | 0.001338 |
# python
# This file is generated by a program (mib2py).
import HOST_RESOURCES_MIB
OIDMAP = {
'1.3.6.1.2.1.25': HOST_RESOURCES_MIB.host,
'1.3.6.1.2.1.25.1': HOST_RESOURCES_MIB.hrSystem,
'1.3.6.1.2.1.25.2': HOST_RESOURCES_MIB.hrStorage,
'1.3.6.1.2.1.25.2.1': HOST_RESOURCES_MIB.hrStorageTypes,
'1.3.6.1.2.1.25.3': HOST... | xiangke/pycopia | mibs/pycopia/mibs/HOST_RESOURCES_MIB_OID.py | Python | lgpl-2.1 | 5,000 | 0.0164 |
# -*- coding: utf-8 -*-
'''
Genesis Add-on
Copyright (C) 2015 lambda
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 ... | AMOboxTV/AMOBox.LegoBuild | plugin.video.titan/resources/lib/resolvers/ishared.py | Python | gpl-2.0 | 1,793 | 0.016732 |
import unittest
import random
import threading
import time
from test import test_support
if test_support.is_jython:
from java.util import ArrayList
from java.lang import String
class ListTestCase(unittest.TestCase):
def test_recursive_list_slices(self):
x = [1,2,3,4,5]
x[1:] = x
s... | zephyrplugins/zephyr | zephyr.plugin.jython/jython2.5.2rc3/Lib/test/test_list_jy.py | Python | epl-1.0 | 3,309 | 0.007555 |
# Copyright 2016 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 required by applicable law or ag... | dhermes/google-cloud-python | spanner/google/cloud/spanner_v1/client.py | Python | apache-2.0 | 11,355 | 0.000264 |
#!/usr/bin/python3
import os
import time
import logging
import getopt
import sys
from gdmod import ApplicationConfiguration
from gdmod import Database
from gdmod import DoorState
from gdmod import Sms
# ************************************************************************
# Schedule to run whenever you would like ... | denniskline/garage-door | alarm_door_open.py | Python | apache-2.0 | 2,822 | 0.006378 |
from apps.projects.models import Experiment, Project, Datarow, Value
def project_serialize(project_id):
#get all experiments from that project into a nested list of dictionaries to post to the selected webservice
experiment_objects = list(Experiment.objects.filter(project=project_id))
for experiment_object... | IT-PM-OpenAdaptronik/Webapp | apps/projects/serializer.py | Python | mit | 2,086 | 0.011026 |
#!/usr/bin/env python3
import chipset
def read(reg):
reg = int(reg, 16)
val = chipset.intel_register_read(reg)
return val
def init():
pci_dev = chipset.intel_get_pci_device()
ret = chipset.intel_register_access_init(pci_dev, 0)
if ret != 0:
print("Register access init failed");
return False
return True
if... | ChrisCummins/intel-gpu-tools | tools/quick_dump/reg_access.py | Python | mit | 473 | 0.042283 |
from .calibre_access import (print_record, calibre_downloads, calibre_searches,
all_records, download_coro, search_coro, download_database,
locate_logs, get_database)
__all__ = (print_record, calibre_downloads, calibre_searches, all_records, download_coro,
... | Laharah/calibre-access | calibre_access/__init__.py | Python | mit | 386 | 0.005181 |
import os
import pwd
import spwd
import grp
import subprocess
class Machine():
def __init__(self, dryrun=False, default_gid=2000, uid_range=[2000, 3000]):
self.dryrun = dryrun
self.default_gid = default_gid
self.uid_range = uid_range
def call(self, cmd):
if self.dryrun:
... | aipescience/daiquiri-admin | daiquiri/machine.py | Python | apache-2.0 | 4,577 | 0.000874 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
python library for the AR.Drone 1.0 (1.11.5) and 2.0 (2.2.9).
parts of code from Bastian Venthur, Jean-Baptiste Passot, Florian Lacrampe.
tested with Python 2.7.3 and AR.Drone vanilla firmware 1.11.5.
"""
# < imports >-------------------------------------------------... | projeto-si-lansab/si-lansab | ARDrone/libARDrone.py | Python | gpl-2.0 | 36,206 | 0.016434 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2013, Eduard Broecker
# 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 co... | altendky/canmatrix | src/canmatrix/cli/convert.py | Python | bsd-2-clause | 10,309 | 0.006208 |
import pass_pipeline as ppipe
import passes as p
def simplifycfg_silcombine_passlist():
return ppipe.PassList([
p.SimplifyCFG,
p.SILCombine,
p.SimplifyCFG,
])
def highlevel_loopopt_passlist():
return ppipe.PassList([
p.LowerAggregateInstrs,
p.SILCombine,
... | apple/swift | utils/pass-pipeline/src/pass_pipeline_library.py | Python | apache-2.0 | 2,942 | 0 |
import logging
from logging_helpers import _L
from pygtkhelpers.gthreads import gtk_threadsafe
import threading
import zmq
from .plugin import CommandZmqPlugin
from ...app_context import get_hub_uri
from ...plugin_helpers import hub_execute
from ...plugin_manager import (PluginGlobals, SingletonPlugin, IPlugin,
... | wheeler-microfluidics/microdrop | microdrop/core_plugins/command_plugin/microdrop_plugin.py | Python | bsd-3-clause | 3,275 | 0.000305 |
# coding=utf-8
# Copyright 2018 The DisentanglementLib 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
#
# Un... | google-research/disentanglement_lib | disentanglement_lib/config/abstract_reasoning_study_v1/stage1/sweep.py | Python | apache-2.0 | 5,267 | 0.010442 |
#!/usr/bin/env python
import os
import django
if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'benchmark.settings')
django.setup()
from benchmark.base import Benchmark
Benchmark().run()
| BertrandBordage/django-tree | run_benchmark.py | Python | bsd-3-clause | 233 | 0 |
#!/usr/local/bin/ipython -i
"""
A scatter graph of grid count vs grid area.
"""
import numpy as np
import matplotlib.pyplot as plt
# extract data from csv
file_name = "../data/tdwgsp_filtered.csv"
# columns (filtered):
# 1 - star_infs
# 2 - tdwgtotals
# 3 - tdwgareas
star_infs = np.genfromtxt(file_name, delimiter=','... | Nodoka/Bioquality | graphing/tdwg_scatter.py | Python | mit | 1,350 | 0.002963 |
# Copyright (c) 2014-2015 Cedric Bellegarde <cedric.bellegarde@adishatz.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 version 3 of the License, or
# (at your option) any later vers... | gigitux/lollypop | src/pop_next.py | Python | gpl-3.0 | 2,854 | 0 |
from django.contrib import admin
from cms.admin.pageadmin import PageAdmin
from cms.models import Page
from .models import page, Sub_Pages
admin.site.register(page)
admin.site.register(Sub_Pages)
| ytec/instaforex-web | app/pages/admin.py | Python | gpl-3.0 | 201 | 0 |
import pymongo
import logging
import time
# import sys
# import os
# sys.path.insert(0, os.path.normpath(os.path.join(__file__, '..', '..', '..')))
# from lib.db.base import Base
from .base import Base
logger = logging.getLogger('db.jolla')
client = pymongo.MongoClient()
db = client['jolla']
# TODO: support more sit... | TylerTemp/tomorrow | lib/db/jolla.py | Python | gpl-3.0 | 11,853 | 0.000169 |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
import unittest
from flypy import jit
class TestControlFlow(unittest.TestCase):
def test_loop_carried_dep_promotion(self):
@jit
def f(n):
sum = 0
for i in range(n):
sum... | flypy/flypy | flypy/tests/test_control_flow.py | Python | bsd-2-clause | 2,894 | 0.001037 |
import os
import sys
import math
import errno
import subprocess
import tkMessageBox
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from PIL import Image
from matplotlib import style
from datetime import datetime
from matplotlib.widgets import RadioBu... | RyanChinSang/LeagueLatency | History/Raw/v2.2a Stable/LL.py | Python | gpl-3.0 | 21,253 | 0.00494 |
# Copyright 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | ntymtsiv/tempest | tempest/services/identity/v3/json/policy_client.py | Python | apache-2.0 | 2,378 | 0 |
#
# Copyright (c) 2014 Tom Carroll
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, dis... | haxsaw/actuator | src/actuator/provisioners/example_resources.py | Python | mit | 2,612 | 0.004977 |
# -*- coding: utf-8 -*-
"""
Created on 05 Apr 2014 3:30 AM
@author: <'Ronny Eichler'> ronny.eichler@gmail.com
UI
""" | wonkoderverstaendige/PyFL593FL | PyFL593FL/ui/__init__.py | Python | mit | 117 | 0.017094 |
import networkx as nx
import matplotlib.pyplot as plt
try:
import pygraphviz
from networkx.drawing.nx_agraph import graphviz_layout
except ImportError:
try:
import pydot
from networkx.drawing.nx_pydot import graphviz_layout
except ImportError:
raise ImportError("This example nee... | jfinkels/networkx | examples/drawing/circular_tree.py | Python | bsd-3-clause | 639 | 0.001565 |
"""
The command line interface for the Threema Gateway Callback Server.
"""
import asyncio
import functools
import click
import logbook
import logbook.more
from threema.gateway import __version__ as _version
from threema.gateway import (
Connection,
util,
)
from threema.gateway.e2e import AbstractCallback
fro... | threema-ch/threema-msgapi-sdk-python | threema/gateway/bin/callback_server.py | Python | mit | 4,446 | 0.0009 |
# Exercise 36: Designing and debugging
# No code
# Read: http://learnpythonthehardway.org/book/ex36.html
| pwittchen/learn-python-the-hard-way | exercises/exercise36.py | Python | mit | 105 | 0 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2013 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.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, eithe... | power12317/weblate | weblate/trans/migrations/0011_add_file_format.py | Python | gpl-3.0 | 13,518 | 0.007843 |
''' A self-contained test file.
@author Emma Wang
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from tensorflow.contrib.tpu.python.tpu import tpu_config
from tensorflow.contrib.tpu.python.tpu import tpu_estimator
from tensorfl... | Emma926/paradnn | test.py | Python | apache-2.0 | 4,858 | 0.011116 |
# encoding=utf8
# pylint: disable=W0611
""" The utility
Author: lipixun
Created Time : 日 2/12 14:14:50 2017
File Name: utils.py
Description:
"""
from spec import DataPath
# Import json
try:
import simplejson as json
except ImportError:
import json
# NLTK
import nltk
nltk.data.path = [ Data... | lipixun/newsanalyzer4w | newsanalyzer/utils.py | Python | gpl-3.0 | 329 | 0.006116 |
#!/usr/bin/env python
from base import *
""" A representation of a nagios service dependency"""
class Command(BaseObject):
TYPE = 'command'
TEMPLATE_CLASS = None
PARAMS = (
'command_name',
'command_line'
)
REQUIRED_PARAMS = PARAMS
@property
def identity(self):
ret... | johnskopis/naglib | naglib/config/command.py | Python | mit | 342 | 0.002924 |
import kivy
kivy.require('1.9.1')
from kivy.app import Builder
from kivy.uix.gridlayout import GridLayout
from kivy.properties import ObjectProperty
from kivy.logger import Logger
from settingsview import SettingsView, SettingsSwitch, SettingsButton
from autosportlabs.widgets.separator import HLineSeparator
from autosp... | ddimensia/RaceCapture_App | autosportlabs/racecapture/views/configuration/rcp/wireless/bluetoothconfigview.py | Python | gpl-3.0 | 3,672 | 0.004085 |
#
# This file is part of postpic.
#
# postpic 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.
#
# postpic is distributed in the hope th... | stetie/postpic | postpic/_compat/functions.py | Python | gpl-3.0 | 3,618 | 0.000553 |
import logging
import click
import click_log
from flask.cli import with_appcontext
from ..account import github
from . import tasks
from .models import Project
logger = logging.getLogger(__name__)
click_log.basic_config(logger)
@click.command("projects")
@click_log.simple_verbosity_option(logger)
@with_appcontext
... | jazzband/site | jazzband/projects/commands.py | Python | mit | 1,877 | 0.000533 |
from .. import Provider as BaseProvider
class Provider(BaseProvider):
# jobs parsed from a list provided by State Treasury:
# http://www.valtiokonttori.fi/download/noname/%7BF69EA5BD-C919-49FE-8D51-91434E4B030D%7D/82158
jobs = [
"Agrologi",
"Aikuiskoulutusjohtaja",
"Aineenopettaja"... | joke2k/faker | faker/providers/job/fi_FI/__init__.py | Python | mit | 6,120 | 0 |
# -*- coding: utf-8 -*-
# Copyright 2017-TODAY LasLabs Inc.
# License MIT (https://opensource.org/licenses/MIT).
from .api_common import ApiCommon, recorder
class TestApisTags(ApiCommon):
"""Tests the Tags API endpoint."""
def setUp(self):
super(TestApisTags, self).setUp()
self.__endpoint__ ... | LasLabs/python-helpscout | helpscout/tests/test_apis_tags.py | Python | mit | 1,513 | 0 |
print ("suma de los digitos de un numero")
print ("de cuantos digitos quere trabajar")
a = int(raw_input("numero de dijitos"))
if a == 2 :
print("escribe el numero")
b = int(raw_input("numero="))
c = b/10
d = b%10
print (c + d )
if a == 3 :
print("escribe el numero")
b = int(raw_input("numer... | andres00157/Curso-de-javeriana | 4.py | Python | apache-2.0 | 1,335 | 0.03221 |
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
testinfo = "s, t 5.1, s, q"
tags = "CocosNode.remove"
import cocos
from cocos.director import director
from cocos.sprite import Sprite
from coco... | shadowmint/nwidget | lib/cocos2d-0.5.5/test/test_remove.py | Python | apache-2.0 | 1,052 | 0.024715 |
# @Author: Manuel Rodriguez <valle>
# @Date: 01-Jan-2018
# @Email: valle.mrv@gmail.com
# @Last modified by: valle
# @Last modified time: 07-Jan-2018
# @License: Apache license vesion 2.0
| vallemrv/tpvB3 | cloud/contabilidad/__init__.py | Python | apache-2.0 | 192 | 0 |
import time
import numpy
#Based heavily on the Arduino PID library by Brett Beauregard
# By default, looks for an attribute called value for the input, and setting for the output
# If you want to change that, then you can change the input/outputAttributeName
# Input source must be available when PID is initialized to ... | Bobstin/AutomatedBrewery | automatedbrewery/PID.py | Python | mit | 23,167 | 0.01869 |
from __future__ import unicode_literals, division, absolute_import
import logging
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
from flexget import plugin
from flexget.event import event
try:
# NOTE: Importing other plugins is discouraged!
from flexget.components.parsing.par... | gazpachoking/Flexget | flexget/plugins/metainfo/metainfo_movie.py | Python | mit | 1,939 | 0.001031 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014 Daniele Simonetti
#
# 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.
#
# Thi... | OpenNingia/l5r-character-manager | l5rcm/models/advancements/rank.py | Python | gpl-3.0 | 3,132 | 0.014368 |
"""
A Python "serializer". Doesn't do much serializing per se -- just converts to
and from basic Python data types (lists, dicts, strings, etc.). Useful as a basis for
other serializers.
"""
from __future__ import unicode_literals
from collections import OrderedDict
from django.apps import apps
from django.conf impor... | djbaldey/django | django/core/serializers/python.py | Python | bsd-3-clause | 7,685 | 0.004294 |
from __future__ import division, absolute_import, unicode_literals
import json
from .. import core
from .. import utils
from ..git import git
from ..observable import Observable
# put summary at the end b/c it can contain
# any number of funky characters, including the separator
logfmt = 'format:%H%x01%P%x01%d%x01%an... | wojnilowicz/git-cola | cola/models/dag.py | Python | gpl-2.0 | 8,995 | 0.000222 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import pygame
import os
fullname = os.path.join('res', 'gui')
def init(gui):
buttonsurf = pygame.image.load(os.path.join(fullname, 'button.png')).convert_alpha()
closesurf = pygame.image.load(os.path.join(fullname,
'closebutton.png... | luisgustavossdd/TBD | client/pygameclient/widgets/regnancyStyle.py | Python | gpl-3.0 | 3,306 | 0.003932 |
# ====================================================================
# 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 re... | lskillen/pylucene | test/test_PrefixFilter.py | Python | apache-2.0 | 4,217 | 0.000949 |
import FBBot
fb_client = FBBot.FBBotClient()
class WebhookView(FBBot.FBBotWebhookView):
def handle_message(self, message, sender_id):
if message == "logo":
fb_client.send_image(sender_id, "https://d2for33x7as0fp.cloudfront.net/static/images/53-logo.71a393299d20.png")
else:
... | GhalebKhaled/fb-bot-test | bot/api/views.py | Python | apache-2.0 | 406 | 0.004926 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11a1 on 2017-05-12 17:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | JiaruZhang/Five | main/migrations/0002_auto_20170512_1731.py | Python | apache-2.0 | 2,835 | 0.001764 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pogoprotos/networking/responses/add_fort_modifier_response.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _messa... | bellowsj/aiopogo | aiopogo/pogoprotos/networking/responses/add_fort_modifier_response_pb2.py | Python | mit | 4,943 | 0.00526 |
#!/usr/bin/env python3
import argparse
import feedparser
import logging
import praw
import requests
from config import *
from bs4 import BeautifulSoup
from html2text import html2text
logging.basicConfig(format='%(asctime)s::%(levelname)s:%(message)s',
filename='redditbot.log',
... | dbxnr/redditbot | redditbot.py | Python | gpl-3.0 | 4,394 | 0.002048 |
#Read data from stdin
import sys, json
def read_sentence():
lines = sys.stdin.readlines()
#Since our input would only be having one line, parse our JSON data from that
return json.loads(lines[0])
def read_sentence1():
line = sys.stdin.readline()
#Since our input would only be having one line, parse our J... | sandeep82945/audience-predictor | src/python/read_data.py | Python | cc0-1.0 | 396 | 0.037879 |
# coding=utf-8
"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import InstanceResource
from twilio.base.... | angadpc/Alexa-Project- | twilio/rest/taskrouter/v1/workspace/__init__.py | Python | mit | 24,809 | 0.001491 |
import logging
from pylons import request, response, session, tmpl_context as c, url
from pylons.controllers.util import abort, redirect
from pylons.templating import render_mako_def
from kai.lib.base import BaseController, render
from kai.lib.helpers import textilize
from kai.lib.serialization import render_feed
fro... | Pylons/kai | kai/controllers/comments.py | Python | bsd-3-clause | 2,956 | 0.004736 |
#!/usr/bin/env python
import unittest
from efl.eo import Eo
from efl import elementary
from efl.elementary.window import Window, ELM_WIN_BASIC
from efl.elementary.button import Button
elementary.init()
class TestElmBasics(unittest.TestCase):
def setUp(self):
self.o = Window("t", ELM_WIN_BASIC)
def... | maikodaraine/EnlightenmentUbuntu | bindings/python/python-efl/tests/elementary/test_01_basics.py | Python | unlicense | 652 | 0.003067 |
import pymongo
import configparser
def db():
config = configparser.RawConfigParser()
config.read('./.config')
host = config.get('tumblr', 'host')
port = config.get('tumblr', 'port')
user = config.get('tumblr', 'user')
passwd = config.get('tumblr', 'passwd')
client = pymongo.MongoClient(hos... | blacksky0000/tools | tumblr/dbconnect.py | Python | mit | 463 | 0.008639 |
# encoding: utf-8
# module PyQt4.QtGui
# from /usr/lib/python2.7/dist-packages/PyQt4/QtGui.so
# by generator 1.135
# no doc
# imports
import PyQt4.QtCore as __PyQt4_QtCore
class QGestureEvent(__PyQt4_QtCore.QEvent):
"""
QGestureEvent(list-of-QGesture)
QGestureEvent(QGestureEvent)
"""
def accept(s... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/PyQt4/QtGui/__init__/QGestureEvent.py | Python | gpl-2.0 | 2,497 | 0.007609 |
#!/usr/bin/python3
import tkinter
import PIL.Image
import PIL.ImageTk
from tkinter.ttk import Progressbar as pbar
from PyFont import Font, SVG
class TkFont():
CHARY = 200
CHARX = 50
LINEY = CHARY / 2
MAIN_COLOR = '#FFFFFF'
def set_label(self):
tmp = self.words[-1].export_png_to_str()
... | chichaj/PyFont | PyFont/FontRuntime.py | Python | mit | 5,128 | 0.00117 |
from hashlib import md5, sha1
import cherrypy
from cherrypy._cpcompat import ntob
from cherrypy.lib import httpauth
from cherrypy.test import helper
class HTTPAuthTest(helper.CPWebCase):
@staticmethod
def setup_server():
class Root:
@cherrypy.expose
def index(self):
... | Southpaw-TACTIC/TACTIC | 3rd_party/python2/site-packages/cherrypy/test/test_httpauth.py | Python | epl-1.0 | 6,303 | 0 |
import gtk
# TODO: the *_menu.append() calls here cause a GTK assertion failure
# in the form of "GtkWarning: gtk_accel_label_set_accel_closure: assertion
# `gtk_accel_group_from_accel_closure (accel_closure) != NULL' failed"
# the exact reason is the create_menu_item-call, but I can't figure why
class MenuBar(gtk.M... | RaumZeit/gdesklets-core | shell2/MenuBar.py | Python | gpl-2.0 | 1,254 | 0.008772 |
"""Support for IKEA Tradfri switches."""
import logging
from homeassistant.components.switch import SwitchDevice
from homeassistant.core import callback
from . import DOMAIN as TRADFRI_DOMAIN, KEY_API, KEY_GATEWAY
from .const import CONF_GATEWAY_ID
_LOGGER = logging.getLogger(__name__)
IKEA = 'IKEA of Sweden'
TRADF... | jabesq/home-assistant | homeassistant/components/tradfri/switch.py | Python | apache-2.0 | 4,263 | 0 |
import os
import traceback
import py
from flaky import flaky
from tox.session.commands.run import sequential
@flaky(max_runs=3)
def test_tox_parallel_build_safe(initproj, cmd, mock_venv, monkeypatch):
initproj(
"env_var_test",
filedefs={
"tox.ini": """
[tox]
... | gaborbernat/tox | tests/unit/package/test_package_parallel.py | Python | mit | 4,272 | 0.000936 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains convenience functions for coordinate-related functionality.
This is generally just wrapping around the object-oriented coordinates
framework, but it is useful for some users who are used to more functional
interfaces.
"""
import... | pllim/astropy | astropy/coordinates/funcs.py | Python | bsd-3-clause | 13,747 | 0.0008 |
''' This script is prepared by Tyler Pubben and is licensed under the MIT license framework.
It is free to use and distribute however please reference http://www.tjscientific.com or my
GIT repository at https://github.com/tpubben/SequoiaStacking/'''
import numpy as np
import cv2
import os
def align_images(in... | tpubben/SequoiaStacking | parrotStacking.py | Python | mit | 3,776 | 0.005297 |
# -*- coding: utf-8 -*-
"""Tests for Regression Diagnostics and Specification Tests
Created on Thu Feb 09 13:19:47 2012
Author: Josef Perktold
License: BSD-3
currently all tests are against R
"""
#import warnings
#warnings.simplefilter("default")
# ResourceWarning doesn't exist in python 2
#warnings.simplefilter("i... | hlin117/statsmodels | statsmodels/stats/tests/test_diagnostic.py | Python | bsd-3-clause | 40,146 | 0.007163 |
# Copyright (c) 2013-2016 Christian Geier et al.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, ... | dzoep/khal | khal/ui/widgets.py | Python | mit | 14,425 | 0.000971 |
"""WSGI application."""
import os
from sys import argv
from werkzeug.serving import run_simple
from werkzeug.wsgi import DispatcherMiddleware
from tweetTrack.app import app
application = DispatcherMiddleware(app)
if __name__ == '__main__':
if len(argv) < 2 or argv[1] == 'Dev':
os.environ['FLASK_CONFIG'] ... | lnhubbell/tweetTrack | tweetTrack/wsgi.py | Python | mit | 651 | 0 |
"""Test suite for the runtime profiler."""
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from pyperf.profilers import runtime
def test_runtime_gives_reasonable_results():
"""Ensure runtime is measured within s... | kevinconway/PyPerf | tests/profilers/test_runtime.py | Python | apache-2.0 | 672 | 0 |
#!/usr/bin/env python
from __future__ import unicode_literals
from prompt_toolkit import prompt
if __name__ == '__main__':
print('If you press meta-! or esc-! at the following prompt, you can enter system commands.')
answer = prompt('Give me some input: ', enable_system_bindings=True)
print('You said: %s'... | niklasf/python-prompt-toolkit | examples/system-prompt.py | Python | bsd-3-clause | 331 | 0.003021 |
'''Problem 25 from project Euler: 1000-digit Fibonacci number
https://projecteuler.net/problem=25'''
RESULT = 4782
def solve():
'''Main function'''
digits = 1000
fib1 = 1
fib2 = 1
nth = 2
top = 10 ** (digits - 1)
while fib2 < top:
fib1, fib2 = fib2, fib1 + fib2
nth += 1... | jorgemira/euler-py | p025.py | Python | apache-2.0 | 383 | 0.002611 |
import pi_time
from os import path
from autobahn.twisted.wamp import ApplicationSession
from autobahn.twisted.util import sleep
from autobahn.wamp.exception import ApplicationError
from twisted.internet.defer import inlineCallbacks
from twisted.python import log
from pi_time import settings
from pi_time.api import ... | si618/pi-time | pi_time/laptimer/laptimer/laptimer.py | Python | gpl-3.0 | 1,522 | 0.003285 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.