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 |
|---|---|---|---|---|---|---|
#! /usr/bin/env python
# State machine for tortuga 2016 competition
# States given by kanga can be found at: imgur.com/C5KLSCJ
import roslib; roslib.load_manifest('smach')
import rospy
import smach
import smach_ros
#TODO
class gate_search(smach.State):
def __init__(self):
smach.State.__init__(self,
... | robotics-at-maryland/qubo | src/autonomy/src/tortuga_states.py | Python | mit | 3,069 | 0.018573 |
#!/usr/bin/env python
# Copyright (C) 2006-2021 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia 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 (FSF), e... | MTG/essentia | test/src/unittests/temporal/test_effectiveduration.py | Python | agpl-3.0 | 2,995 | 0.004341 |
#
# Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
#
# 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; version 2 of the License.
#
# This program is distributed in th... | mysql/mysql-utilities | mysql/utilities/command/rpl_admin.py | Python | gpl-2.0 | 45,372 | 0.000242 |
# -*- coding: utf-8 -*-
#########################################################################
## This scaffolding model makes your app work on Google App Engine too
#########################################################################
if request.env.web2py_runtime_gae: # if running on Google App E... | google-code/ampatu | models/db.py | Python | agpl-3.0 | 4,254 | 0.010343 |
#!/usr/bin/env python3
# Copyright (c) 2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import ComparisonTestFramework
from test_framework.util import *
from test_... | sinraf96/electrum | qa/rpc-tests/bip9-softforks.py | Python | mit | 9,959 | 0.004519 |
## begin license ##
#
# "Meresco Lucene" is a set of components and tools to integrate Lucene into Meresco
#
# Copyright (C) 2013-2016, 2019-2021 Seecr (Seek You Too B.V.) https://seecr.nl
# Copyright (C) 2013-2014 Stichting Bibliotheek.nl (BNL) http://www.bibliotheek.nl
# Copyright (C) 2015-2016, 2019 Koninklijke Bibl... | seecr/meresco-lucene | meresco/lucene/composedquery.py | Python | gpl-2.0 | 11,941 | 0.003015 |
# -*- 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-analytics-admin | samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_approve_display_video360_advertiser_link_proposal_sync.py | Python | apache-2.0 | 1,697 | 0.002946 |
# -*- encoding:utf-8 -*-
from network.protocol import protocol, pdef, pret
class GameToGame:
create_stub_proxy = protocol(
pdef('Eid', 'eid'),
pdef('Str', 'name'),
pdef('Int', 'gameid'),
)
entity_msg = protocol(
pdef('Eid', 'eid'),
pdef('Bytes', 'data'),
)
entity_msg_with_return = protocol(
pdef('E... | dennisding/ether | protocols/game_to_game.py | Python | apache-2.0 | 472 | 0.040254 |
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 15 15:55:28 2013
@author: dyanna
"""
import numpy as np
from sklearn.svm import SVC
def getSample(pointA, pointB, numberOfPoints):
pointList = list(zip(np.random.uniform(-1,1.00,numberOfPoints),np.random.uniform(-1,1.00,numberOfPoints)))
sample = np.array([(i[0]... | pramodh-bn/learn-data-edx | Week 7/qp.py | Python | unlicense | 6,393 | 0.020178 |
""" An external application for performing the update after is was downloaded
from the net. This file is compiled into an exe file for windows platform
and launch when the ApplyUpdate method of WinUpdater is called.
The module will extract the zip file if it exists, and execute the update
manifest... | yosi-dediashvili/SubiT | src/Settings/Updaters/WinUpdaterHelper.py | Python | gpl-3.0 | 5,462 | 0.005859 |
import random
class fortunes:
def on_pubmsg(self, nick, connection, event):
message = event.arguments()[0]
source = event.source().split('!')[0]
if message.startswith(".fortune"):
fortunestxt = open("modules/pubmsg/fortunes", 'r')
fortuneslist = fortunestxt.read().splitlines()
response = ran... | Oozemeister/Gypsy | modules/pubmsg/fortunes.py | Python | gpl-2.0 | 393 | 0.020356 |
# -*- coding: utf-8 -*-
"""
Identification of spectral properties in analog signals (e.g., the power
spectrum).
:copyright: Copyright 2015-2016 by the Elephant team, see AUTHORS.txt.
:license: Modified BSD, see LICENSE.txt for details.
"""
import warnings
import numpy as np
import scipy.signal
import scipy.fftpack a... | Junji110/elephant | elephant/spectral.py | Python | bsd-3-clause | 20,790 | 0.000192 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_jetstream
----------------------------------
Tests for `jetstream` module.
"""
import unittest
from jetstream import jetstream
class TestJetstream(unittest.TestCase):
def setUp(self):
pass
def test_something(self):
pass
def tear... | koodaamo/jetstream | tests/test_jetstream.py | Python | gpl-3.0 | 392 | 0.005102 |
#!/usr/bin/env python
# This file is part of OpenGossip.
#
# This program 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 Software Foundation, either version 3 of the License, or (at your
# option) any later version. This... | adrien-mogenet/opengossip | src/python/analyzer/hierarchical-clustering.py | Python | gpl-3.0 | 7,280 | 0.001099 |
from lxml import etree
from healthvaultlib.utils.xmlutils import XmlUtils
from healthvaultlib.itemtypes.healthrecorditem import HealthRecordItem
class Medication(HealthRecordItem):
def __init__(self, thing_xml=None):
super(Medication, self).__init__()
self.type_id = '30cafccc-047d-4288-94ef-6435... | rajeevs1992/pyhealthvault | src/healthvaultlib/itemtypes/medication.py | Python | mit | 865 | 0 |
"""
example with 'calls_expected' in addtoBatch used
"""
import batchOpenMPI
def f_mult(x) :
return x*2.0
f = batchOpenMPI.batchFunction(f_mult) #creating function wrapper
batchOpenMPI.begin_MPI_loop() # both the workers and the master process run the same code up until here
f.addtoBatch(4,calls_expected=4)
bat... | hamish2014/batchOpenMPI | examples/ex3.py | Python | mit | 719 | 0.027816 |
# -*- coding: utf-8 -*-
"""
Started on mon, apr 23rd, 2018
@author: carlos.arana
"""
# Librerias utilizadas
import pandas as pd
import sys
module_path = r'D:\PCCS\01_Dmine\Scripts'
if module_path not in sys.path:
sys.path.append(module_path)
from VarInt.VarInt import VarInt
from classes.Meta import Meta
from Com... | Caranarq/01_Dmine | 04_Edificaciones/P0406/P0406.py | Python | gpl-3.0 | 2,794 | 0.006102 |
# Copyright 2020 Deepmind Technologies Limited.
#
# 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 agr... | deepmind/deepmind-research | catch_carry/trajectories.py | Python | apache-2.0 | 8,650 | 0.00659 |
import requests
import urllib
from bountyfunding.core.config import config
from bountyfunding.core.models import db, Payment
from bountyfunding.core.const import PaymentGateway
from bountyfunding.core.errors import Error
from bountyfunding.core.payment import get_paypal_url
class PayPalStandardGateway:
def cre... | bountyfunding/bountyfunding | bountyfunding/core/payment/paypal_standard.py | Python | agpl-3.0 | 2,667 | 0.003 |
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | thenenadx/forseti-security | tests/common/gcp_api/compute_test.py | Python | apache-2.0 | 1,822 | 0 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cint
def execute(filters=None):
if not filters: filters ={}
days_since_last_order = filters.get("days_... | gangadhar-kadam/nassimapp | selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.py | Python | agpl-3.0 | 1,985 | 0.039798 |
# -*- coding: utf-8 -*-
# Amara, universalsubtitles.org
#
# Copyright (C) 2013 Participatory Culture Foundation
#
# 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, either version 3 of the
#... | ujdhesa/unisubs | utils/testeditor.py | Python | agpl-3.0 | 5,102 | 0.000392 |
#!/usr/bin/env python3
from setuptools import setup, find_packages
def get_readme():
with open("README.md") as f:
return f.read()
setup(name="Flask-API",
version="0.1",
description=("A library for Flask that provides a basic barebones web "
"API to be used and extended.")... | adamcunnington/Flask-API | setup.py | Python | gpl-3.0 | 1,574 | 0 |
# Import the agent class
from .devicemanager import DeviceManager
| Homebrain/Homebrain | homebrain/agents/devicemanager/__init__.py | Python | mit | 66 | 0 |
import _plotly_utils.basevalidators
class HoverlabelValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="hoverlabel", parent_name="scatterpolar", **kwargs):
super(HoverlabelValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_... | plotly/python-api | packages/python/plotly/plotly/validators/scatterpolar/_hoverlabel.py | Python | mit | 2,061 | 0.000485 |
from tools.load import LoadMatrix
from numpy import random
lm=LoadMatrix()
N = 100
random.seed(17)
ground_truth = abs(random.randn(N))
predicted = abs(random.randn(N))
parameter_list = [[ground_truth,predicted]]
def evaluation_meansquaredlogerror_modular(ground_truth, predicted):
from shogun.Features import Regres... | ratschlab/ASP | examples/undocumented/python_modular/evaluation_meansquaredlogerror_modular.py | Python | gpl-2.0 | 727 | 0.023384 |
# coding: utf-8
from __future__ import unicode_literals
DETAIL_TYPE = 'cut' | michaupl/materialsapp | cuts/__init__.py | Python | apache-2.0 | 76 | 0.013158 |
from GenObj import *
class GenIndexingExpression(GenObj):
def __init__(self, name, value):
super(GenIndexingExpression, self).__init__(name)
self.value = value
def getValue(self):
return self.value
def setValue(self, value):
self.value = value
| rafaellc28/Latex2MiniZinc | latex2minizinc/GenIndexingExpression.py | Python | mit | 258 | 0.031008 |
# snapy - a python snmp library
#
# Copyright (C) 2009 ITA Software, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 2 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be ... | marineam/nagcat | python/snapy/netsnmp/unittests/__init__.py | Python | apache-2.0 | 6,157 | 0.001624 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import with_statement
import __builtin__
import __future__
import contextlib
import collections
from pathlib import Path, PurePath
from pywatchman import WatchmanError
from .deterministic_set i... | LegNeato/buck | python-dsl/buck_parser/buck.py | Python | apache-2.0 | 67,707 | 0.001403 |
import select
import socket
import numpy
import numpy as np
import time
import zmq
from urh.dev.gr.AbstractBaseThread import AbstractBaseThread
from urh.util.Logger import logger
class SenderThread(AbstractBaseThread):
MAX_SAMPLES_PER_TRANSMISSION = 65536
def __init__(self, freq, sample_rate, bandwidth, ga... | splotz90/urh | src/urh/dev/gr/SenderThread.py | Python | gpl-3.0 | 2,568 | 0.003115 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015-2017 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __manifest... | ecino/compassion-accounting | account_analytic_attribution/models/__init__.py | Python | agpl-3.0 | 499 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2014:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you ca... | fpeyre/shinken | shinken/worker.py | Python | agpl-3.0 | 10,451 | 0.002871 |
#!/usr/bin/env python
"""Create a "virtual" Python installation
"""
__version__ = "13.1.0"
virtualenv_version = __version__ # legacy
import base64
import sys
import os
import codecs
import optparse
import re
import shutil
import logging
import tempfile
import zlib
import errno
import glob
import distutils.sysconfig
... | victor-lin/npact | virtualenv.py | Python | bsd-3-clause | 99,413 | 0.003128 |
"""
Helpers for accessing comprehensive theming related variables.
This file is imported at startup. Imports of models or things which import models will break startup on Django 1.9+. If
you need models here, please import them inside the function which uses them.
"""
import os
import re
from logging import getLogge... | stvstnfrd/edx-platform | openedx/core/djangoapps/theming/helpers.py | Python | agpl-3.0 | 10,226 | 0.002249 |
__author__ = 'ameadows'
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import datanexus
class Tox(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
... | OpenDataAlex/dataNexus | setup.py | Python | gpl-2.0 | 1,846 | 0.001083 |
from channels.routing import route
from .consumer import party_connected, party_disconnected, party_message
karaoke_routing = [
route("websocket.connect", party_connected, path=r"^/party/(?P<party_id>[a-zA-Z0-9_-]+)"),
route("websocket.receive", party_message),
route("websocket.disconnect", party_disconne... | Katharine/ponytone | karaoke/routing.py | Python | mit | 328 | 0.003049 |
# -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name
import os
import pytest
from guake import guake_version
from guake.about import AboutDialog
@pytest.fixture
def dialog(mocker):
mocker.patch("guake.simplegladeapp.Gtk.Widget.show_all")
try:
old_os_environ = os.environ
os.environ[... | Kaian/guake | guake/tests/test_about.py | Python | gpl-2.0 | 650 | 0 |
"""FLOW-BUS protocol for Bronkhorst instruments.
The protocol is described in the instruction manual number 9.17.027.
The implementation uses the `Construct library <http://construct.readthedocs.org/en/latest/>`__.
"""
from binascii import unhexlify
import unittest
from construct import *
header = Struct("header",... | Synss/pyhard2 | pyhard2/driver/_bronkhorst.py | Python | mit | 7,674 | 0.026323 |
from datetime import datetime, timedelta
from pokemongo_bot import inventory
from pokemongo_bot.human_behaviour import sleep
from pokemongo_bot.base_task import BaseTask
from pokemongo_bot.worker_result import WorkerResult
class IncubateEggs(BaseTask):
SUPPORTED_TASK_API_VERSION = 1
last_km_walked = 0
... | pengzhangdev/PokemonGo-Bot | pokemongo_bot/cell_workers/incubate_eggs.py | Python | mit | 11,384 | 0.002987 |
# tests for reconstruction code
| StongeEtienne/dipy | dipy/reconst/tests/__init__.py | Python | bsd-3-clause | 32 | 0 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from email.utils import formataddr
from odoo.addons.test_mail.tests import common
class TestChannelPartnersNotification(common.MockEmails):
def _join_channel(self, channel, partners):
for partner in partner... | t3dev/odoo | addons/test_mass_mailing/tests/test_mail_channel.py | Python | gpl-3.0 | 2,012 | 0.003479 |
#!/usr/bin/python3
# requirements: partition /dev/sdc1 with size at least 1 GiB
from sys import exit
from storage import *
from storageitu import *
set_logger(get_logfile_logger())
environment = Environment(False)
storage = Storage(environment)
storage.probe()
staging = storage.get_staging()
print(staging)
pa... | aschnell/libstorage-ng | integration-tests/partitions/shrink.py | Python | gpl-2.0 | 645 | 0.004651 |
#!/usr/bin/python
# Creator: Daniel Wooten
# License: GPL
# import the python logging utility as log
import logging as log
# Set the root logger level ( what messages it will print )
log.basicConfig( level = 10 )
# Some sample messages for the root logger
log.debug( "This is the debug level reporting in" )
log.info(... | jnaulty/berkeley | python_logger/log_pres_2.py | Python | bsd-3-clause | 529 | 0.028355 |
# -*- coding: utf-8 -*-
#
# inventory/projects/api/views.py
#
"""
Project API Views
"""
__docformat__ = "restructuredtext en"
import logging
from decimal import Decimal
from django.contrib.auth import get_user_model
from rest_framework.generics import (
ListCreateAPIView, RetrieveUpdateDestroyAPIView, RetrieveUp... | cnobile2012/inventory | inventory/projects/api/views.py | Python | mit | 5,580 | 0.001075 |
# Copyright 2012 Lee Verberne <lee@blarg.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 version.
#
# This program is dis... | kafana/ubik | lib/ubik/fab/filemap.py | Python | gpl-3.0 | 3,975 | 0.005283 |
import numpy as np
import pywt
from scipy.misc import imresize
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
X_L = 10
L = 14
N_BATCH = 50
OBS_SIZE = 30
# ---------------------------- helpers
def vectorize(coords):
retX, retY = np.zeros([L]... | evanthebouncy/nnhmm | mnist_haar/data.py | Python | mit | 2,672 | 0.026946 |
"""
Autopsy Forensic Browser
Copyright 2016-2018 Basis Technology Corp.
Contact: carrier <at> sleuthkit <dot> org
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... | wschaeferB/autopsy | InternalPythonModules/android/googlemaplocation.py | Python | apache-2.0 | 6,752 | 0.004443 |
"""
WSGI config for game 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
from mezzanine.utils.conf import real_p... | aldenjenkins/foobargamingwebsite | game/wsgi.py | Python | bsd-3-clause | 484 | 0 |
q1_start = 0
q1_end = 1
N_q1 = 1
q2_start = 0
q2_end = 1
N_q2 = 1
p1_start = -10
p1_end = 10
N_p1 = 32
p2_start = -0.5
p2_end = 0.5
N_p2 = 1
p3_start = -0.5
p3_end = 0.5
N_p3 = 1
N_ghost_q = 0
N_ghost_p = 0
| ShyamSS-95/Bolt | example_problems/nonrelativistic_boltzmann/advected_gaussian_pulse_in_p_space/1V/with_only_E1/domain.py | Python | gpl-3.0 | 243 | 0.045267 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render
from django.utils.translation import ugettext as _
def error_page(request, errormsg=''):
"""Show error page with message"""
if not errormsg:
errormsg = _('Wrong access')
return render(
req... | genonfire/bbgo | core/utils.py | Python | mit | 1,561 | 0 |
#!/usr/bin/env python
"""
output of various data for VAMP project
"""
from numpy import ndarray
class DataWriter():
def __init__(self, datadict, title='Data export file'):
self.title=title
self.data = datadict
self.allfields = sorted(datadict.keys())
self.numparams= []
self.... | pshchelo/vampy | calc/output.py | Python | bsd-3-clause | 2,387 | 0.008379 |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4 coding=utf-8
import os
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand, CommandError
from django.utils.translation import ugettext as _, ugettext_lazy
from onadata.libs.logger.import_tools import import_instances_from_z... | jomolinare/kobocat | onadata/apps/logger/management/commands/import_instances.py | Python | bsd-2-clause | 2,293 | 0 |
from ..apibits import *
from .. import Client
from . import *
class Bank(APIResource):
def remove(self, params={}, headers={}):
params = ParamsBuilder.merge({
"bank_id" : self.id,
}, params)
method = APIMethod("post", "/bank/delete", params, headers, self)
json = self.c... | synapsepayments/synapse_pay-python | synapsepay/resources/bank.py | Python | mit | 1,073 | 0.021435 |
import time
import datetime
import pprint
from .helpers import *
class ALDB(object):
def __init__(self, parent):
self._parent = parent
self._aldb = {}
def edit_record(self, position, record):
self._aldb[position] = record
def delete_record(self, position):
... | krkeegan/lib-py-insteon | insteon/base_objects.py | Python | gpl-2.0 | 19,358 | 0.00031 |
#!/usr/bin/python
# Copyright (c) 2009, Purdue University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright notice, this
# list ... | stephenlienharrell/roster-dns-management | roster-core/roster_core/db_access.py | Python | bsd-3-clause | 41,336 | 0.011128 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Adam.Dybbroe
# Author(s):
# Adam.Dybbroe <a000680@c14526.ad.smhi.se>
# 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, eith... | adybbroe/pypps_reader | test/test_ppsread.py | Python | gpl-3.0 | 1,228 | 0.001629 |
from threading import Lock
import requests
from api.decorator import critical_section
from api.importer import AdditionalDataImporter
from api.importer import AdditionalDataImporterError
from api.importer.wiktionary import dyn_backend
rmi_lock = Lock()
class DictionaryImporter(AdditionalDataImporter):
def popu... | radomd92/botjagwar | api/importer/rakibolanamalagasy.py | Python | mit | 1,609 | 0 |
# -*- encoding: utf-8 -*-
from django.test import TestCase
from pay.management.commands import init_app_pay
class TestCommand(TestCase):
def test_init_app(self):
""" Test the management command """
command = init_app_pay.Command()
command.handle()
| pkimber/pay | pay/tests/test_management_command.py | Python | apache-2.0 | 280 | 0 |
def shortestPalindrome(str):
if str is None:
return
strlen = len(str)
for x in xrange(strlen):
print str[x]
def main():
print "Hello, world"
str = 'aacecaaa'
shortestPalindrome(str)
if __name__ == '__main__':
main() | ruchikd/Algorithms | Python/ShortestPalindrome/shortestPalindrome.py | Python | gpl-3.0 | 230 | 0.052174 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'FeaturedResource'
db.create_table('resources_featuredresource', (
('id', self.gf... | amitskwalia/codesters | resources/migrations/0004_auto__add_featuredresource__add_unique_featuredresource_topic_resource.py | Python | mit | 8,260 | 0.008354 |
#!/usr/bin/env python
# Copyright (C) 2010 Red Hat, Inc.
#
# This 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 Software Foundation; either version 2.1 of
# the License, or (at your option) any later version.
#
# This so... | colloquium/rhevm-api | python/pool-test.py | Python | lgpl-2.1 | 1,969 | 0.013713 |
import os
import numpy as np
import pandas as pd
import six
import unittest
from datetime import datetime
from bom_data_parser import read_obs_json
class ObsJSONTest(unittest.TestCase):
def setUp(self):
self.test_obs_json_file = os.path.join(os.path.dirname(__file__), 'data', 'IDN60901.94767.json')
... | amacd31/bom_data_parser | tests/test_observations_json.py | Python | bsd-3-clause | 1,454 | 0.008253 |
import factory
from councils.tests.factories import CouncilFactory
from pollingstations.models import PollingStation, PollingDistrict
class PollingStationFactory(factory.django.DjangoModelFactory):
class Meta:
model = PollingStation
council = factory.SubFactory(CouncilFactory)
internal_council_i... | DemocracyClub/UK-Polling-Stations | polling_stations/apps/pollingstations/tests/factories.py | Python | bsd-3-clause | 591 | 0 |
import chainer
import chainer.functions as F
import chainer.links as L
class Alex(chainer.Chain):
"""Single-GPU AlexNet without partition toward the channel axis."""
def __init__(self, n_class=1000, threshold=0.5, pt_func=None):
self.threshold = threshold
self.pt_func = pt_func
self.... | start-jsk/jsk_apc | demos/selective_dualarm_stowing/python/selective_dualarm_stowing/models/alex.py | Python | bsd-3-clause | 4,007 | 0 |
import sys
class Encoding(object):
@staticmethod
def normalize(value):
"""
Normalize value
:param value: The value
:return: The processed value
"""
# Python 2 vs Python 3
if sys.version_info < (3, 0):
return Encoding.to_ascii(valu... | LowieHuyghe/script-core | scriptcore/encoding/encoding.py | Python | apache-2.0 | 2,861 | 0.00035 |
from django import http
from django.conf import settings
from google.appengine.api import users
from .exceptions import ParameterRequired, ApiException
class User (object):
def __init__ (self):
self._email = None
self._is_super = None
self._is_auth = None
self._userid = None
self.user = No... | pizzapanther/GAE-Bulk-Mailer | bulkmail/middleware.py | Python | bsd-2-clause | 2,043 | 0.029369 |
from django.conf.urls import patterns, url
from july.game import views
urlpatterns = patterns(
'july.game.views',
url(r'^people/$',
views.PlayerList.as_view(),
name='leaderboard'),
url(r'^people/(?P<year>\d{4})/(?P<month>\d{1,2})/((?P<day>\d{1,2})/)?$',
views.PlayerList.as_view(),... | ChimeraCoder/GOctober | july/game/urls.py | Python | mit | 1,757 | 0 |
import multiprocessing
import sys
import time
def worker_with(f):
fs = open(f, 'a+')
n = 10
while n > 1:
fs.write("Locked acquired via with\n")
time.sleep(1)
n -= 1
fs.close()
def worker_no_with(f):
fs = open(f, 'a+')
n = 10
w... | Furzoom/learnpython | usefull_scripts/multiprocessing/multiprocessing5_1.py | Python | mit | 709 | 0.005642 |
# coding=utf-8
# ---------------------------------------------------------------
# Desenvolvedor: Arannã Sousa Santos
# Mês: 12
# Ano: 2015
# Projeto: pagseguro_xml
# e-mail: asousas@live.com
# ---------------------------------------------------------------
import loggin... | arannasousa/pagseguro_xml | exemplos/testes_notificacao.py | Python | gpl-2.0 | 1,090 | 0.00276 |
#!/usr/bin/env python2
# Copyright (c) 2014 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test REST interface
#
from test_framework import BitcoinTestFramework
from util import *
import json
try... | fastcoinproject/fastcoin | qa/rpc-tests/rest.py | Python | mit | 3,264 | 0.010723 |
# -*- coding: utf-8 -*-
import requests, re, json, time, datetime, traceback, random
from pyquery import PyQuery as pq
# host = "www.a.com:8000"
host = "www.zhixuan.com"
headers = {"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36"}... | lantianlz/zx | www/stock/sync_stock_data_client.py | Python | gpl-2.0 | 1,935 | 0.0052 |
(S'7f2210613c44962221805a1b28aa76d6'
p1
(ihappydoclib.parseinfo.moduleinfo
ModuleInfo
p2
(dp3
S'_namespaces'
p4
((dp5
S'TkDrawer'
p6
(ihappydoclib.parseinfo.classinfo
ClassInfo
p7
(dp8
g4
((dp9
(dp10
tp11
sS'_filename'
p12
S'../python/frowns/Depict/TkMoleculeDrawer.py'
p13
sS'_docstring'
p14
S''
sS'_class_member_info'
... | tuffery/Frog2 | frowns/Depict/.happydoc.TkMoleculeDrawer.py | Python | gpl-3.0 | 4,720 | 0.134322 |
'''
Check Yahoo finance currency data helper.
Update log: (date / version / author : comments)
2017-12-10 / 1.0.0 / Du Jiang : Creation
2017-12-13 / 2.0.0 / Du Jiang : Use new API
'''
from com.djs.learn.financeapi import CheckFinanceDataRequests
__data_type = 1
__inventory_info_file_path = "../../../../etc/Currency... | djsilenceboy/LearnTest | Python_Test/PyFinanceApiSample/com/djs/learn/test/TestCheckYahooFinanceCurrencyData.py | Python | apache-2.0 | 709 | 0.00141 |
#
# This file is part of pyasn1 software.
#
# Copyright (c) 2005-2017, Ilya Etingof <etingof@gmail.com>
# License: http://pyasn1.sf.net/license.html
#
from pyasn1.type import univ, char, tag
__all__ = ['ObjectDescriptor', 'GeneralizedTime', 'UTCTime']
NoValue = univ.NoValue
noValue = univ.noValue
class ObjectDescri... | frerepoulet/ZeroNet | src/lib/pyasn1/type/useful.py | Python | gpl-2.0 | 1,159 | 0 |
import pytest
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.by import By
@pytest.fixture
def driver(request):
wd = webdriver.Chrome()
request.addfinalizer(wd.quit)
return wd
def is_element_present(driver, *args):
try:
... | byakatat/selenium-training | test_going_through_all_admin_sections.py | Python | apache-2.0 | 1,705 | 0.00176 |
#!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2014-2015, Dataspeed Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of source c... | cmsc421/mobility_base_tools | scripts/urdf_remove_pedestal.py | Python | bsd-3-clause | 3,158 | 0.0057 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | AnishShah/tensorflow | tensorflow/tools/api/tests/api_compatibility_test.py | Python | apache-2.0 | 12,593 | 0.005559 |
# -*- coding: utf-8 -*-
import json
from .common import CatmaidApiTestCase
class StacksApiTests(CatmaidApiTestCase):
def test_stack_info(self):
self.fake_authentication()
test_stack_id = 3
response = self.client.get('/%d/stack/%d/info' % (self.test_project_id, test_stack_id))
se... | tomka/CATMAID | django/applications/catmaid/tests/apis/test_stacks.py | Python | gpl-3.0 | 2,238 | 0.001787 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# MySQL Connector/Python - MySQL driver written in Python.
# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
# MySQL Connector/Python is licensed under the terms of the GPLv2
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most... | mrquim/mrquimrepo | script.module.myconnpy/lib/examples/engines.py | Python | gpl-2.0 | 1,881 | 0.002127 |
from rest_framework.test import APITestCase
from rest_framework.test import APIRequestFactory, APIClient, \
force_authenticate
from api.views import TripleStoreList
from api.tests.common import setup_user
class TestTripleStoresView(APITestCase):
def setUp(self):
self.factory = APIRequestFactory()
... | geolinkedata/geolod-api | api/tests/test_triplestores.py | Python | gpl-2.0 | 1,415 | 0.001413 |
from ipaddress import IPv4Address, IPv4Interface, IPv4Network, IPv6Address, IPv6Interface, IPv6Network
import pytest
from pydantic import BaseModel, IPvAnyAddress, IPvAnyInterface, IPvAnyNetwork, ValidationError
#
# ipaddress.IPv4Address
# ipaddress.IPv6Address
# pydantic.IPvAnyAddress
#
@pytest.mark.parametrize(
... | samuelcolvin/pydantic | tests/test_networks_ipaddress.py | Python | mit | 17,339 | 0.002653 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-10 18:08
from __future__ import unicode_literals
from django.db import migrations
import modelcluster.fields
class Migration(migrations.Migration):
dependencies = [
('blog', '0007_blogcategory'),
]
operations = [
migrations... | philba/myblog | blog/migrations/0008_blogpage_categories.py | Python | mit | 513 | 0.001949 |
from nose.tools import (assert_is_none, assert_is_instance, assert_in,
assert_is_not_none, assert_true, assert_false,
assert_equal)
from datetime import datetime
from mongoengine import connect
from qirest_client.model.subject import Subject
from qirest_client.model.uom i... | ohsu-qin/qirest | qirest/test/unit/test_seed.py | Python | bsd-2-clause | 19,873 | 0.002063 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "glassface.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| theopak/glassface | server/manage.py | Python | mit | 252 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('deck', '0013_proposal_more_information'),
]
operations = [
migrations.AddField(
model_name='event',
... | mauricioabreu/speakerfight | deck/migrations/0014_event_anonymous_voting.py | Python | mit | 485 | 0.002062 |
from gi.repository import Gtk
import os
class ExportDialog(Gtk.Dialog):
def __init__(self,parent,*args):
Gtk.Dialog.__init__(self, "Exportieren", parent, 0,
(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_OK, Gtk.ResponseType.OK))
self.set_default_size(150,150)
self.contentarea=self.get_content_are... | daknuett/BeeKeeper | pythons/objs_graphics.py | Python | agpl-3.0 | 1,259 | 0.039714 |
# fsmkfs.py
# Filesystem formatting classes.
#
# Copyright (C) 2015 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This progr... | jkonecny12/blivet | blivet/tasks/fsmkfs.py | Python | lgpl-2.1 | 10,426 | 0.000575 |
from database.db import Database
from report.db.models import PingerReport
class Writer:
def __init__(self):
self.db = Database()
def report_insert(self, item):
"""
Save Pinger Reports to the database
:param item:
"""
self.db.get_or_create(PingerRepo... | git-albertomarin/pinger | report/parser/writer.py | Python | mit | 332 | 0.006024 |
"""
ManyMan - A Many-core Visualization and Management System
Copyright (C) 2015
University of Amsterdam - Computer Systems Architecture
Jimi van der Woning and Roy Bakker
Extended for big.LITTLE by: Floris Turkenburg
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Ge... | FlorisTurkenburg/ManyMan | b.L_frontend/widgets.py | Python | gpl-2.0 | 7,562 | 0.000264 |
from version import VERSION
import sys, os, getpass
import re
import optparse
def coalesce( *values ):
for f in values:
if f is not None:
return f
class ConversionError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self... | haroldo-ok/really-old-stuff | mastersystem/zxb-sms-2012-02-23/zxb-sms/wip/zxb2wla.py | Python | apache-2.0 | 11,822 | 0.015564 |
import re
import urllib.request
import logging
import math
from bs4 import BeautifulSoup
from Vacation import VacationPackage, Departures, Destinations, Duration
ALL_PAGES = True
DEPARTURE_MAPPING = {
Departures.OTTAWA: "YOW"
}
DEPARTURE_CITY_MAPPING = {
Departures.OTTAWA: "Ottawa"
}
DESTINATION_MAPPING = ... | astone282/vactrack | vactrack/Expedia.py | Python | apache-2.0 | 6,312 | 0.00206 |
from dyleps.utils.exceptions import Tier1Exception
class Tier1ParsingException(Tier1Exception):
pass | PhillsProgrammingExperiments/dyleps | dyleps/tier1/exceptions.py | Python | mit | 106 | 0.009434 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleads/google-ads-python | google/ads/googleads/v9/services/services/geo_target_constant_service/transports/base.py | Python | apache-2.0 | 4,445 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import fir_artifacts.models
class Migration(migrations.Migration):
dependencies = [
('fir_artifacts', '0001_initial'),
('incidents', '0001_initial')
]
operations = [
migration... | benjimons/FIR | fir_artifacts/migrations/0002_create_artifacts.py | Python | gpl-3.0 | 1,876 | 0.002665 |
from mininet.net import Mininet
from ..util import findPyroObjectOrNone
def monkeypatch(cls):
def decorator(func):
setattr(cls, func.__name__, func)
return func
return decorator
def getOneNodeByName(net, name):
if name in net.nameToNode:
return net.nameToNode[name]
else:
return findPyroObjectO... | itszero/onenet | emulab/onenet/onenet/inject/infect.py | Python | mit | 867 | 0.019608 |
"""
__ProcDef.py_____________________________________________________
Automatically generated AToM3 syntactic object (DO NOT MODIFY DIRECTLY)
Author: gehan
Modified: Sat Aug 30 18:23:40 2014
_________________________________________________________________
"""
from ASGNode import *
from ATOM3Type import *
from ATOM3... | levilucio/SyVOLT | UMLRT2Kiltera_MM/ProcDef.py | Python | mit | 3,435 | 0.029403 |
# Copyright 2013 Google 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 required by applicable law or ... | google/coursebuilder_xblock_module | src/modules/xblock_module/xblock_module.py | Python | apache-2.0 | 54,112 | 0.000185 |
import re
import json
from urlparse import urlparse
import urllib
import pdb
from scrapy.selector import Selector
try:
from scrapy.spiders import Spider
except:
from scrapy.spiders import BaseSpider as Spider
from scrapy.utils.response import get_base_url
from scrapy.spiders import CrawlSpider, Rule
from scra... | geekan/scrapy-live-portal | general_spider/general_spider/spiders/spider.py | Python | apache-2.0 | 3,707 | 0.002158 |
import random
import os
# TicTacToe
def createNewField():
result = []
for i in range(3):
tmp = []
for i2 in range(3):
tmp.append(' ')
result.append(tmp)
return result
def printField(field):
print ''
for element in field:
print element
print ''
def isFieldFull(field):
occupiedPlaces = 0
for row in... | dodonator/ticTacToe | outdatet/ticTacToe.py | Python | gpl-3.0 | 3,105 | 0.055717 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.