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
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import gzip
import cPickle as marshal
import optparse
import os
import sys
import xml.sax
def parse_type(type_string):
'''Get a tuple of the type components for a SWIG-formatted type.
For example, given the type "p.f(p.... | sangh/LaserShow | pyglet-hg/experimental/swigtypes/parse.py | Python | bsd-3-clause | 12,636 | 0.002137 |
""" Specify the NetworkNode with its action, context-menus """
# Copyright (C) 2009-2010, Ecole Polytechnique Federale de Lausanne (EPFL) and
# University Hospital Center and University of Lausanne (UNIL-CHUV)
#
# Modified BSD License
# Standard library imports
import os
# Enthought library imports
from traits.api im... | LTS5/connectomeviewer | cviewer/plugins/cff2/ui/cnetwork_tree_node.py | Python | bsd-3-clause | 2,792 | 0.011461 |
# Arithmetic tests for DataFrame/Series/Index/Array classes that should
# behave identically.
# Specifically for datetime64 and datetime64tz dtypes
from datetime import datetime, time, timedelta
from itertools import product, starmap
import operator
import warnings
import numpy as np
import pytest
import pytz
from pa... | TomAugspurger/pandas | pandas/tests/arithmetic/test_datetime64.py | Python | bsd-3-clause | 90,010 | 0.000644 |
""" ietf_netconf
NETCONF Protocol Data Types and Protocol Operations.
Copyright (c) 2011 IETF Trust and the persons identified as
the document authors. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject
to the license terms co... | 111pontes/ydk-py | core/ydk/services/ietf_netconf.py | Python | apache-2.0 | 60,135 | 0.01485 |
#! /usr/bin/env python
# -*- coding: UTF-8 -*-
from __future__ import division,print_function,absolute_import,unicode_literals
import sys
import os
os.chdir(sys.path[0])
sys.path.append('/mnt/sda2/github/TSF1KEV/TSFpy')
from TSF_io import *
#from TSF_Forth import *
from TSF_shuffle import *
from TSF_match import *
fro... | ooblog/TSF1KEV | TSFpy/debug/sample_help.py | Python | mit | 2,181 | 0.024759 |
#!/usr/bin/python
# Import modules for CGI handling
import cgi
from IPy import parseAddress, IP
import re
from subprocess import Popen, PIPE
# Create instance of FieldStorage
form = cgi.FieldStorage()
# Get data from fields
ip_address = form.getvalue('ip_address')
if form.getvalue('fqdn') == None:
fqdn = 'blank'
e... | clay584/dns-updater | dns-updater.py | Python | apache-2.0 | 6,247 | 0.024972 |
from datetime import datetime
import mongoengine
import elasticsearch
from elasticsearch import helpers
from models.employer import Employer
import models.term as Term
import shared.secrets as secrets
import shared.logger as logger
COMPONENT = 'Search'
elastic_instance = elasticsearch.Elasticsearch()
def index_... | Mo-Talha/Nomad | data/search/elastic.py | Python | mit | 7,634 | 0.001703 |
#
# 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... | nathanielvarona/airflow | airflow/migrations/versions/64a7d6477aae_fix_description_field_in_connection_to_.py | Python | apache-2.0 | 2,586 | 0.000387 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License... | sparkslabs/kamaelia_ | Sketches/RJL/Kamaelia/Community/RJL/Kamaelia/Protocol/HTTP/ErrorPages.py | Python | apache-2.0 | 3,275 | 0.011298 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('devices', '0012_auto_20140925_1540'),
]
operations = [
migrations.AlterField(
model_name='ap',
name=... | lindseypack/NIM | devices/migrations/0013_auto_20140925_1616.py | Python | mit | 981 | 0.004077 |
# Copyright 2011-2012 10gen, 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... | 0111001101111010/open-health-inspection-api | venv/lib/python2.7/site-packages/pymongo/common.py | Python | gpl-2.0 | 23,408 | 0.000299 |
# Copyright 2019 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.
"""Presubmit script for changes affecting tools/style_variable_generator/
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for mor... | endlessm/chromium-browser | tools/style_variable_generator/PRESUBMIT.py | Python | bsd-3-clause | 746 | 0 |
# -*- coding: utf-8 -*-
"""
Image processing and feature extraction functions.
"""
import cv2
import numpy as np
def pad_image(im, width, height, border=255):
"""pad char image in a larger image"""
xoff = abs(int((im.shape[1] - width) / 2))
yoff = abs(int((im.shape[0] - height) / 2))
if width >= ... | bdzimmer/handwriting | handwriting/improc.py | Python | bsd-3-clause | 7,094 | 0.000846 |
from django.contrib import admin
from models.snippets import Contact
@admin.register(Contact)
class ContactAdmin(admin.ModelAdmin):
pass
| kave/cfgov-refresh | cfgov/v1/admin.py | Python | cc0-1.0 | 143 | 0.013986 |
"""
# Majic
# Copyright (C) 2014 CEH
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This pr... | NERC-CEH/jules-jasmin | majic/joj/services/dataset.py | Python | gpl-2.0 | 13,566 | 0.003096 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2017 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, eith... | lem9/weblate | weblate/accounts/forms.py | Python | gpl-3.0 | 20,803 | 0 |
##############################################################################
#
# 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 | assessments/templatetags/score_display.py | Python | agpl-3.0 | 1,668 | 0.0018 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2017 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
class PRIORITY:
LOWEST = -100
LOWER = -50
LOW = -10
NORMAL = 0
HIGH = 10
HIGHER = 50
HIGHEST = 100
class SORT_ORDER:
FIRST = 0
SECOND = 1
... | michaelhidalgo/7WCSQ | Tools/SQLMap/sqlmap/lib/core/enums.py | Python | apache-2.0 | 10,079 | 0.004465 |
# Copyright (c) 2006-2015 LOGILAB S.A. (Paris, FRANCE) <contact@logilab.fr>
# Copyright (c) 2012-2014 Google, Inc.
# Copyright (c) 2013 buck@yelp.com <buck@yelp.com>
# Copyright (c) 2014-2020 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (c) 2014 Brett Cannon <brett@python.org>
# Copyright (c) 2014 Arun Persaud <aru... | ruchee/vimrc | vimfiles/bundle/vim-python/submodules/pylint/pylint/checkers/imports.py | Python | mit | 38,570 | 0.001037 |
# encoding: 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 field 'UserRole.order'
db.add_column('core_userrole', 'order', self.gf('django.db.models.fields.I... | chrizel/onpsx | src/onpsx/core/migrations/0004_auto__add_field_userrole_order__add_field_userprofile_order.py | Python | gpl-3.0 | 5,858 | 0.008194 |
#CHIPSEC: Platform Security Assessment Framework
#Copyright (c) 2010-2016, Intel Corporation
#
#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.
#
#This program is distributed in the hope... | chipsecintel/chipsec | source/tool/chipsec/modules/tools/vmm/hv/define.py | Python | gpl-2.0 | 23,148 | 0.007776 |
from clawpack.petclaw.solution import Solution
#from petclaw.io.petsc import read_petsc
import matplotlib
matplotlib.use('Agg')
import matplotlib.pylab as pl
from matplotlib import rc
#rc('text', usetex=True)
import numpy as np
import os
def write_slices(frame,file_prefix,path,name):
sol=Solution(frame,file_format... | ketch/effective_dispersion_RR | numerical_experiments/1D-propagation/FV_solution/sinusoidal/normal/write_slice.py | Python | bsd-2-clause | 788 | 0.045685 |
#!/usr/bin/python2
'''
Implemting grep in python in less than 10 lines of code...
'''
import re # for compile, finditer
import sys # for argv
# command line usage...
if len(sys.argv) < 3:
print('usage: grep.py [expr] [files...]')
sys.exit(1)
# first compile the regular expression...
c = re.compile(sys.argv... | nonZero/demos-python | src/examples/short/technology/grep.py | Python | gpl-3.0 | 459 | 0 |
#!/opt/jusers/venv/bin/python3
import grp
import os
import pwd
import random
import spwd
import subprocess
import sys
import click
from concurrent.futures import ProcessPoolExecutor
from ruamel.yaml import YAML
PROJECT = '/project'
DRY_RUN = False
VERBOSE = False
USERSDB = '/root/jusers.yml'
PWDLENG = 10
# PLUGINS... | ICOS-Carbon-Portal/infrastructure | devops/roles/icos.jupyter/files/jusers.py | Python | gpl-3.0 | 11,637 | 0.001203 |
# coding=utf-8
from __future__ import division, print_function
import datetime as dt
import math
import os
import random
import faker
from vfp2py import vfpfunc
from vfp2py.vfpfunc import DB, Array, C, F, M, S, lparameters, parameters, vfpclass
@lparameters()
def MAIN():
pass
@lparameters()
def select_tests()... | mwisslead/vfp2py | testbed/test_lib.py | Python | mit | 13,352 | 0.002097 |
from collections import OrderedDict
from PyQt4 import QtGui
from PyQt4.QtCore import Qt
from Orange.data import Table
from Orange.classification.svm import SVMLearner, NuSVMLearner
from Orange.widgets import settings, gui
from Orange.widgets.utils.owlearnerwidget import OWBaseLearner
class OWBaseSVM(OWBaseLearner):... | qPCR4vir/orange3 | Orange/widgets/classify/owsvmclassification.py | Python | bsd-2-clause | 7,592 | 0.000264 |
"""
homeassistant.components.demo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sets up a demo environment that mimics interaction with devices.
"""
import time
import homeassistant.core as ha
import homeassistant.bootstrap as bootstrap
import homeassistant.loader as loader
from homeassistant.const import (
CONF_PLATFORM, ATTR_E... | tomduijf/home-assistant | homeassistant/components/demo.py | Python | mit | 5,021 | 0 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016-2017 Ircam
# Copyright (c) 2016-2017 Guillaume Pellerin
# Copyright (c) 2016-2017 Emilie Zawadzki
# This file is part of mezzanine-organization.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public L... | Ircam-Web/mezzanine-organization | organization/job/test/tests.py | Python | agpl-3.0 | 10,376 | 0.001157 |
# Copyright 2022 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 ... | magenta/note-seq | note_seq/constants.py | Python | apache-2.0 | 2,620 | 0 |
# -*- coding: utf-8 -*-
# author: bambooom
'''
My Diary Web App - CLI for client
'''
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import requests
from bs4 import BeautifulSoup
import re
HELP = '''
Input h/help/? for help.
Input q/quit to quit the process.
Input s/sync to sync the diary log.
Input lt/List... | bambooom/OMOOC2py | _src/om2py5w/5wex0/client.py | Python | mit | 2,054 | 0.039435 |
# -*- coding: utf8 -*-
import base64
import hashlib
import io
import nose
import requests
import aliyunauth.utils
import aliyunauth.consts
def test_cal_b64md5():
s_data = b"foo"
l_data = b"bar" * aliyunauth.consts.MD5_CHUNK_SIZE
# normal data, None
nose.tools.eq_(aliyunauth.utils.cal_b64md5(None), ... | SkyLothar/requests-aliyun | tests/test-utils.py | Python | apache-2.0 | 2,134 | 0 |
from collections import namedtuple
import configparser
from functools import lru_cache
import unittest
from unittest.mock import patch, mock_open
import transaction
import testing.postgresql
import webtest
import datetime
from pyramid.config import Configurator
from pyramid.paster import get_app
from sqlalchemy import ... | colinhiggs/pyramid-jsonapi | test_project/test_project/tests.py | Python | agpl-3.0 | 143,952 | 0.001765 |
"""
Test grade calculation.
"""
import ddt
from django.conf import settings
from django.http import Http404
from django.test import TestCase
from mock import patch, MagicMock
from nose.plugins.attrib import attr
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from opaque_keys.edx.locator import CourseLoc... | louyihua/edx-platform | lms/djangoapps/grades/tests/test_grades.py | Python | agpl-3.0 | 18,149 | 0.000937 |
#
# Generated by TigerShark.tools.convertPyX12 on 2012-07-10 16:29:58.682345
#
from tigershark.X12.parse import Message, Loop, Segment, Composite, Element, Properties
parsed_277U_HEADER = Loop( u'HEADER', Properties(looptype=u'wrapper',repeat=u'1',pos=u'015',req_sit=u'R',desc=u'Table 1 - Header'),
Segment( u'BHT', Prop... | jdavisp3/TigerShark | tigershark/parsers/M277U_4010_X070.py | Python | bsd-3-clause | 49,720 | 0.052474 |
#!/usr/bin/env python
# pylint: disable=R0903
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2022
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public L... | tzpBingo/github-trending | codespace/python/telegram/poll.py | Python | mit | 12,268 | 0.004239 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: Gazetteer.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _ref... | apple/coremltools | coremltools/proto/Gazetteer_pb2.py | Python | bsd-3-clause | 4,337 | 0.007148 |
# -*- coding: utf-8 -*-
"""Setup the SkyLines application"""
from faker import Faker
from skylines.model import User
def test_admin():
u = User()
u.first_name = u'Example'
u.last_name = u'Manager'
u.email_address = u'manager@somedomain.com'
u.password = u.original_password = u'managepass'
u.a... | kerel-fs/skylines | tests/data/users.py | Python | agpl-3.0 | 1,007 | 0 |
from common2 import *
# NAME IDEA -> pooling/random/sparse/distributed hebbian/horde/crowd/fragment/sample memory
# FEATURES:
# + boost -- neurons with empty mem slots learn faster
# + noise --
# + dropout -- temporal disabling of neurons
# + decay -- remove from mem
# + negatives -- learning to avoid detecting some... | mobarski/sandbox | rsm/v9le/v5.py | Python | mit | 8,419 | 0.049056 |
# This file contains the arcpy funcitons that export rasters and shape files
# These were removed from the production script because they are not used.
# I'm saving them here just in case..
# The function array2raster uses arcpy to output a raster from the VIIRS array.
# This function DOES NOT handle the pixel size ... | firelab/viirs_ba | misc_utils/arcpy_functions.py | Python | cc0-1.0 | 4,645 | 0.010549 |
from unittest.mock import Mock
import sqlalchemy as sa
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy import String
from sqlalchemy import testing
from sqlalchemy.orm import query
from sqlalchemy.orm import relationship
from sqlalchemy.orm import scoped_session
from sqlalchemy.orm imp... | sqlalchemy/sqlalchemy | test/orm/test_scoping.py | Python | mit | 7,276 | 0.000412 |
# helper functions
import numpy as np
import matplotlib.pyplot as plt
import os
import pandas as pd
from diffpy.Structure import loadStructure
from pyobjcryst.crystal import CreateCrystalFromCIF
from diffpy.srreal.bondcalculator import BondCalculator
from diffpy.srreal.pdfcalculator import PDFCalculator
from diffpy.... | chiahaoliu/pdf_lib | pdf_lib/pdf_helper.py | Python | mit | 3,994 | 0.017526 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010 Zikzakmedia S.L. (http://www.zikzakmedia.com)
# Copyright (c) 2010 Pexego Sistemas Informáticos S.L. (http://www.pexego.es)
# @authors: Jordi Esteve (Zikzakmedia), Borja López Soilán (P... | savoirfairelinux/account-financial-tools | account_chart_update/wizard/wizard_chart_update.py | Python | agpl-3.0 | 67,528 | 0.001274 |
from os import path
from .taskqueue import TaskQueueClient
__all__ = ['TaskQueueClient']
with open(path.join(path.dirname(__file__), 'version.txt')) as fp:
__version__ = fp.read().strip()
| guokr/asynx | asynx/asynx/__init__.py | Python | mit | 194 | 0 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ProcessingToolbox.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*********************... | luofei98/qgis | python/plugins/processing/gui/ProcessingToolbox.py | Python | gpl-2.0 | 16,100 | 0.000683 |
""" Execute this file to launch Rekoder. Refer to README.md for usage. """
# Rekoder modules
from core.app import App
if __name__ == '__main__':
# Load configuration file and start application.
app = App()
app.load_json_config('config.json')
app.start()
| mcjlnrtwcz/Rekoder | rekoder.py | Python | mit | 272 | 0 |
import pytest
import unittest
from fs_radar.path_filter import makePathFilter, makeDirFilter
class MakePathFilterTest(unittest.TestCase):
def test_empty_rules(self):
f = makePathFilter([])
assert f('') is False
assert f('foo.txt') is False
def test_file_at_any_depth(self):
... | riquito/fs-radar | tests/test_path_filter.py | Python | gpl-3.0 | 6,014 | 0 |
# -*- coding: utf-8
from __future__ import unicode_literals, absolute_import
from django.conf.urls import url, include
from unach_photo_server.urls import urlpatterns as unach_photo_server_urls
urlpatterns = [
url(r'^', include(unach_photo_server_urls, namespace='unach_photo_server')),
]
| javierhuerta/unach-photo-server | tests/urls.py | Python | mit | 296 | 0.003378 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2016 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2016 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2016 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2016 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program is free software: you can r... | xdevelsistemas/taiga-back-community | taiga/projects/attachments/__init__.py | Python | agpl-3.0 | 1,012 | 0 |
# Install.py -- File system installation commands
# Copyright (C) 2007-2013 CEA
#
# This file is part of shine
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License... | cea-hpc/shine | lib/Shine/Commands/Install.py | Python | gpl-2.0 | 4,458 | 0.001795 |
# Copyright (C) 2001-2006 Python Software Foundation
# Author: Barry Warsaw
# Contact: email-sig@python.org
"""Various types of useful iterators and generators."""
__all__ = [
'body_line_iterator',
'typed_subpart_iterator',
'walk',
# Do not include _structure() since it's part of the debugging API.
... | lfcnassif/MultiContentViewer | release/modules/ext/libreoffice/program/python-core-3.3.0/lib/email/iterators.py | Python | lgpl-3.0 | 2,205 | 0.002268 |
from pygame import *
from res import createImage, playSound
class Room():
def __init__(self, levelSize, spritePath):
self.level = Surface(levelSize)
self.levelRect = self.level.get_rect()
self.levelUnlocked = False
self.levelCleared = False
self.spike = crea... | aouerfelli/SuperDD-Python | res/Room.py | Python | mit | 8,839 | 0.006788 |
"""
Util classes
------------
Classes which represent data types useful for the package pySpatialTools.
"""
## Spatial elements collectors
from spatialelements import SpatialElementsCollection, Locations
## Membership relations
from Membership import Membership
| tgquintela/pySpatialTools | pySpatialTools/utils/util_classes/__init__.py | Python | mit | 266 | 0.007519 |
#
# ti-sac.py is a Titanium plug-in for Sublime Text 3
#
# developed by Steve Rogers, SpiralArm Consulting Ltd (www.spiralarm.uk)
# @sarmcon
#
#
import sublime, sublime_plugin, os
import Titanium.lib.tiutils as Ti
# This will create a new Alloy Widget
class sacAlloyWidgetCommand(sublime_plugin.WindowCommand):
def ... | magnatronus/titanium-sac | titanium-sac.py | Python | mit | 4,652 | 0.025795 |
import sys
import click
from tabulate import tabulate
from . import admin
from ...session import Session
from ..pretty import print_error, print_fail
@admin.command()
@click.option('-n', '--name', type=str, default=None,
help='Name of the resource policy.')
def resource_policy(name):
"""
Show ... | lablup/sorna-client | src/ai/backend/client/cli/admin/resource_policies.py | Python | lgpl-3.0 | 8,377 | 0.000716 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# 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 versio... | boedy1996/SPARC | geonode/geoserver/helpers.py | Python | gpl-3.0 | 54,697 | 0.000896 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... | jmcnamara/XlsxWriter | xlsxwriter/test/comparison/test_chart_format23.py | Python | bsd-2-clause | 1,541 | 0 |
# simple binary tree
# in this implementation, a node is inserted between an existing node and the root
class BinaryTree():
def __init__(self,rootid):
self.left = None
self.right = None
self.rootid = rootid
def getLeftChild(self):
return self.left
def getRightChild(self):... | roshantha9/AbstractManycoreSim | src/libApplicationModel/SimpleBinaryTree.py | Python | gpl-3.0 | 2,226 | 0.014376 |
# wget http://stuff.mit.edu/afs/sipb/contrib/pi/pi-billion.txt
# THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32 python example009.py
from __future__ import division
import numpy as np
import theano
import theano.tensor as T
import lasagne as L
import argparse
import time
from six.moves import cPickle
np.set_print... | mattliston/examples | example009.py | Python | mit | 5,626 | 0.013686 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# pycasso documentation build configuration file, created by
# sphinx-quickstart on Sun Sep 24 01:54:19 2017.
#
# 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
# au... | jasonge27/picasso | python-package/doc/source/conf.py | Python | gpl-3.0 | 5,024 | 0.000796 |
# Copyright 2015 NEC 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 o... | nis-sdn/odenos | apps/cli/producer.py | Python | apache-2.0 | 16,458 | 0.006744 |
import endpoints
from api_user import UserAPI
from api_posts import PostsAPI
from api_comments import ReactionAPI
from api_image import ImageAPI
APPLICATION = endpoints.api_server([PostsAPI, ReactionAPI, UserAPI, ImageAPI]) | secret-transaction/RipOff9Gag | server/ripoff9gag/api.py | Python | apache-2.0 | 225 | 0.004444 |
import json
import os
from urlparse import urlparse
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.core.urlresolvers import resolve
from django.http import Http404
from django.shortcuts import render
from django.utils import translation
from django.views.d... | Jobava/zamboni | mkt/commonplace/views.py | Python | bsd-3-clause | 6,014 | 0.000166 |
""" Copyright (C) 2015 Sebastian Otalora
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the h... | sebastianffx/active_deep_segmentation | flickrsearch.py | Python | gpl-2.0 | 2,457 | 0.014652 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | addition-it-solutions/project-all | addons/account_budget/__openerp__.py | Python | agpl-3.0 | 3,013 | 0.003319 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-07 08:13
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations
import djstripe.fields
class Migration(migrations.Migration):
dependencies = [
('djstripe', '0020_auto_20161229_0041'),
]
... | tkwon/dj-stripe | djstripe/migrations/0021_auto_20170107_0813.py | Python | mit | 865 | 0.001156 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import sys
import os
import hnbot
class HnbotMessage(unittest.TestCase):
def testTooLarge(self):
"""test should fail if message size is bigger than 140 characters"""
self.assertEqual(1,1)
if __name__ == "__main__":
unittest.main()
| aayoubi/HNTwitter-bot | hnbot/test/test_hnbot.py | Python | gpl-3.0 | 306 | 0.022876 |
'''
Biggest Sum from Top left to Bottom Right
'''
def find_sum(m):
p = [0] * (len(m) + 1)
for l in m:
for i, v in enumerate(l, 1):
p[i] = v + max(p[i-1], p[i])
return p[-1]
matrix = [[20, 20, 10, 10],
[10, 20, 10, 10],
[10, 20, 20, 20],
[10, 10, 10, 20]]... | anilpai/leetcode | Codewars/BiggestSum.py | Python | mit | 353 | 0.002833 |
# -*- coding: utf-8 -*-
import base64
import time
import simplejson as json
from eventlet.green import urllib2
import urllib
from kral import config
def stream(queries, queue, kral_start_time):
url = 'https://stream.twitter.com/1/statuses/filter.json'
queries = [q.lower() for q in queries]
quoted_querie... | lrvick/kral | kral/services/twitter.py | Python | agpl-3.0 | 2,819 | 0.009933 |
# coding: utf-8
import configureEnvironnement
configureEnvironnement.setup()
import django
django.setup()
from datetime import datetime, date, timedelta
from chambres.models import Reservation, Client
from chambres.views import OneDayStats
rs = Reservation.objects.all()
for r in rs:
if r.dateArrivee > r.dateDep... | simonpessemesse/seguinus | chambres_chercheErreurDate.py | Python | gpl-2.0 | 361 | 0.01108 |
import logging
from collections import Counter
from udata.commands import cli, header, success
log = logging.getLogger(__name__)
@cli.group('images')
def grp():
'''Images related operations'''
pass
def render_or_skip(obj, attr):
try:
getattr(obj, attr).rerender()
obj.save()
re... | opendatateam/udata | udata/commands/images.py | Python | agpl-3.0 | 2,037 | 0 |
# Generated by Django 2.0.4 on 2019-07-16 21:18
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('scheduler', '0009_auto_20190607_1518'),
]
operations = [
migrations.RenameField(
model_name='smpost',
old_name='post_instagr... | daily-bruin/meow | meow/scheduler/migrations/0010_auto_20190716_1418.py | Python | agpl-3.0 | 382 | 0 |
#!/usr/bin/env python3
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
r"""Calculate Round Constant
"""
import argparse
import bitarray as ba
import logging as log
def main():
parser = argparse.ArgumentParser(
... | lowRISC/opentitan | util/design/keccak_rc.py | Python | apache-2.0 | 1,923 | 0.00312 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/ship/components/armor/shared_arm_mandal_enhanced_heavy_composite.iff... | anhstudios/swganh | data/scripts/templates/object/tangible/ship/components/armor/shared_arm_mandal_enhanced_heavy_composite.py | Python | mit | 514 | 0.042802 |
# Copyright 2004-2008 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# The initial version of the directory_cache_t class was written
# by Matthias Baas (baas@ira.uka.de).
"""Directory c... | avaitla/Haskell-to-C---Bridge | pygccxml-1.0.0/pygccxml/parser/directory_cache.py | Python | bsd-3-clause | 18,986 | 0.003476 |
#!/usr/bin/env python
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that ... | PandaWei/avocado | avocado/utils/software_manager.py | Python | gpl-2.0 | 32,607 | 0.000123 |
#!/usr/bin/env python
import sys
from pfsense_api import PfSenseAPI
from datetime import datetime
from pfsense_cmdline import PfSenseOptionParser
from ConfigParser import ConfigParser
from pfsense_logger import PfSenseLogger as logging
import os.path
parser = PfSenseOptionParser()
parser.add_option("--id", dest="c... | stanleyz/pfsense-2.x-tools | pfsense-updateCRL.py | Python | gpl-2.0 | 2,863 | 0.008732 |
import multiprocessing
from setuptools import setup, find_packages
from ber_kit import __version__
setup(name='ber-kit',
version= __version__,
description='Toolkit to manage rolling upgrades on a Marathon cluster',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Deve... | chuckwired/ber-kit | setup.py | Python | gpl-3.0 | 1,036 | 0.007722 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys, traceback
import threading
import time
import simplejson as json
import urllib2
from PyQt4 import QtGui,QtCore
from boardlet import Boardlet
from modellet import Modellet
class MoneroTicker(Boardlet):
def __init__(self, parent, btcusd):
super(Mon... | bitsanity/rateboard | moneroticker.py | Python | apache-2.0 | 2,777 | 0.022686 |
"""Benchmark Walk algorithm"""
import numpy as np
import bench
import obsoper.walk
class BenchmarkWalk(bench.Suite):
def setUp(self):
longitudes, latitudes = np.meshgrid([1, 2, 3],
[1, 2, 3],
indexing="ij")
sel... | met-office-ocean/obsoper | benchmarks/bench_walk.py | Python | bsd-3-clause | 551 | 0 |
from boxbranding import getBoxType, getMachineProcModel, getMachineBuild
from os import path
from enigma import eDVBResourceManager, Misc_Options
from Tools.Directories import fileExists, fileCheck
from Tools.HardwareInfo import HardwareInfo
SystemInfo = { }
#FIXMEE...
def getNumVideoDecoders():
idx = 0
while fi... | schleichdi2/OpenNfr_E2_Gui-6.0 | lib/python/Components/SystemInfo.py | Python | gpl-2.0 | 3,888 | 0.010031 |
from pale.fields.string import StringField
class TimestampField(StringField):
"""A field for timestamp strings."""
value_type = 'timestamp'
# TODO - timestamp field rendering
| Loudr/pale | pale/fields/timestamp.py | Python | mit | 189 | 0.005291 |
# coding: utf-8
"""
Copyright 2015 SmartBear Software
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... | jlongever/redfish-client-python | on_http_redfish_1_0/models/thermal_1_0_0_temperature.py | Python | apache-2.0 | 8,295 | 0.00217 |
#
# 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, software
# ... | cryptickp/heat | heat/engine/clients/os/keystone.py | Python | apache-2.0 | 5,676 | 0 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Static()
result.template = "object/static/naboo/shared_waterfall_naboo_falls_01.iff"
result.attribute_template_id... | anhstudios/swganh | data/scripts/templates/object/static/naboo/shared_waterfall_naboo_falls_01.py | Python | mit | 450 | 0.046667 |
# Copyright 2018 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... | jart/tensorflow | tensorflow/contrib/autograph/core/errors.py | Python | apache-2.0 | 10,511 | 0.007326 |
# Copyright (c) 2011-2013, ImageCat Inc.
#
# 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 License, or
# (at your option) any later version.
#
# This program is... | gem/sidd | utils/xml.py | Python | agpl-3.0 | 862 | 0.011601 |
#!/usr/bin/env python
#
# This file is part of pyasn1-modules software.
#
# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com>
# License: http://snmplabs.com/pyasn1/license.html
#
# Read X.509 CRL on stdin, print them pretty and encode back into
# original wire format.
# CRL can be generated with "openssl opens... | kawamon/hue | desktop/core/ext-py/pyasn1-modules-0.2.6/tools/crldump.py | Python | apache-2.0 | 1,086 | 0.001842 |
# Copyright (C) 2008-2014 Bastian Kleineidam
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distr... | linkcheck/linkchecker | linkcheck/htmlutil/__init__.py | Python | gpl-2.0 | 770 | 0 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, unicode_literals, print_function
import logging
from collections import OrderedDict
import numpy as np
from monty.json import jsanitize
from pymatgen.phonon.bandstructure impo... | matk86/pymatgen | pymatgen/phonon/plotter.py | Python | mit | 15,693 | 0.000828 |
import click
import inflection
import os
def default(txt):
return click.style(txt, fg="white", bold=True)
def prompt(txt):
return click.style(txt, fg="green")
@click.command()
@click.argument("name")
@click.option("--description", prompt=prompt("Description"), default=default("N/A"))
@click.option(
"-... | aleontiev/django-cli | djay/blueprints/init/context.py | Python | mit | 1,263 | 0.001584 |
"""Tests for the nut integration."""
import json
from unittest.mock import MagicMock, patch
from homeassistant.components.nut.const import DOMAIN
from homeassistant.const import CONF_HOST, CONF_PORT, CONF_RESOURCES
from homeassistant.core import HomeAssistant
from tests.common import MockConfigEntry, load_fixture
... | aronsky/home-assistant | tests/components/nut/util.py | Python | apache-2.0 | 1,446 | 0.002075 |
# This is STMcmc, for super tree mcmc.
# Started 18 March 2011, first commit 22 March 2011.
import pf,func
from Var import var
import math,random,string,sys,time,copy,os,cPickle,types,glob
import numpy as np
from Glitch import Glitch
from TreePartitions import TreePartitions
from Constraints import Constraints
from Tr... | Linhua-Sun/p4-phylogenetics | p4/STMcmc.py | Python | gpl-2.0 | 122,106 | 0.005135 |
from pyotp.otp import OTP
from pyotp import utils
class HOTP(OTP):
def at(self, count):
"""
Generates the OTP for the given count
@param [Integer] count counter
@returns [Integer] OTP
"""
return self.generate_otp(count)
def verify(self, otp, counte... | toefl/pyotp | src/pyotp/hotp.py | Python | mit | 1,325 | 0.000755 |
#! /usr/bin/env python
# -*- mode: python; indent-tabs-mode: nil; -*-
# vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
#
# Copyright (C) 2010,2011 Patrick Crews
#
# 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 Soft... | kraziegent/mysql-5.6 | xtrabackup/test/kewpie/lib/server_mgmt/drizzled.py | Python | gpl-2.0 | 9,584 | 0.019825 |
# Copyright 2015 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.
"""Provides a layer of abstraction for the issue tracker API."""
import json
import logging
from apiclient import discovery
from apiclient import errors
_... | sahiljain/catapult | dashboard/dashboard/services/issue_tracker_service.py | Python | bsd-3-clause | 8,780 | 0.005353 |
item_id = 4986168
user_id = 20000
item_category = 9656
time = 31
| CharLLCH/jianchi_alimobileR | ftrldata/TCReBuild/codes/mylibs/size.py | Python | gpl-2.0 | 65 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-29 19:01
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('books', '0003_initial_subjects_languages_creatortypes'),
]
operations = [
migration... | Princeton-CDH/winthrop-django | winthrop/books/migrations/0004_unique_together_sort.py | Python | apache-2.0 | 1,351 | 0 |
"""
SH shell
"""
import os
import os.path
import pipes
import subprocess
from rez.config import config
from rez.utils.platform_ import platform_
from rez.shells import Shell, UnixShell
from rez.rex import EscapedString
class SH(UnixShell):
norc_arg = '--noprofile'
histfile = "~/.bash_history"
histvar = "H... | saddingtonbaynes/rez | src/rezplugins/shell/sh.py | Python | gpl-3.0 | 4,324 | 0.00185 |
"""
Solution to simple TensorFlow exercises
For the problems
"""
import tensorflow as tf
###############################################################################
# 1a: Create two random 0-d tensors x and y of any distribution.
# Create a TensorFlow object that returns x + y if x > y, and x - y otherwise.
# Hin... | YeEmrick/learning | stanford-tensorflow/2017/assignments/exercises/e01_sol.py | Python | apache-2.0 | 4,765 | 0.004827 |
import warnings
import itertools
import sys
import pytest
import numpy as np
import numpy.core._umath_tests as umt
import numpy.linalg._umath_linalg as uml
import numpy.core._operand_flag_tests as opflag_tests
import numpy.core._rational_tests as _rational_tests
from numpy.testing import (
assert_, assert_equal, ... | numpy/numpy | numpy/core/tests/test_ufunc.py | Python | bsd-3-clause | 105,354 | 0.000816 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.