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
import argparse
import json
import csv
import sys
sys.path.append('python')
import plotting
import utils
from opener import opener
parser = argparse.ArgumentParser()
parser.add_argument('-b', action='store_true') # passed on to ROOT when plotting
parser.add_argument('--outdir', required=True)
... | psathyrella/partis-deprecated | python/compare.py | Python | gpl-3.0 | 2,531 | 0.003556 |
"""
integration test for arduino
NOTE: requires the arduino to be plugged in
"""
import unittest
from comp.comm import ADCSArduino
class TestComm(unittest.TestCase):
def setUp(self):
self.ard = ADCSArduino(pr="/dev/ttyACM0")
def tearDown(self):
self.ard.close_arduino_port()
def ... | WatSat-ADCS/Comm | test/test_comm.py | Python | mit | 1,077 | 0.004643 |
# Copyright (c) 2016, GohighSec
# 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 la... | openstack/barbican | barbican/hacking/checks.py | Python | apache-2.0 | 7,978 | 0 |
#!/usr/bin/python
# -*- coding: utf8 -*-
#
#****************************************************************************
#* *
#* base classes for generating part models in STEP AP214 *
#* ... | easyw/kicad-3d-models-in-freecad | cadquery/FCAD_script_generator/Button_Switch_Nidec/cq_base_model.py | Python | gpl-2.0 | 23,507 | 0.005658 |
#!/usr/bin/env python
#
# Copyright 2016 Medoly
#
# 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... | whiteclover/Medoly | medoly/config/hocon.py | Python | apache-2.0 | 38,051 | 0.000631 |
#!/bin/env python2
from alife.worlds.world import World, Point
from alife.agents.UtilityAgent import SimpleAgent
from alife.utils.utils import dumpToArray, zeros
import math
import sys
import numpy
from nupic.encoders.extras.utility import SimpleUtilityEncoder
# common settings:
items=None
target=Point(4,9)
agent=Non... | breznak/ALife | alife/experiments/behavior/random_walk_map.py | Python | gpl-2.0 | 6,062 | 0.032662 |
import json
import os
import jinja2
from mlabns.util import message
def _get_jinja_environment():
current_dir = os.path.dirname(__file__)
templates_dir = os.path.join(current_dir, '../templates')
return jinja2.Environment(loader=jinja2.FileSystemLoader(templates_dir),
exten... | m-lab/mlab-ns | server/mlabns/util/util.py | Python | apache-2.0 | 2,015 | 0.000993 |
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.db import connection
from collections import OrderedDict
from datetime import datetime
import time
import scipy.cluster.hierarchy as hcluster
import numpy as np
class ObsoletedTasksReport:
def __init__(self):
... | PanDAWMS/panda-bigmon-core | core/reports/ObsoletedTasksReport.py | Python | apache-2.0 | 9,797 | 0.005818 |
import sys, os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../src/lib/common')))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../src/lib/etvnet')))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../src/lib/youtube')))
| shvets/etvnet-plex-plugin | test/test_helper.py | Python | mit | 302 | 0.013245 |
from flask import *
from playhouse.flask_utils import *
import string
from app import app
from model import Major, Minor, Store, Transaction, Item
@app.route('/major', methods=['GET', 'POST'])
def major_list():
query = Major \
.select(Major, Minor) \
.join(Minor, on=(Major.id == Minor.maj... | ilhamwk/accounting | view_major.py | Python | cc0-1.0 | 4,006 | 0.005741 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('autodidact', '0002_auto_20161004_1251'),
]
operations = [
migrations.CreateModel(
name='RightAnswer',
... | JaapJoris/autodidact | autodidact/migrations/0003_auto_20170116_1142.py | Python | agpl-3.0 | 2,079 | 0.00337 |
# Sebastian Raschka 2014
# Script that extracts atoms within a radius from a PDB file
def grab_radius(file, radius, coordinates, include='ATOM,HETATM'):
"""
Grabs those atoms that are within a specified
radius of a provided 3d-coordinate.
Keyword arguments:
file: path to a PDB file
ra... | rasbt/protein-science | scripts-and-tools/grab_atom_radius/grab_atom_radius.py | Python | gpl-3.0 | 2,978 | 0.014775 |
"""SCons.Scanner.Fortran
This module implements the dependency scanner for Fortran code.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation fil... | bleepbloop/Pivy | scons/scons-local-1.2.0.d20090919/SCons/Scanner/Fortran.py | Python | isc | 14,448 | 0.002422 |
import Queue
from unittest import TestCase
import threading
import time
from storm.wsgi import make_app
class TestMakeApp(TestCase):
def stub_app(self, environ, start_response):
if getattr(self, 'in_request', None):
self.in_request()
getattr(self, 'calls', []).append('stub_app')
... | nwokeo/supysonic | venv/lib/python2.7/site-packages/tests/wsgi.py | Python | agpl-3.0 | 4,317 | 0.001853 |
# Copyright (c) 2015 Intel Corporation
#
# 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 ... | enableiot/iotanalytics-rule-engine | pydeps/db/dataDao.py | Python | apache-2.0 | 2,301 | 0.003911 |
from os import environ
import logging
import rethinkdb as r
from rethinkdb.errors import RqlDriverError, ReqlError
_MCDB = "materialscommons"
_MCDB_HOST = environ.get('MCDB_HOST') or 'localhost'
probe = environ.get('MCDB_PORT')
if not probe:
print("Unable to run without a setting for MCDB_PORT")
exit(-1)
_MCDB... | materials-commons/materialscommons.org | backend/tests/python_api_mulltiuser_check/DB.py | Python | mit | 1,380 | 0.001449 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp.osv import fields, osv
from openerp import tools
class sale_report(osv.osv):
_inherit = "sale.report"
_columns = {
'shipped': fields.boolean('Shipped', readonly=True),
'shipped_qty... | tvtsoft/odoo8 | addons/sale_stock/report/sale_report.py | Python | agpl-3.0 | 1,213 | 0.00742 |
# -*- coding: utf-8 -*-
#
# RERO ILS
# Copyright (C) 2019 RERO
#
# 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, version 3 of the License.
#
# This program is distributed in the hope that... | rero/reroils-app | tests/api/test_permissions_patron.py | Python | gpl-2.0 | 2,746 | 0 |
from calc_phot import calc_phot
| t-brandt/acorns-adi | photometry/__init__.py | Python | bsd-2-clause | 32 | 0 |
# -*- coding: utf-8 -*-
# Copyright (c) 2013, Theo Crevon
# Copyright (c) 2013, Greg Leclercq
#
# See the file LICENSE for copying permission.
from boto.swf.exceptions import SWFResponseError
from swf.constants import REGISTERED
from swf.querysets.base import BaseQuerySet
from swf.models import Domain
from swf.model... | botify-labs/python-simple-workflow | swf/querysets/workflow.py | Python | mit | 25,485 | 0.001295 |
# 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... | GabrielBrascher/cloudstack | systemvm/debian/opt/cloud/bin/cs/__init__.py | Python | apache-2.0 | 1,000 | 0 |
#!/usr/bin/env python
""" Class that reads in data from decoder.py and uses a PLL to correct for
phase offset. """
import numpy as np
import matplotlib.pyplot as plt
import helper
#from decoder import Decoder
j = (0 + 1j)
class PLL(object):
def __init__(self, data, k_p, k_i, k_d):
""" Initialize d... | williamalu/mimo_usrp | scripts/pll.py | Python | mit | 3,454 | 0.001448 |
'''
Created by auto_sdk on 2013.01.22
'''
from top.api.base import RestApi
class SubuserEmployeeUpdateRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.department_id = None
self.duty_id = None
self.employee_name = None
self.employee_ni... | colaftc/webtool | top/api/rest/SubuserEmployeeUpdateRequest.py | Python | mit | 702 | 0.032764 |
import TownLoader
import DDStreet
from toontown.suit import Suit
class DDTownLoader(TownLoader.TownLoader):
def __init__(self, hood, parentFSM, doneEvent):
TownLoader.TownLoader.__init__(self, hood, parentFSM, doneEvent)
self.streetClass = DDStreet.DDStreet
self.musicFile = 'phase_6/audio/... | silly-wacky-3-town-toon/SOURCE-COD | toontown/town/DDTownLoader.py | Python | apache-2.0 | 951 | 0.002103 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import logging
from flexget import plugin
from flexget.event import event
log = logging.getLogger('inputs')
class PluginInputs(object):
"""
Allows the same inpu... | gazpachoking/Flexget | flexget/plugins/input/inputs.py | Python | mit | 2,537 | 0.001971 |
import math
import sys
sys.path.append('..')
import Analyse.AFX as AFX
class State:
def __init__(self):
self.SenShifterState = True
self.MoodStrength = 1.0
self.positive = 0.0
self.negative = 0.0
def Process(self, score):
if self.SenShifterState is True:
self.positive += score
else:
self.negative ... | MyRookie/SentimentAnalyse | src/Algorithm/ScoreCaculating.py | Python | mit | 1,593 | 0.041431 |
from pyroom.app import PyRoom
from options import options
from pyroom.urls import settings
from pyroom.urls import handlers
if __name__ == '__main__':
pyroom = PyRoom(options=options, handlers=handlers, **settings)
pyroom.start()
| land-pack/pyroom | pyroom/manage.py | Python | gpl-3.0 | 239 | 0 |
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/jws | jws/jwt.py | Python | apache-2.0 | 9,120 | 0.005482 |
from PIL import Image
import numpy
from antialiased import antialiased
im=Image.open('C:/Users/linzz/Desktop/pic/image_processing/ImageProcessing/perspective/find/line.jpg')
im=numpy.array(im)
node_site_u2 = [165, 145, 557, 83, 564, 333, 137, 359]
node_site_u3 = [124, 150, 524, 113, 540, 246, 106, 272]
node_site_u4 =... | THM-TheoreM/Algorithm | tool/ImageProcessing/perspective/antialiased_do.py | Python | gpl-3.0 | 947 | 0.024287 |
"""
This module creates a sysadmin dashboard for managing and viewing
courses.
"""
import csv
import json
import logging
import os
import subprocess
import time
import StringIO
from pymongo.errors import PyMongoError
from django.conf import settings
from django.contrib.auth import authenticate
from django.contrib.aut... | jbassen/edx-platform | lms/djangoapps/dashboard/sysadmin.py | Python | agpl-3.0 | 38,209 | 0.001282 |
"""
Django settings for the admin project.
"""
import os
from urlparse import urlparse
from website import settings as osf_settings
from django.contrib import messages
from api.base.settings import * # noqa
# TODO ALL SETTINGS FROM API WILL BE IMPORTED AND WILL NEED TO BE OVERRRIDEN
# TODO THIS IS A STEP TOWARD INTEG... | hmoco/osf.io | admin/base/settings/defaults.py | Python | apache-2.0 | 6,690 | 0.001495 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/OSIS-Louvain | base/models/enums/learning_container_year_types.py | Python | agpl-3.0 | 2,804 | 0.001784 |
# -*- coding: utf-8 -*-
import requests
import json
from yamlns import namespace as ns
from .. import persons
class AreaVoip(object):
@staticmethod
def defaultQueue():
import dbconfig
return dbconfig.tomatic.get('areavoip',{}).get('queue', None)
def __init__(self):
import dbconfi... | Som-Energia/somenergia-tomatic | tomatic/pbx/pbxareavoip.py | Python | gpl-3.0 | 5,174 | 0.018748 |
import sys
import os
from runtests import run
if __name__ == '__main__':
if sys.version_info > (3, 3):
run(coverage=True, coveralls=True)
else:
run()
| lsbardel/python-stdnet | covrun.py | Python | bsd-3-clause | 177 | 0 |
import nose.tools as nt
import numpy as np
from hyperspy.signal import Signal
from hyperspy import signals
from hyperspy.exceptions import DataDimensionError
class Test1d:
def setUp(self):
self.s = Signal(np.arange(2))
@nt.raises(DataDimensionError)
def test_as_image(self):
self.s.as_im... | to266/hyperspy | hyperspy/tests/signal/test_signal_subclass_conversion.py | Python | gpl-3.0 | 2,881 | 0 |
# Copyright (C) 2009 Gaetan Guidet
#
# This file is part of pygl.
#
# luagl 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.... | gatgui/pygl | python/test_gl.py | Python | lgpl-3.0 | 6,380 | 0.025549 |
# 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... | toddpalino/kafka-tools | kafka/tools/protocol/responses/describe_acls_v0.py | Python | apache-2.0 | 1,614 | 0 |
# coding=utf-8
"""InaSAFE Disaster risk tool by Australian Aid - Flood Raster Impact on
Population.
Contact : ole.moller.nielsen@gmail.com
.. note:: 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 Fou... | wonder-sk/inasafe | safe/impact_functions/inundation/flood_raster_population/metadata_definitions.py | Python | gpl-3.0 | 5,408 | 0 |
# Copyright 2019 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | jesseengel/magenta | magenta/pipelines/pipeline_test.py | Python | apache-2.0 | 8,715 | 0.004246 |
# -*- coding: utf-8 -*-
#
# BbQuick documentation build configuration file, created by
# sphinx-quickstart on Fri Feb 10 20:55:10 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... | ianawilson/BbQuick | docs/conf.py | Python | mit | 6,974 | 0.006739 |
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='PushNot... | edx/edx-platform | cms/djangoapps/contentstore/migrations/0001_initial.py | Python | agpl-3.0 | 1,882 | 0.004782 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import umibukela.models
class Migration(migrations.Migration):
dependencies = [
('umibukela', '0028_cycle_materials'),
]
operations = [
migrations.CreateModel(
name='Prog... | Code4SA/umibukela | umibukela/migrations/0029_auto_20170226_0745.py | Python | mit | 1,763 | 0.002269 |
#!/usr/bin/env python
#
# Migration Stream Analyzer
#
# Copyright (c) 2015 Alexander Graf <agraf@suse.de>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the Lic... | gongleiarei/qemu | scripts/analyze-migration.py | Python | gpl-2.0 | 20,683 | 0.006479 |
__author__ = 'kjoseph'
import itertools
import Queue
from collections import defaultdict
from dependency_parse_object import DependencyParseObject, is_noun, is_verb
def get_parse(dp_objs):
term_map = {}
map_to_head = defaultdict(list)
for parse_object in dp_objs:
if parse_object.head > 0:
... | kennyjoseph/identity_extraction_pub | python/utility_code/dependency_parse_handlers.py | Python | mit | 6,421 | 0.007164 |
# Copyright 2016 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,... | axbaretto/beam | sdks/python/.tox/py27gcp/lib/python2.7/site-packages/google/oauth2/flow.py | Python | apache-2.0 | 9,887 | 0 |
import time
output = ''
i=1
start_time = time.time()
while len(output)<1000001:
output +=str(i)
i += 1
print(int(output[9]) * int(output[99]) *
int(output[999]) * int(output[9999]) *
int(output[99999]) * int(output[999999]))
print("--- %s seconds ---" % (time.time() - start_time)) | BinDigit1/EulerProjects | Problem 40/Champernownes_constant.py | Python | gpl-2.0 | 304 | 0.013158 |
from django.conf import settings
def google_ua(request):
return {'google_ua': settings.GOOGLE_TRACKING_ID}
| destos/mfinstop | mfinstop/context_processors.py | Python | gpl-3.0 | 113 | 0 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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... | rwl/PyCIM | CIM14/IEC61970/OperationalLimits/ActivePowerLimit.py | Python | mit | 1,717 | 0.001747 |
from enum import Enum
# Takes string names or int indices of a type and an attribute.
# Returns None if that type does not have that attribute.
# Else returns the default value for that attribute.
def getDefault(typeName, attrName):
# Determine index of type
if type(typeName) == int:
typeIndex = typeN... | GooeyComps/gooey-dist | gooeydist/interpreter/matrix.py | Python | mit | 2,797 | 0.008223 |
from django.conf.urls.defaults import *
urlpatterns = patterns('lingcod.manipulators.views',
(r'^test/$', 'testView' ),
(r'^list/([A-Za-z0-9_,]+)/([A-Za-z0-9_,]+)/$', 'mpaManipulatorList' ),
url(r'^([A-Za-z0-9_,]+)/$', 'multi_generic_manipulator_view', name='manipulate'),
url(r'^$', 'multi_generic_mani... | Alwnikrotikz/marinemap | lingcod/manipulators/urls.py | Python | bsd-3-clause | 487 | 0.01232 |
from django.test import TestCase
from groups import models as group_model
class SimpleTest(TestCase):
def test_create_group(self):
"""
Test group creation
"""
group = group_model.create_group('ateam@mechmooc.com', 'The A team', 1)
self.assertTrue('address' in group)
... | p2pu/mechanical-mooc | groups/tests.py | Python | mit | 2,657 | 0.006022 |
content =\
[line.strip().split() for line in open("ut_align_no_tag.a")]
f = open("ut_align_no_tag_clean.a", "w")
for line in content:
for entry in line:
if entry.find('?') != -1:
l, rs = entry.split('?')
rs = rs.split(',')
for r in rs:
f.write(l + '?'... | sfu-natlang/HMM-Aligner | src/support/proc_no_tag_to_clean.py | Python | mit | 510 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-04-11 03:42
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('students', '0007_auto_20170410_0523'),
('job', '001... | jamesaud/se1-group4 | jmatcher/job/migrations/0016_auto_20170411_0342.py | Python | mit | 2,381 | 0.00252 |
# encoding: utf-8
# Licensed to Hortonworks, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Hortonworks, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ... | hortonworks/hortonworks-sandbox | apps/pig/src/pig/migrations/0006_auto__del_logs__add_field_job_status__add_field_job_email_notification.py | Python | apache-2.0 | 9,272 | 0.00701 |
# -*- coding: utf-8 -*-
from django.conf.urls import include, url
from rest_framework import routers
from jwtTest import views
router = routers.DefaultRouter()
router.register(r'management', views.ProductAViewSet)
urlpatterns = [
url(r'^', include(router.urls)),
]
| motobyus/moto | module_django/tokenauth/jwtTest/urls.py | Python | mit | 277 | 0 |
# Copyright (C) 2010-2014 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library ... | FedoraScientific/salome-paravis | test/VisuPrs/SWIG_scripts/B9.py | Python | lgpl-2.1 | 1,819 | 0.00055 |
#!/usr/bin/env python
#
# Copyright (C) 2016 GNS3 Technologies Inc.
#
# 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.
#
... | GNS3/gns3-server | gns3server/controller/__init__.py | Python | gpl-3.0 | 21,528 | 0.002276 |
import re
from conditional_expression import ConditionalExpression
from compare_term import CompareTerm
class Comparison(ConditionalExpression, object):
"""
A class that represents a comparison appearing in a WHERE clause.
"""
EQ = 0
NOTEQ = 1
LT = 2
GT = 3
LTEQ = 4
GTEQ = 5
LI... | nddsg/SimpleDBMS | simple_dbms/comparison.py | Python | gpl-3.0 | 4,943 | 0.001618 |
"""
Define command names and prove command/code mappings
"""
from collections import ChainMap
__all__ = [
'nibble_commands',
'byte_commands',
'sysex_commands',
'command_lookup',
'command_names',
]
INPUT, OUTPUT, ANALOG, \
PWM, SERVO, I2C, ONEWIRE, \
STEPPER, ENCODER = range(0, 9)
# do not combine... | bitcraft/firmata_aio | firmata_aio/protocol/commands.py | Python | gpl-3.0 | 1,998 | 0.001001 |
#!/usr/bin/python
class Solution(object):
def removeElement(self, nums, val):
"""
:type nums: List[int]
:type val: int
:rtype: int
"""
i = 0
j = 0
while i < len(nums):
if nums[i] != val:
nums[j] = nums[i]
j... | pisskidney/leetcode | easy/27.py | Python | mit | 449 | 0 |
#########################################################################################################
# ml_input_utils.py
# One of the Python modules written as part of the genericQSARpyUtils project (see below).
#
# ################################################
# #ml_input_utils.py: Key documentation :Contents#... | RichardLMR/generic-qsar-py-utils | code/ml_input_utils.py | Python | gpl-2.0 | 21,062 | 0.033995 |
SECRET_KEY = 'spam'
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ROOT_URLCONF = 'tests.urls'
INSTALLED_APPS = ['tests']
DATABASES = {'default': {'NAME': 'db.sqlite',
'ENGINE': 'django.db.backends.sqlite3'}}
# Django < 1.8
TEMPLATE_CONTEXT_PROCESSORS = [
'django_settings_export.settings_export'
]
# ... | jkbrzt/django-settings-export | tests/settings.py | Python | bsd-3-clause | 688 | 0 |
from local_settings import BASE_URL
import datetime
import json
import redis
import requests
import requests.exceptions
class TeaReaderConsumer(object):
def __init__(self):
self.redis = redis.StrictRedis()
def run(self):
pubsub = self.redis.pubsub(ignore_subscribe_messages=True)
pubs... | ojarva/home-info-display | tea_reader_consumer/run.py | Python | bsd-3-clause | 1,217 | 0.002465 |
# -*- coding: UTF-8 -*-
#######################################################################
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# @tantrumdev wrote this file. As long as you retain this notice you
# can do whatever you want wit... | repotvsupertuga/tvsupertuga.repository | script.module.streamtvsupertuga/lib/resources/lib/sources/en/glodls.py | Python | gpl-2.0 | 5,797 | 0.014145 |
# -*- coding: utf-8 -*-
import mock
import unittest
from nose.tools import * # noqa
from github3 import GitHubError
from github3.repos import Repository
from tests.base import OsfTestCase, get_default_metaschema
from tests.factories import ExternalAccountFactory, ProjectFactory, UserFactory
from framework.auth imp... | rdhyee/osf.io | website/addons/github/tests/test_models.py | Python | apache-2.0 | 12,663 | 0.001264 |
# import os
# os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
# from vmprof import DjangoVMPROF
# vmprof = DjangoVMPROF("localhost", 8000, "token")
# app = vmprof(get_wsgi_application())
from django.core.wsgi import get_wsgi_application
app = get_wsgi_application()
| vmprof/vmprof-server | webapp/wsgi.py | Python | mit | 280 | 0 |
# Copyright 2015 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 a... | dropbox/pep8squad | yapf/yapflib/subtype_assigner.py | Python | apache-2.0 | 10,019 | 0.007286 |
# 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 agreed to in writing, ... | google/gazoo-device | gazoo_device/utility/retry.py | Python | apache-2.0 | 3,404 | 0.004994 |
# 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... | resmo/cloudstack | test/integration/plugins/nuagevsp/test_nuage_sharednetwork_vpc_vm_monitor.py | Python | apache-2.0 | 30,062 | 0 |
# 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... | tornadomeet/mxnet | python/mxnet/contrib/__init__.py | Python | apache-2.0 | 1,006 | 0 |
"""
Transactional workflow control for Django models.
"""
| oblalex/django-workflow | src/workflow/__init__.py | Python | mit | 58 | 0 |
import sys
import click
from globus_cli.termio import FORMAT_SILENT, formatted_print
from ..services.transfer import CustomTransferClient
def transfer_task_wait_with_io(
transfer_client: CustomTransferClient,
meow,
heartbeat,
polling_interval,
timeout,
task_id,
timeout_exit_code,
) -> N... | globus/globus-cli | src/globus_cli/commands/_common.py | Python | apache-2.0 | 2,720 | 0.000735 |
"""Add Brief.is_a_copy boolean, default False, nullable False
Revision ID: 890
Revises: 880
Create Date: 2017-06-01 11:24:53.346954
"""
# revision identifiers, used by Alembic.
revision = '900'
down_revision = '890'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('briefs', sa.Colum... | alphagov/digitalmarketplace-api | migrations/versions/900_add_brief_is_a_copy.py | Python | mit | 461 | 0.006508 |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2015 Thomas Voegtlin
#
# 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... | cryptapus/electrum-uno | lib/pem.py | Python | mit | 6,584 | 0.003493 |
# -*- coding: utf-8 -*-
from collections import defaultdict
import json
import logging
from ._compat import ElementTree, urlopen
MDN_SITEMAP = 'https://developer.mozilla.org/sitemaps/en-US/sitemap.xml'
SITEMAP_NS = 'http://www.sitemaps.org/schemas/sitemap/0.9'
log = logging.getLogger(__name__)
def parse():
"""... | malept/js-sphinx-inventory | sphinx_inventory/js/mdn.py | Python | apache-2.0 | 1,705 | 0 |
from decouple import config
from tapioca_mandrill import Mandrill
from tapioca.exceptions import TapiocaException
api = Mandrill(key=config('KEY'))
try:
r = api.users(method='ping').post()
except TapiocaException as e:
print e.client().data()
print e.client().response().status_code
| vintasoftware/tapioca-mandrill | testing.py | Python | bsd-3-clause | 299 | 0 |
# Copyright (C) 2006 Adam Olsen
#
# 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 1, or (at your option)
# any later version.
#
# This program is distributed in the hope that it w... | sjohannes/exaile | plugins/amazoncovers/__init__.py | Python | gpl-2.0 | 2,845 | 0.000351 |
"""
Any operations to make img from img.
python celltk/preprocess.py -f gaussian_laplace -i c0/img_00000000*
"""
# from scipy.ndimage import imread
import argparse
from utils.file_io import make_dirs, imsave
from utils.util import imread
from utils.parser import ParamParser, parse_image_files
import logging
from uti... | braysia/CellTK | celltk/preprocess.py | Python | mit | 1,780 | 0.001685 |
import socket
import threading
import email.mime.text
import email.mime.image
import email.mime.multipart
import email.header
import bminterface
import re
import select
import logging
class ChatterboxConnection(object):
END = "\r\n"
def __init__(self, conn):
self.conn = conn
def __getattr__(self, na... | Arceliar/bmwrapper | incoming.py | Python | mit | 9,110 | 0.010538 |
from .pls_ import _PLS
__all__ = ['CCA']
class CCA(_PLS):
"""CCA Canonical Correlation Analysis.
CCA inherits from PLS with mode="B" and deflation_mode="canonical".
Read more in the :ref:`User Guide <cross_decomposition>`.
Parameters
----------
n_components : int, (default 2).
numb... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/sklearn/cross_decomposition/cca_.py | Python | mit | 3,192 | 0 |
"""
Copyright (c) 20115 Alan Yorinks 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; either
version 3 of the License, or (at your option) any later version.
This library is dis... | Rosebotics/pymata-aio | pymata_aio/private_constants.py | Python | gpl-3.0 | 4,660 | 0.000215 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2018 David Arroyo Menéndez
# Author: David Arroyo Menéndez <davidam@gnu.org>
# Maintainer: David Arroyo Menéndez <davidam@gnu.org>
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License ... | davidam/python-examples | rdflib/rdflib-example.py | Python | gpl-3.0 | 1,020 | 0.004916 |
from datetime import datetime, timedelta
from celery.schedules import crontab
from celery.task.base import periodic_task
from django.core.mail import mail_admins
from django.core.urlresolvers import reverse
from django.db.models.aggregates import Count
from django.template.loader import render_to_string
from dimagi.uti... | puttarajubr/commcare-hq | corehq/apps/hqpillow_retry/tasks.py | Python | bsd-3-clause | 1,845 | 0.002168 |
# =============================================================================
# Copyright [2013] [Kevin Carter]
# License Information :
# This software has no warranty, it is provided 'as is'. It is your
# responsibility to validate the behavior of the routines and its accuracy
# using the code provided. Consult the ... | cloudnull/tribble-api | tribble/engine/constructor.py | Python | gpl-3.0 | 13,205 | 0 |
import collections
class Solution:
def numOfMinutes(self, n: int, headID: int, manager: List[int], informTime: List[int]) -> int:
table = collections.defaultdict(list)
for i, m in enumerate(manager):
table[m].append(i)
Q = collections.deque([(headID, 0)])
min... | jiadaizhao/LeetCode | 1301-1400/1376-Time Needed to Inform All Employees/1376-Time Needed to Inform All Employees.py | Python | mit | 524 | 0.005725 |
import operator
import pytest
from bonobo.util.objects import ValueHolder, Wrapper, get_attribute_or_create, get_name
from bonobo.util.testing import optional_contextmanager
class foo:
pass
class bar:
__name__ = "baz"
def test_get_name():
assert get_name(42) == "int"
assert get_name("eat at joe.... | hartym/bonobo | tests/util/test_objects.py | Python | apache-2.0 | 4,935 | 0.001621 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import xml.dom.minidom as dom
import xml.dom
import os
import socket
import re
import sys
import datetime
import codecs
from SPARQLWrapper import SPARQLWrapper, JSON
endpoint = "http://vtentacle.techfak.uni-bielefeld.de:443/sparql/"
sparql = SPARQLWrapper(endpoint)
# Doku... | ag-sc/QALD | 4/scripts/XMLGenerator.py | Python | mit | 22,039 | 0.021877 |
# Copyright 2014 NEC Technologies India Ltd.
# 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
#
# Unle... | cisco-openstack/tempest | tempest/api/compute/admin/test_floating_ips_bulk.py | Python | apache-2.0 | 3,760 | 0 |
# (c) Copyright 2014 Brocade Communications Systems Inc.
# All Rights Reserved.
#
# Copyright 2014 OpenStack Foundation
#
# 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
#
# ... | tobegit3hub/cinder_docker | cinder/zonemanager/fc_zone_manager.py | Python | apache-2.0 | 9,631 | 0 |
from __future__ import absolute_import, print_function, division
import numpy as np
from matplotlib.colors import LinearSegmentedColormap,ListedColormap
import sys
__author__ = "Juhyeong Kang "
__email__ = "jhkang@astro.snu.ac.kr"
def create_cdict(r, g, b):
i = np.linspace(0, 1, 256)
cdict = dict(
... | SNU-sunday/fisspy | fisspy/cm.py | Python | bsd-2-clause | 19,011 | 0.011993 |
# (C) Datadog, Inc. 2010-2016
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
"""PostgreSQL check
Collects database-wide metrics and optionally per-relation metrics, custom metrics.
"""
# stdlib
import socket
# 3rd party
try:
import psycopg2
except ImportError:
psycopg2 = None
im... | s-maj/integrations-core | postgres/check.py | Python | bsd-3-clause | 31,953 | 0.005164 |
#!/usr/bin/env python
# Nathan Rhoades 4/13/2021
import platform
import math
import bglib
import serial
import time
import datetime
import optparse
import signal
import sys
import struct
import importlib
class Bluegiga():
def __init__(self, dcb, ser, debugprint=False):
self.dcb = dcb
self.ser ... | nataddrho/DigiCue-USB | Python3/src/bgapi.py | Python | mit | 13,154 | 0.002585 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.contrib.auth.hashers import make_password
class Migration(DataMigration):
def forwards(self, orm):
"""Adds a user to be used for migrations."""
# ``make_passw... | safwanrahman/linuxdesh | kitsune/users/migrations/0006_add_migration_user.py | Python | bsd-3-clause | 7,501 | 0.007466 |
import abc
from framework.auth.decorators import collect_auth
from website.util import api_url_for, web_url_for
class AddonSerializer(object):
__metaclass__ = abc.ABCMeta
# TODO take addon_node_settings, addon_user_settings
def __init__(self, node_settings=None, user_settings=None):
self.node_se... | billyhunt/osf.io | website/addons/base/serializer.py | Python | apache-2.0 | 7,369 | 0.000679 |
"""Gaussian Mixture Model."""
# Author: Wei Xue <xuewei4d@gmail.com>
# Modified by Thierry Guillemot <thierry.guillemot.work@gmail.com>
# License: BSD 3 clause
import numpy as np
from scipy import linalg
from .base import BaseMixture, _check_shape
from ..externals.six.moves import zip
from ..utils import check_arra... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/sklearn/mixture/gaussian_mixture.py | Python | mit | 27,687 | 0 |
# /*******************************************************************************
# * (c) Andrew Robinson (andrewjrobinson@gmail.com) 2014 *
# * *
# * This file is part of SportsReview. ... | andrewjrobinson/SportsReview | sportsreview/support/qtlib/pyside.py | Python | lgpl-3.0 | 1,959 | 0.009188 |
{
'name': 'Website Gross/Net Price (B2B/B2C)',
'summary': 'Website Product Gross/Net Price (B2B/B2C)',
'category': 'Website',
'version': '1.0',
"sequence": 10,
'website': 'http://wt-io-it.at',
'author': 'WT-IO-IT GmbH',
'depends': ['website_sale_options', 'account_product_gross_net'],
... | initOS/odoo-addons | website_product_gross_net/__openerp__.py | Python | agpl-3.0 | 468 | 0 |
# Volatility
# Copyright (c) 2008-2013 Volatility Foundation
#
# This file is part of Volatility.
#
# Volatility 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 o... | fengxiaoiie/volatility | volatility/plugins/overlays/windows/win2003.py | Python | gpl-2.0 | 6,956 | 0.010926 |
#!/usr/bin/env python
# Copyright (c) 2017 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.
"""Utility for validating and inspecting origin trial tokens
usage: check_token.py [-h] [--use-chrome-key |
... | endlessm/chromium-browser | tools/origin_trials/check_token.py | Python | bsd-3-clause | 8,056 | 0.01142 |
# Copyright 2019 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... | xzturn/tensorflow | tensorflow/python/framework/op_callbacks_test.py | Python | apache-2.0 | 33,617 | 0.004194 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.