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 |
|---|---|---|---|---|---|---|
from __future__ import unicode_literals
#
# Copyright 2004 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
class NotDAG (Exception):
"""Not a directed acyclic graph"""
pass
class CantHappen (Exception):
"""Can't happen"""
pass
| jdemel/gnuradio | gnuradio-runtime/python/gnuradio/gr/exceptions.py | Python | gpl-3.0 | 311 | 0.006431 |
# -*- coding: utf-8 -*-
from stash.tests.stashtest import StashTestCase
class CowsayTests(StashTestCase):
"""tests for cowsay"""
def test_help(self):
"""test help output"""
output = self.run_command("cowsay --help", exitcode=0)
self.assertIn("cowsay", output)
self.assertIn("--... | ywangd/stash | tests/misc/test_cowsay.py | Python | mit | 2,613 | 0.001531 |
# Copyright 2013 Allen Institute
# This file is part of dipde
# dipde 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.
#
# dipde is di... | nicain/dipde_dev | dipde/internals/internalpopulation.py | Python | gpl-3.0 | 20,747 | 0.010604 |
# -*- coding: utf-8 -*-
# Copyright 2018 Novo Nordisk Foundation Center for Biosustainability,
# Technical University of Denmark.
#
# 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... | opencobra/memote | src/memote/experimental/growth.py | Python | apache-2.0 | 2,835 | 0.000353 |
# -*- coding: utf-8 -*-
#!/usr/bin/python
# Author: Tania M. Molina
# UY - 2017
# MIT License
import math
import numpy as np
import pandas as pd
from scipy import stats
from scipy.stats import norm
import scipy.stats as stats
import scipy.stats as st
import matplotlib
import matplotlib.pyplot as plt
import re
import sc... | lastralab/Statistics | Specialization/Personal/Rtopy.py | Python | mit | 484 | 0.002066 |
import os
import unittest
import numpy as np
from tfsnippet.examples.utils import MLResults
from tfsnippet.utils import TemporaryDirectory
def head_of_file(path, n):
with open(path, 'rb') as f:
return f.read(n)
class MLResultTestCase(unittest.TestCase):
def test_imwrite(self):
with Tempor... | korepwx/tfsnippet | tests/examples/utils/test_mlresult.py | Python | mit | 1,216 | 0 |
"""
Tests that ensure the correct items are returned from api calls.
Also tests whether the users with permissions can create logs.
"""
import csv
import datetime
import uuid
from django.core.urlresolvers import reverse
from rest_framework import status
from rest_framework.test import APITestCase
from kolibri.auth.mo... | 66eli77/kolibri | kolibri/logger/test/test_api.py | Python | mit | 13,270 | 0.003693 |
# -*- coding: utf-8 -*-
"""
Django settings for {{cookiecutter.project_name}} project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
# Build paths inside the pro... | benregn/cookiecutter-django-ansible | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/settings.py | Python | bsd-3-clause | 15,037 | 0.001796 |
# Copyright (c) 2016 Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | openstack/rally | rally/common/db/migrations/env.py | Python | apache-2.0 | 1,541 | 0 |
from ctypes import c_float, cast, POINTER
import numpy as np
import OpenGL.GL as gl
import openvr
from openvr.gl_renderer import OpenVrFramebuffer as OpenVRFramebuffer
from openvr.gl_renderer import matrixForOpenVrMatrix as matrixForOpenVRMatrix
from openvr.tracked_devices_actor import TrackedDevicesActor
import g... | jzitelli/python-gltf-experiments | OpenVRRenderer.py | Python | mit | 4,971 | 0.004828 |
from __future__ import annotations
import collections
from datetime import timedelta
import functools
import gc
import json
import operator
import pickle
import re
from typing import (
TYPE_CHECKING,
Any,
AnyStr,
Callable,
Hashable,
Literal,
Mapping,
Sequence,
cast,
overload,
)
... | gfyoung/pandas | pandas/core/generic.py | Python | bsd-3-clause | 387,628 | 0.000689 |
'''OpenGL extension ARB.robustness_application_isolation
This module customises the behaviour of the
OpenGL.raw.WGL.ARB.robustness_application_isolation to provide a more
Python-friendly API
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/ARB/robustness_application_... | stack-of-tasks/rbdlpy | tutorial/lib/python2.7/site-packages/OpenGL/WGL/ARB/robustness_application_isolation.py | Python | lgpl-3.0 | 867 | 0.008074 |
"""
Database ORM models managed by this Django app
Please do not integrate directly with these models!!! This app currently
offers one programmatic API -- api.py for direct Python integration.
"""
import re
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.translation i... | edx/edx-organizations | organizations/models.py | Python | agpl-3.0 | 2,793 | 0.002148 |
import keras | jadsonjs/DataScience | DeepLearning/keras/hello_world.py | Python | apache-2.0 | 12 | 0.083333 |
# Copyright 2014 Intel Corp.
#
# Author: Zhai Edwin <edwin.zhai@intel.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 requi... | froyobin/ceilometer | ceilometer/tests/ipmi/test_manager.py | Python | apache-2.0 | 1,263 | 0 |
#!/usr/bin/env python3
"""
Copyright 2017 Jocelyn Falempe kdj0c@djinvi.net
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, cop... | kdj0c/onepagepoints | onepagebatch.py | Python | mit | 17,621 | 0.002213 |
from lfmconf.lfmconf import get_lastfm_conf
query_play_count_by_month = """
select * from view_play_count_by_month v
where substr(v.yr_month, 1, 4) =
"""
query_top_with_remaining = """
with top as (
{query_top}
),
total_count as (
{query_play_count}
)
select t.*
from t... | nicolasm/lastfm-export | queries/tops.py | Python | mit | 6,184 | 0.000809 |
from utils.strings import quote
from plugins.languages import javascript
from utils.loggers import log
from utils import rand
import base64
import re
class Dot(javascript.Javascript):
def init(self):
self.update_actions({
'render' : {
'render': '{{=%(code)s}}',
... | epinna/tplmap | plugins/engines/dot.py | Python | gpl-3.0 | 2,139 | 0.013558 |
'''Dirty talk like you're in Dundalk'''
import random
import re
import string
__author__ = ('iandioch')
COMMAND = 'flirt'
PHRASES = [
"rawr~, {s}{sep}",
"{s}, big boy{sep}",
"{s} xo",
"{s} bb{sep}",
"babe, {s}{sep}",
"hey xxx {s}{sep}",
"{s} xxx",
"{s} xx",
"{s} xo",
"{s} xoxo... | sentriz/steely | steely/plugins/flirty.py | Python | gpl-3.0 | 1,575 | 0.001297 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2014, 2015 CERN.
#
# Invenio 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... | tiborsimko/invenio-ext | invenio_ext/jasmine/registry.py | Python | gpl-2.0 | 2,838 | 0.000705 |
# 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... | Huyuwei/tvm | tests/python/relay/test_vm.py | Python | apache-2.0 | 17,272 | 0.003648 |
#
# Contain the transformation procedure
#
import sys
import module.loop.ast
#-----------------------------------------
def __makeForLoop(id, lbound, ubound, stride, loop_body):
'''Generate a for loop:
for (id=lbound; id<=ubound; id=id+stride)
loop_body'''
init_exp = None
test_exp = ... | tajkhan/pluto-pocc | annotations/module/loop/submodule/permut/transformator.py | Python | gpl-3.0 | 4,926 | 0.003857 |
import unittest
from django.test.client import Client
from django.forms import ValidationError
from fields import MultipleEmailField
class CaseTests(unittest.TestCase):
def setUp(self):
self.c = Client()
self.case_id = 12345
self.status_codes = [301, 302]
def test_cases(self):
... | ShaolongHu/Nitrate | tcms/testcases/tests.py | Python | gpl-2.0 | 5,924 | 0 |
"""
Shogun demo
Fernando J. Iglesias Garcia
This example shows the use of dimensionality reduction methods, mainly
Stochastic Proximity Embedding (SPE), although Isomap is also used for
comparison. The data selected to be embedded is an helix. Two different methods
of SPE (global and local) are applied showing that t... | AzamYahya/shogun | examples/undocumented/python_modular/graphical/converter_spe_helix.py | Python | gpl-3.0 | 2,562 | 0.007026 |
#!/usr/bin/python
import computefarm as cf
from computefarm.farm import depth_first, breadth_first
import random
import logging
import numpy as np
HOUR = 60 * 60
default_queue_properties = {
'grid': { 'num': 0, 'mem': 750, 'avg': HOUR, 'std': 0.6 * HOUR},
'prod': { 'num': 0, 'avg': 8 * HOUR, 'std... | fubarwrangler/atlassim | simulation.py | Python | gpl-2.0 | 6,264 | 0.003033 |
# Note: Modified by Neui (Note: sphinx.util.compat.Directive is deprecated)
#
# Copyright (C) 2011 by Matteo Franchin
#
# This file 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... | vhelin/wla-dx | doc/sphinx/globalindex.py | Python | gpl-2.0 | 2,896 | 0.002762 |
# coding: utf-8
"""
MINDBODY Public API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
impor... | mindbody/API-Examples | SDKs/Python/swagger_client/models/resource.py | Python | bsd-2-clause | 3,703 | 0.00027 |
from django.utils import unittest
from django.contrib import admin
from hyperadmin.sites import ResourceSite
class SiteTestCase(unittest.TestCase):
def test_install_from_admin_site(self):
site = ResourceSite()
admin.autodiscover()
site.install_models_from_site(admin.site)
... | webcube/django-hyperadmin | hyperadmin/tests/test_sites.py | Python | bsd-3-clause | 360 | 0.008333 |
# Copyright (c) 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 applica... | openstack-infra/project-config | tools/projectconfig_ruamellib.py | Python | apache-2.0 | 1,722 | 0 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unit tests for gclient.py.
See gclient_smoketest.py for integration tests.
"""
import Queue
import copy
import logging
import ... | primiano/depot_tools | tests/gclient_test.py | Python | bsd-3-clause | 36,329 | 0.003854 |
"""
Tests for classes extending Field.
"""
# Allow accessing protected members for testing purposes
# pylint: disable=W0212
from mock import Mock
import unittest
import datetime as dt
import pytz
import warnings
import math
import textwrap
import itertools
from contextlib import contextmanager
import ddt
from xblo... | GbalsaC/bitnamiP | XBlock/xblock/test/test_fields.py | Python | agpl-3.0 | 26,030 | 0.000845 |
# -*- coding: utf-8 -*-
# (c) 2015 Antiun Ingeniería S.L. - Pedro M. Baeza
# (c) 2015 AvanzOSC - Ainara Galdona
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0
{
"name": "AEAT - Prorrata de IVA",
"version": "8.0.2.0.0",
"license": "AGPL-3",
"author": "AvanzOSC, "
"Antiun Ingen... | Endika/l10n-spain | l10n_es_aeat_vat_prorrate/__openerp__.py | Python | agpl-3.0 | 812 | 0 |
# Copyright (C) 2010 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | mogoweb/webkit_for_android5.1 | webkit/Source/WebKit2/Scripts/webkit2/messages_unittest.py | Python | apache-2.0 | 24,676 | 0.002432 |
# -*- coding: utf-8 -*-
##
## test_account.py
## Login : <dax@happycoders.org>
## Started on Wed Feb 14 08:23:17 2007 David Rousselie
## $Id$
##
## Copyright (C) 2007 David Rousselie
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as publi... | dax/jmc | src/jmc/model/tests/account.py | Python | gpl-2.0 | 54,705 | 0.007502 |
#!/usr/bin/env python
# -*- coding: utf-8
import sys
import argparse
from ete3 import Tree
import anvio.db as db
import anvio.utils as utils
import anvio.terminal as terminal
from anvio.errors import ConfigError
run = terminal.Run()
progress = terminal.Progress()
current_version, next_version = [x[1:] for x in __n... | merenlab/anvio | anvio/migrations/profile/v26_to_v27.py | Python | gpl-3.0 | 2,866 | 0.007676 |
import numpy as np
import warnings
def mean_time(t, min_threshold=0, max_threshold=1253):
"""
Take a switch probability result array from the PreAmp timer, and
compute mean switching time using the specified thresholds. Timing
data is assumed to be a numpy array.
"""
t = t[np.logical_and(t... | McDermott-Group/LabRAD | LabRAD/Measurements/General/data_processing.py | Python | gpl-2.0 | 2,679 | 0.008959 |
from edge import DummyEdgeEnd
from simulation_event import AbstractSimulationEvent
from stats import TripStats
class AbstractAntMove(AbstractSimulationEvent):
def __init__(self, ant, origin, destination, end_time, pheromone_to_drop, trip_stats):
self.ant = ant
self.origin = origin
self.dest... | ppolewicz/ant-colony | antcolony/ant_move.py | Python | bsd-3-clause | 3,648 | 0.006853 |
'''
from https://docs.djangoproject.com/en/1.7/topics/auth/customizing/#specifying-a-custom-user-model
'''
from django import forms
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.forms import ReadOnlyPasswordHashField
from django.utils.translation import gette... | JustinWingChungHui/okKindred | custom_user/admin.py | Python | gpl-2.0 | 3,150 | 0.00381 |
# coding: utf-8
__author__ = "@strizhechenko"
import sys
from morpher import Morpher
from twitterbot_utils import Twibot
from apscheduler.schedulers.blocking import BlockingScheduler
sched = BlockingScheduler()
bot = Twibot()
morphy = Morpher()
def tweets2words(tweets):
string = " ".join([tweet.text for tweet ... | strizhechenko/twitterbots | memes_zaebali.py | Python | gpl-3.0 | 857 | 0.001167 |
"""Modify Group Entry Message."""
from enum import IntEnum
from pyof.foundation.base import GenericMessage
from pyof.foundation.basic_types import (
FixedTypeList, Pad, UBInt8, UBInt16, UBInt32)
from pyof.v0x04.common.header import Header, Type
from pyof.v0x04.controller2switch.common import Bucket
__all__ = ('Gr... | cemsbr/python-openflow | pyof/v0x04/controller2switch/group_mod.py | Python | mit | 2,734 | 0 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# LICENSE
#
# Copyright (c) 2015 GEM Foundation
#
# The Catalogue Toolkit 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, either ... | g-weatherill/catalogue_toolkit | eqcat/catalogue_query_tools.py | Python | agpl-3.0 | 60,867 | 0.001824 |
import socket
from subprocess import Popen, PIPE, STDOUT
import os
import time
import string
import requests
import json
import omxplayer
class UnsupportedFileTypeException(Exception):
'''Raised if the file type is not among the list of supported types'''
pass
class FileNotFoundException(Exception):
'''... | nakamura9/deploy_ad_server | client/omxplayer/myomx.py | Python | mit | 4,075 | 0.004663 |
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.rl_config import defaultPageSize
from reportlab.lib.units import cm
import operator
import os
import ConfigParser
import string
config = ConfigP... | andydrop/x17papertrail | abook2pdf.py | Python | gpl-3.0 | 3,106 | 0.027688 |
import sqlite3
class Database:
def __init__(self, dbfile, page_rows=100):
self.dbfile = dbfile
self.page_rows = page_rows
self.conn = sqlite3.connect(self.dbfile)
self.conn.row_factory = sqlite3.Row
cursor = self.conn.cursor()
cursor.execute(
"CREATE TAB... | ant9000/websup | cli/db.py | Python | gpl-3.0 | 1,581 | 0.003163 |
from flask import Flask
from os.path import expanduser
def create_app():
app = Flask(__name__)
app.config.from_pyfile(expanduser('~/.directory-tools.py'))
from directory_tools.frontend import frontend
app.register_blueprint(frontend)
return app
| FunTimeCoding/directory-tools | directory_tools/application.py | Python | mit | 269 | 0 |
import array
class vec(object):
@staticmethod
def sized(size, type='d'):
return vec([0] * size, type)
@staticmethod
def of(content, type='d'):
return vec(content, type)
def __init__(self, content, type='d'):
self.size = len(content)
self.type = type
self.a... | planrich/pypy-simd-benchmark | vec.py | Python | gpl-3.0 | 1,851 | 0.002161 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2013 PolyBeacon, 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... | gorocacher/payload | payload/api/config.py | Python | apache-2.0 | 954 | 0 |
#!/usr/bin/env python
"""
$ python cmdln_main2.py
This is my shell.
$ python cmdln_main2.py foo
hello from foo
"""
import sys
import cmdln
class Shell(cmdln.RawCmdln):
"This is my shell."
name = "shell"
def do_foo(self, argv):
print("hello from foo")
if __name__ == "__main__":
... | hfeeki/cmdln | test/cmdln_main2.py | Python | mit | 421 | 0.011876 |
# coding: utf-8
from libs.redis_storage import db1
class User(object):
def __init__(self, **kwargs):
pk = kwargs.get('pk') or db1.incr('new_user_id')
kwargs['pk'] = pk
db1.hmset('user::{}'.format(pk), kwargs)
super(User, self).__setattr__('pk', pk)
super(User, self).__seta... | beslave/space-king | space_king/models/user.py | Python | gpl-3.0 | 1,986 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import cherrypy
import htpc
import logging
import requests
from cherrypy.lib.auth2 import require, member_of
from urllib import urlencode
from json import loads
from htpc.helpers import get_image, serve_template, fix_basepath
from StringIO import StringIO
from contextlib ... | scith/htpc-manager_ynh | sources/modules/mylar.py | Python | gpl-3.0 | 9,922 | 0.001008 |
"""Custom keras layers
"""
# Coding: utf-8
# File name: custom_layer.py
# Created: 2016-07-24
# Description:
## v0.0: File created. MergeRowDot layer.
from __future__ import division
from __future__ import print_function
__author__ = "Hoang Nguyen"
__email__ = "hoangnt@ai.cs.titech.ac.jp"
from keras import backend a... | gear/motifwalk | research/src/mane/custom_layers.py | Python | mit | 1,273 | 0.013354 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | chuckchen/spark | python/pyspark/pandas/tests/data_type_ops/test_complex_ops.py | Python | apache-2.0 | 13,290 | 0.002859 |
# -*- encoding: 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 G... | shingonoide/odoo | addons/account_asset/account_asset.py | Python | agpl-3.0 | 29,332 | 0.008557 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Pu... | sysadminmatmoz/ingadhoc | stock_multic_fix/__openerp__.py | Python | agpl-3.0 | 1,568 | 0.001276 |
from button import Button
class SellButton(Button):
def __init__(self, image, x, y, parent):
super(SellButton, self).__init__(image, x, y, parent)
def get_clicked(self):
self.parent.sell_tower() | ToBaer94/PygameTowerDefense | buttons/sell_button.py | Python | lgpl-3.0 | 221 | 0.004525 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-domains | samples/generated_samples/domains_v1_generated_domains_delete_registration_sync.py | Python | apache-2.0 | 1,539 | 0.00065 |
"""Defines chart-wide shared test fixtures."""
import numpy as np
import pandas as pd
import pytest
from bokeh.sampledata.autompg import autompg
class TestData(object):
"""Contains properties with easy access to data used across tests."""
def __init__(self):
self.cat_list = ['a', 'c', 'a', 'b']
... | htygithub/bokeh | bokeh/charts/conftest.py | Python | bsd-3-clause | 1,071 | 0.000934 |
#!/usr/bin/env python
import asyncio
import os
import signal
import websockets
async def echo(websocket):
async for message in websocket:
await websocket.send(message)
async def main():
# Set the stop condition when receiving SIGTERM.
loop = asyncio.get_running_loop()
stop = loop.create_fu... | aaugustin/websockets | example/deployment/haproxy/app.py | Python | bsd-3-clause | 616 | 0 |
#! /usr/bin/env python
# Print digits of pi forever.
#
# The algorithm, using Python's 'long' integers ("bignums"), works
# with continued fractions, and was conceived by Lambert Meertens.
#
# See also the ABC Programmer's Handbook, by Geurts, Meertens & Pemberton,
# published by Prentice-Hall (UK) Ltd., 1990.
import... | MicroTrustRepos/microkernel | src/l4/pkg/python/contrib/Demo/scripts/pi.py | Python | gpl-2.0 | 928 | 0.005388 |
"""
Views related to the video upload feature
"""
from boto import s3
import csv
from uuid import uuid4
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, HttpResponseNotFound
from django.utils.translation import ugettext as _, ugettext_noop... | mtlchun/edx | cms/djangoapps/contentstore/views/videos.py | Python | agpl-3.0 | 12,550 | 0.001594 |
import click
from do_cli.contexts import CTX
from do_cli.commands.common import host_commands
@click.command('list')
@click.option('-f', '--force-refresh', is_flag=True, help='Pull data from the API')
@click.option('-h', '--host-names', help='Comma separated list of host names')
@CTX
def cli(ctx, force_refresh, host_... | meganlkm/do-cli | do_cli/commands/cmd_list.py | Python | mit | 689 | 0.001451 |
import base64
import csv
import io
import multiprocessing
import numpy as np
import sys
from collections import defaultdict
from io import StringIO
from pathlib import Path
# Import matplotlib ourselves and make it use agg (not any GUI anything)
# before the analyze module pulls it in.
import matplotlib
matplotlib.use... | liffiton/ATLeS | src/web/controller_analyze.py | Python | mit | 6,534 | 0.00153 |
# project/models.py
from project import db
from project.uuid_gen import id_column
class Payment(db.Model):
id = id_column()
email = db.Column(db.String(255), unique=False, nullable=False)
names = db.Column(db.String(255), unique=False, nullable=False)
cardNumber = db.Column(db.String(255), unique=Fals... | fiston/abaganga | project/payment/models.py | Python | mit | 932 | 0.001073 |
##############################################################################
# Copyright (c) 2015 Huawei Technologies Co.,Ltd. and others
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, ... | dtudares/hello-world | yardstick/yardstick/benchmark/scenarios/availability/monitor/monitor_command.py | Python | apache-2.0 | 3,388 | 0 |
#coding=utf-8
from selenium import webdriver
import pymysql
import unittest,time
from selenium.webdriver.common.keys import Keys
print("test36")
wf = webdriver.Firefox()
mark_01=0
n=0
wf.get("http://192.168.17.66:8080/LexianManager/html/login.html")
wf.find_element_by_xpath(".//*[@id='login']").click()
time.sleep(1)
w... | Singularmotor/auto_test_lexian | auto_test_lexian/test_case/delaytest_38.py | Python | mit | 544 | 0.012868 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2013 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual 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 L... | iwm911/plaso | plaso/formatters/android_calls.py | Python | apache-2.0 | 1,199 | 0.005004 |
# Copyright 2021 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... | chromium/chromium | third_party/tflite_support/src/tensorflow_lite_support/examples/task/text/desktop/python/bert_nl_classifier_demo.py | Python | bsd-3-clause | 1,817 | 0.003853 |
# [1] https://doi.org/10.1016/0009-2614(91)90115-P
# Helgaker, 1991
import numpy as np
from scipy.optimize import newton
from pysisyphus.tsoptimizers.TSHessianOptimizer import TSHessianOptimizer
class TRIM(TSHessianOptimizer):
def optimize(self):
energy, gradient, H, eigvals, eigvecs, resetted = s... | eljost/pysisyphus | pysisyphus/tsoptimizers/TRIM.py | Python | gpl-3.0 | 1,861 | 0.001075 |
class Node:
def __init__(self,val):
self.value = val
self.nextNode = None
def getValue(self):
return self.value
def getNextNode(self):
return self.nextNode
def setValue(self,val):
self.value = val
def setNextNode(self,nxtNode):
self.nextNode = n... | njanirudh/Python-DataStructures | linked_list.py | Python | mit | 2,365 | 0.009334 |
from flask.ext.flails import FlailsView
from flask import render_template, redirect, url_for, request
#from config import db
import models
import forms
class PrivatePostView(FlailsView):
def private_post_index(self):
object_list = models.Post.query.all()
return render_template('post/index.slim', ob... | thrisp/flails | tests/test_app/blueprints/private/views.py | Python | mit | 2,266 | 0.005296 |
from flask import Response
from flask.views import View
from bson import json_util
from mcp import mongo
class Map(View):
def dispatch_request(self, komuna, viti):
json = mongo.db.procurements.aggregate([
{
"$match": {
"komuna.slug": komuna,
... | opendatakosovo/municipality-procurement-api | mcp/views/map.py | Python | gpl-2.0 | 4,266 | 0.000703 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | markflyhigh/incubator-beam | sdks/python/apache_beam/transforms/window.py | Python | apache-2.0 | 18,159 | 0.007324 |
#!/usr/bin/env python
# import all needed libraries
import sys
import time
import sockjs.tornado
from tornado import web, ioloop
from sockjs.tornado import SockJSRouter, SockJSConnection
import pigpio
import subprocess
import os
import signal
from thread import start_new_thread
import random
import colorsys
import pya... | karaambaa/RGB-LED-Server | server.py | Python | apache-2.0 | 15,826 | 0.006824 |
from time import time
from benchmark import Benchmark
from optimizer.optimizer import Optimizer
from optimizer.simulator import Simulator
from optimizer.evaluator import Evaluator
from extra.printer import pprint, BLUE
class EvaluatorPerf(Benchmark):
def __init__(self, plant, orderList, testNumber):
Benchmark.__... | fredmorcos/attic | projects/plantmaker/plantmaker-main/src/benchmark/evaluatorperf.py | Python | isc | 3,570 | 0.020728 |
# -*- coding: utf-8 -*-
import os
from setuptools import setup, find_packages
EXCLUDE_FROM_PACKAGES = ['test_*',]
VERSION = "1.1.0"
INSTALL_REQUIRES = [
'requests',
'Flask'
]
TESTS_REQUIRE = [
'nose',
'httpretty'
]
setup(
name='Flask-HTTP-Forwarding',
version=VERSION,
url='http://www.gi... | casetext/flask-http-forwarding | setup.py | Python | mit | 1,109 | 0.000902 |
# Copyright 2014 Ahmet Cetinkaya
# This file is part of pastefromhtml.
# pastefromhtml 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.... | cetinkaya/pastefromhtml | htmlcdparser.py | Python | gpl-3.0 | 19,903 | 0.006079 |
from setuptools import setup, find_packages
from helga_github_meta import __version__ as version
setup(
name='helga-github-meta',
version=version,
description=('Provide information for github related metadata'),
classifiers=[
'Development Status :: 4 - Beta',
'Topic :: Communications :... | narfman0/helga-github-meta | setup.py | Python | gpl-3.0 | 1,198 | 0 |
from django.contrib import admin
from library.models import Author, Book, Genre, Review
admin.site.register(Author)
admin.site.register(Book)
admin.site.register(Genre)
admin.site.register(Review)
| Nocks/ReadBooks | library/admin.py | Python | mit | 199 | 0 |
# -*- coding: utf-8 -*-
"""
Largest product in a grid
https://projecteuler.net/problem=11
"""
GRID = """
08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00
81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65
52 70 95 23 04 60 11 42 69 24 68 56... | kulapard/projecteuler.net | python/problem_11.py | Python | mit | 2,670 | 0.000749 |
from split_settings.tools import optional, include
include(
'components/base.py',
'components/pagination.py',
optional('components/global.py'),
##
# Local should be after product.py because if default value has not
# been defined in the DATABASE dictionary then it must be defined.
'compon... | testbed/testbed | testbed/db/djconfig/settings/__init__.py | Python | gpl-3.0 | 359 | 0.002786 |
"""
This integration tests will perform basic operations on a storage element, depending on which protocols are available.
It creates a local hierarchy, and then tries to upload, download, remove, get metadata etc
Potential problems:
* it might seem a good idea to simply add tests for the old srm in it. It is not :-)
... | fstagni/DIRAC | tests/Integration/Resources/Storage/Test_Resources_GFAL2StorageBase.py | Python | gpl-3.0 | 14,328 | 0.008305 |
# -*- coding:utf-8 -*-
import tornado.web
from wechatpy.parser import parse_message
from wechatpy import WeChatClient
TOKEN = '123456'
APPID = 'wxecb5391ec8a58227'
SECRET = 'fa32576b9daa6fd020c0104e6092196a'
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
class BaseHandler(object):
def get_client(self):
... | myyyy/wechatserver | wechatclient/test/test.py | Python | mit | 1,796 | 0.001134 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | var/spack/repos/builtin/packages/prodigal/package.py | Python | lgpl-2.1 | 1,761 | 0.000568 |
import os
import pytest
import responses
from datetime import date
from datetime import datetime
from datetime import timedelta
from urllib.parse import parse_qs
from urllib.parse import urlparse
from django.conf import settings
from django.utils import timezone
from backend.citeproc import CiteprocError
from backe... | wetneb/dissemin | backend/tests/test_citeproc.py | Python | agpl-3.0 | 26,785 | 0.003136 |
# Copyright 2020 The Pigweed 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | google/pigweed | pw_tokenizer/py/pw_tokenizer/__main__.py | Python | apache-2.0 | 687 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("migrations", "0002_second")]
operations = [
migrations.CreateModel(
"OtherAuthor",
[
("id", mode... | DONIKAN/django | tests/migrations2/test_migrations_2/0001_initial.py | Python | bsd-3-clause | 627 | 0 |
#!/usr/bin/env python3
import os, sys, signal, argparse, configparser, traceback, time
from contextlib import closing
from ananas import PineappleBot
import ananas.default
# Add the cwd to the module search path so that we can load user bot classes
sys.path.append(os.getcwd())
bots = []
def shutdown_all(signum, fram... | Chronister/ananas | ananas/run.py | Python | mit | 2,535 | 0.007495 |
#!/usr/bin/env python
"""
Copyright (c) 2020 Alex Forencich
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, merg... | alexforencich/verilog-ethernet | tb/eth_mac_1g_gmii_fifo/test_eth_mac_1g_gmii_fifo.py | Python | mit | 7,506 | 0.001066 |
# -*- coding: utf-8 -*-
from celery import Celery
from server import config
""" Celery configuration module.
"""
def make_celery(app):
""" Flask integration with celery. Taken from
http://flask.pocoo.org/docs/0.12/patterns/celery/
"""
celery = Celery(app.import_name, backend=config.CELERY_RESULT_BA... | abhishekpathak/recommendation-system | recommender/server/settings/celery_conf.py | Python | mit | 695 | 0.001439 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-09-15 15:28
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('silo', '0029_auto_20170915_0810'),
]
operations = ... | mercycorps/TolaTables | silo/migrations/0030_auto_20170915_0828.py | Python | gpl-2.0 | 1,103 | 0.00272 |
# Copyright (c) 2008 Mikeal Rogers
#
# 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 agre... | synergeticsedx/deployment-wipro | common/djangoapps/edxmako/shortcuts.py | Python | agpl-3.0 | 7,383 | 0.00149 |
import random
import re
import vsphere_inventory as vsphere
from os.path import join, dirname
try:
import json
except ImportError:
import simplejson as json
def readNamesFrom(filepath):
with open(filepath) as f:
return f.readlines()
def randomName(lefts, rights):
left = random.choice(lefts).... | lymingtonprecision/maat | ansible/name_generator.py | Python | mit | 1,321 | 0.004542 |
# -*- coding: utf-8 -*-
#
# This file is part of PyGaze - the open-source toolbox for eye tracking
#
# PyGaze is a Python module for easily creating gaze contingent experiments
# or other software (as well as non-gaze contingent experiments/software)
# Copyright (C) 2012-2013 Edwin S. Dalmaijer
#
# ... | esdalmaijer/PyGaze | pygaze/libsound.py | Python | gpl-3.0 | 1,025 | 0 |
# Autogenerated with SMOP version 0.23
# main.py ../../assessing-mininet/MATLAB/load_function.m ../../assessing-mininet/MATLAB/process_complete_test_set.m ../../assessing-mininet/MATLAB/process_single_testfile.m ../../assessing-mininet/MATLAB/ProcessAllLogsMain.m
from __future__ import division
from numpy import arang... | yossisolomon/assessing-mininet | matlab-to-python.py | Python | gpl-2.0 | 7,459 | 0.024668 |
"""
Plugin for ResolveURL
Copyright (C) 2020 gujal
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed... | dknlght/dkodi | src/script.module.resolveurl/lib/resolveurl/plugins/oogly.py | Python | gpl-2.0 | 1,391 | 0.001438 |
from audio_pipeline.util import Tag
import re
from audio_pipeline.util import Exceptions
class BaseTag(Tag.Tag):
def extract(self):
super().extract()
if self._value is not None:
self._value = self._value[0]
def set(self, value=Tag.CurrentTag):
if value is not Tag.CurrentT... | hidat/audio_pipeline | audio_pipeline/util/format/Vorbis.py | Python | mit | 6,254 | 0.003997 |
from django.http import Http404
from django.shortcuts import render
from directory.forms import SearchForm
def home(request):
searchform = SearchForm()
return render(request, 'onigiri/index.html', {'searchform' : searchform})
| cloudiirain/onigiri | onigiri/views.py | Python | gpl-3.0 | 235 | 0.008511 |
#!/usr/bin/env python
from raspledstrip.ledstrip import *
from raspledstrip.animation import *
from raspledstrip.color import Color
import requests
import json
import time
import sys
import traceback
# Things that should be configurable
ledCount = 32 * 5
api = 'http://lumiere.lighting/'
waitTime = 6
class Lumiere:
... | lumiere-lighting/lumiere-node-raspberry-pi | lumiere.old.py | Python | mit | 2,222 | 0.011701 |
from django.test import TestCase, TransactionTestCase
from django.contrib.auth.models import Group, User
from django.http import HttpRequest, QueryDict
from hs_core.hydroshare import resource
from hs_core import hydroshare
from hs_script_resource.models import ScriptSpecificMetadata, ScriptResource
from hs_script_re... | hydroshare/hydroshare | hs_script_resource/tests/test_script_resource.py | Python | bsd-3-clause | 7,034 | 0.004265 |
"""
--- Day 25: The Halting Problem ---
Following the twisty passageways deeper and deeper into the CPU, you finally reach the core of the computer. Here, in the expansive central chamber, you find a grand apparatus that fills the entire room, suspended nanometers above your head.
You had always imagined CPUs to be ... | bbglab/adventofcode | 2017/iker/day25.py | Python | mit | 7,429 | 0.002692 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.