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 |
|---|---|---|---|---|---|---|
import os, sys, array
import numpy as np
class BigFile:
def __init__(self, datadir):
self.nr_of_images, self.ndims = map(int, open(os.path.join(datadir,'shape.txt')).readline().split())
id_file = os.path.join(datadir, "id.txt")
self.names = open(id_file).read().strip().split()
asse... | li-xirong/jingwei | util/simpleknn/bigfile.py | Python | mit | 3,569 | 0.009526 |
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import assert_array_almost_equal
from scipy.sparse.csgraph import breadth_first_tree, depth_first_tree,\
csgraph_to_dense, csgraph_from_dense
def test_graph_breadth_first():
csgraph = np.array([[0, 1, 2, 0,... | jlcarmic/producthunt_simulator | venv/lib/python2.7/site-packages/scipy/sparse/csgraph/tests/test_traversal.py | Python | mit | 2,390 | 0 |
from HG_Code.HG_Test import UnitTest as UT
from HG_Code import Model as mo
from HG_Code.Visualize import Visualizer
from HG_Code.SimManager import sim_manager
from HG_Code.Hunger_Grid import hunger_grid
from HG_Code.Kat import Kat
from HG_Code import hg_settings
from HG_Code import Mutate as mu
unitTest = UT.Run_Unit_... | TeamADEA/Hunger_Games | HG_Driver.py | Python | mit | 1,353 | 0.01626 |
"""Start a tcp gateway."""
import click
from mysensors.cli.helper import (
common_gateway_options,
handle_msg,
run_async_gateway,
run_gateway,
)
from mysensors.gateway_tcp import AsyncTCPGateway, TCPGateway
def common_tcp_options(func):
"""Supply common tcp gateway options."""
func = click.op... | theolind/pymysensors | mysensors/cli/gateway_tcp.py | Python | mit | 1,102 | 0 |
"""
Type variables for Parametric polymorphism.
Cretonne instructions and instruction transformations can be specified to be
polymorphic by using type variables.
"""
from __future__ import absolute_import
import math
from . import types, is_power_of_two
from copy import copy
try:
from typing import Tuple, Union, ... | sunfishcode/cretonne | lib/cretonne/meta/cdsl/typevar.py | Python | apache-2.0 | 30,326 | 0.000132 |
"""
Open CarPool is a free and open source carpooling/dynamic ride sharing
system, open to be connected to other car pools and public transport.
Copyright (C) 2009-2014 Julian Rath, Oliver Pintat
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License... | amife/carpool | service/src/call2ride/interface.py | Python | gpl-3.0 | 62,939 | 0.018145 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import
CSV_DEFAULT_SEP = ','
CSV_DEFAULT_LF = '\n'
def append_same_length(columns, data):
if columns != []:
return len(columns) == len(data)
return True
class DataBuffer(object):
def __init__(self, csv_... | scls19fr/openchrono | openchrono/databuffer.py | Python | gpl-3.0 | 1,914 | 0.009404 |
#!python
"""
Update the astrometric and photometric measurements of an mpc observation based on the header contents of the
observation.
"""
from copy import deepcopy
import time
from astropy import units
import os
import math
import numpy
import logging
import re
import mp_ephem
from ossos import storage, wcs, astrom
f... | OSSOS/MOP | src/ossos/core/ossos/pipeline/update_astrometry.py | Python | gpl-3.0 | 19,113 | 0.006017 |
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../tools'))
import files
import table
import genetics
def main(argv):
int_mass = table.integer_mass(argv[0])
lines = files.read_lines(argv[1])
leaderboard = [([int_mass[p] for p in peptide], peptide) for peptide in lin... | cowboysmall/rosalind | src/textbook/rosalind_ba4l.py | Python | mit | 569 | 0.015817 |
from .mdl_user import *
from .mdl_club import *
from .mdl_event import *
from .mdl_receipt import *
from .mdl_budget import *
from .mdl_division import *
from .mdl_eventsignin import *
from .mdl_joinrequest import *
| fsxfreak/club-suite | clubsuite/suite/models/__init__.py | Python | mit | 216 | 0 |
# -*- coding: utf-8 -*-
# Copyright 2008-2014 Jaap Karssenberg <jaap.karssenberg@gmail.com>
# 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 optio... | fabricehong/zim-desktop | zim/__init__.py | Python | gpl-2.0 | 7,256 | 0.008131 |
# -*- coding: utf-8 -*-
##
## This file is part of intbitset.
## Copyright (C) 2007, 2008, 2009, 2010, 2011, 2013, 2014 CERN.
##
## intbitset 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 ... | crepererum/intbitset | tests/test_intbitset.py | Python | gpl-2.0 | 24,902 | 0.002972 |
import logging
import winreg
from nativeconfig.configs.base_config import BaseConfig
LOG = logging.getLogger('nativeconfig')
ERROR_NO_MORE_ITEMS = 259
ERROR_NO_MORE_FILES = 18
def traverse_registry_key(key, sub_key):
"""
Traverse registry key and yield one by one.
@raise WindowsError: If key cannot b... | GreatFruitOmsk/nativeconfig | nativeconfig/configs/registry_config.py | Python | mit | 5,235 | 0.004585 |
# Copyright 2014 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 ... | ychen820/microblog | y/google-cloud-sdk/platform/gsutil/third_party/oauth2client/oauth2client/tools.py | Python | bsd-3-clause | 8,468 | 0.006731 |
import os
import subprocess
from pymongo import MongoClient
from flask import Flask, redirect, url_for, request, flash
from flask_bootstrap import Bootstrap
from flask_mongoengine import MongoEngine
from flask_modular_auth import AuthManager, current_authenticated_entity, SessionBasedAuthProvider, KeyBasedAuthProvider... | mass-project/mass_server | mass_flask_config/app.py | Python | mit | 2,133 | 0.002344 |
# -*- coding: utf-8 -*-
#
# iago documentation build configuration file, created by
# sphinx-quickstart on Wed Sep 28 18:57:03 2016.
#
# 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 ... | ferchault/iago | docs/conf.py | Python | mit | 8,700 | 0.006897 |
# -*- coding: utf-8 -*-
#
# 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
#... | malmiron/incubator-airflow | tests/operators/test_http_operator.py | Python | apache-2.0 | 1,793 | 0 |
# -*- coding:utf-8 -*-
# This code is automatically transpiled by Saklient Translator
import six
from ..client import Client
from .model import Model
from ..resources.resource import Resource
from ..resources.routerplan import RouterPlan
from ...util import Util
import saklient
str = six.text_type
# module saklient.... | sakura-internet/saklient.python | saklient/cloud/models/model_routerplan.py | Python | mit | 3,430 | 0.0117 |
from tile_view import *
from table import *
from game_state import *
from circ_button import *
class TableView:
GREY = (100,100,100)
BLACK = (0,0,0)
WHITE = (255,255,255)
BGCOLOR = (60,60,100)
TILE_COLOR = (90, 255, 90)
TILE_RADIUS = 30
TABLE_POS = (245, 90)
# table : Table
# pl1,... | lipk/pyzertz | pyzertz/table_view.py | Python | apache-2.0 | 3,483 | 0.014643 |
import flask
import MemeRepo.db as db
import MemeRepo.funcs as fnc
from MemeRepo.config import config
def handle(code, uri):
result = db.get_file(uri)
if result == None:
return flask.render_template("error.html", msg="That file does not exist", code="400"), 400
else:
if result['ow... | carcinogoy/MemeRepo | MemeRepo/delete.py | Python | mit | 517 | 0.009671 |
# 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... | sxjscience/tvm | apps/topi_recipe/gemm/android_gemm_square.py | Python | apache-2.0 | 4,440 | 0.00045 |
import arcpy, os, json, csv
from portal import additem, shareItem, generateToken, getUserContent, updateItem, getGroupID, deleteItem, getGroupContent
from metadata import metadata
from ESRImapservice import ESRImapservice
class csvportal(object):
def __init__(self, user, password, portal, worksspace, group... | warrieka/portal4argis_tools | portal/csvportal.py | Python | mit | 4,761 | 0.018694 |
# -*- coding: mbcs -*-
# Created by makepy.py version 0.5.01
# By python version 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit (AMD64)]
# From type library '{C866CA3A-32F7-11D2-9602-00C04F8EE628}'
# On Fri Jun 30 10:48:37 2017
'Microsoft Speech Object Library'
makepy_version = '0.5.01'
python_version = 0x20... | kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/win32com/gen_py/C866CA3A-32F7-11D2-9602-00C04F8EE628x0x5x4.py | Python | gpl-3.0 | 308,803 | 0.056677 |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils.nestedset import NestedSet, get_root_of
class SupplierGroup(NestedSet):
nsm_parent_field = 'parent_sup... | ovresko/erpnext | erpnext/setup/doctype/supplier_group/supplier_group.py | Python | gpl-3.0 | 639 | 0.017214 |
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 9 21:31:53 2015
Create random synthetic velocity profile + linear first guesses
@author: alex
"""
import random
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
def savitzky_golay(y, window_size, order, deriv=0, rate=1):
r... | bottero/IMCMCrun | examples/Synthetic1/createSyntheticRandomProfile.py | Python | mit | 6,749 | 0.017188 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | mfherbst/spack | lib/spack/spack/repo.py | Python | lgpl-2.1 | 42,050 | 0.000143 |
import glob
import operational_instruments
from astropy.io import fits
from numpy.fft import fft2, ifft2
import sewpy
from astropy import wcs
from astropy.table import Table
from astropy.io import ascii
from astropy.time import Time
import pytz
import numpy as np
import os
import time
import log_utilities... | ytsapras/robonet_site | scripts/reception_data.py | Python | gpl-2.0 | 34,418 | 0.014614 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
#
# Copyright (C) 2016 Oladimeji Fayomi, University of Waikato.
#
# 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/licens... | wandsdn/RheaFlow | RheaFlow/NetlinkProcessor.py | Python | apache-2.0 | 6,275 | 0.000478 |
# -*- coding: utf-8 -*-
from django.urls import re_path
from django.contrib.auth import views as auth_views
from django.utils.translation import gettext_lazy as _
from django.urls import reverse_lazy
from . import forms
from . import views
app_name = "auth"
urlpatterns = [
# Sign in / sign out
re_path(
... | erudit/eruditorg | eruditorg/apps/public/auth/urls.py | Python | gpl-3.0 | 2,483 | 0.003222 |
# This stores all the dialogue related stuff
import screen
class Dialogue(object):
"""Stores the dialogue tree for an individual NPC"""
def __init__(self, npc):
super(Dialogue, self).__init__()
self.npc = npc
self.game = npc.game
self.root = None
self.currentNode = None
def setRootNode(self... | mjdarby/RogueDetective | dialogue.py | Python | gpl-2.0 | 2,401 | 0.016243 |
import threading
__author__ = "Piotr Gawlowicz"
__copyright__ = "Copyright (c) 2015, Technische Universitat Berlin"
__version__ = "0.1.0"
__email__ = "gawlowicz@tkn.tu-berlin.de"
class Timer(object):
def __init__(self, handler_):
assert callable(handler_)
super().__init__()
self._handler ... | uniflex/uniflex | uniflex/core/timer.py | Python | mit | 1,583 | 0 |
from flask import Flask
from flask import render_template
import euclid
import queue_constants
import ast
import redis
import threading
REDIS_ADDRESS = "localhost"
REDIS_PORT = 6379
REDIS_DB = 0
app = Flask(__name__)
@app.route("/")
def monitor():
queue = redis.StrictRedis(host=REDIS_ADDRESS, port=REDIS_PORT, ... | tommyp1ckles/hippocrates | server.py | Python | mit | 742 | 0.006739 |
"""
Core
====
AudioSignals
------------
.. autoclass:: nussl.core.AudioSignal
:members:
:autosummary:
Masks
-----
.. automodule:: nussl.core.masks
:members:
:autosummary:
Constants
------------
.. automodule:: nussl.core.constants
:members:
:autosummary:
External File Zoo
-----------------
.... | interactiveaudiolab/nussl | nussl/core/__init__.py | Python | mit | 1,293 | 0.000773 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Author: S.H.
Version: 0.1
Date: 2015-01-17
Description:
Scan ip:
74.125.131.0/24
74.125.131.99-125
74.125.131.201
Only three format above.
Read ip form a ip.txt, and scan all port(or a list port).
"""
import os
import io
import socket
file... | KyoHS/Python | SingleThreadPortScan.py | Python | gpl-2.0 | 1,536 | 0.009115 |
"""
Maximum likelihood covariance estimator.
"""
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Virgile Fritsch <virgile.fritsch@inria.fr>
#
# License: BSD 3 clause
# avoid division truncation
import warnings
import numpy as np
from scipy... | chrsrds/scikit-learn | sklearn/covariance/empirical_covariance_.py | Python | bsd-3-clause | 9,848 | 0 |
"""
LsVarRun - command ``ls -lnL /var/run``
=======================================
The ``ls -lnL /var/run`` command provides information for the listing of the
``/var/run`` directory.
Sample input is shown in the Examples. See ``FileListing`` class for
additional information.
Sample directory list::
total 20
... | RedHatInsights/insights-core | insights/parsers/ls_var_run.py | Python | apache-2.0 | 1,120 | 0 |
#!/usr/bin/env python
# (c) 2012, Jan-Piet Mens <jpmens () gmail.com>
# (c) 2012-2014, Michael DeHaan <michael@ansible.com> and others
# (c) 2017 Ansible Project
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as... | cryptobanana/ansible | docs/bin/plugin_formatter.py | Python | gpl-3.0 | 26,677 | 0.002774 |
"""tuple sub-class which holds weak references to objects"""
import weakref
class WeakTuple( tuple ):
"""tuple sub-class holding weakrefs to items
The weak reference tuple is intended to allow you
to store references to a list of objects without
needing to manage weak references directly.
For th... | menpo/vrml97 | vrml/weaktuple.py | Python | bsd-3-clause | 4,708 | 0.015718 |
# Copyright (c) 2012 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | igor-toga/local-snat | neutron/api/v2/base.py | Python | apache-2.0 | 33,385 | 0.00012 |
# -*-coding: utf-8 -*-
import colander
from . import (
SelectInteger,
ResourceSchema,
BaseForm,
BaseSearchForm,
)
from ..resources.leads_offers import LeadsOffersResource
from ..models.lead_offer import LeadOffer
from ..models.currency import Currency
from ..models.supplier import Supplier
from ..mode... | mazvv/travelcrm | travelcrm/forms/leads_offers.py | Python | gpl-3.0 | 1,762 | 0 |
# -*- coding: utf-8 -*-
# Copyright 2016 Yelp 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 ... | Yelp/kafka-utils | tests/acceptance/steps/common.py | Python | apache-2.0 | 2,265 | 0 |
'''This gile will take arguments from the command line, if none are found it
will look for a .bot file, if that isn't found it will promt the user for auth
tokens :- with this information the masterbot will connect to its own twitch channel and await a !connect command'''
#Author MrYevral
#check for .bot file in curren... | MrYevral/YevBot | Alternate/MasterBot.py | Python | gpl-3.0 | 586 | 0.020478 |
#!/usr/bin/python
#
# 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 b... | caioserra/apiAdwords | examples/adspygoogle/dfp/v201306/deactivate_placements.py | Python | apache-2.0 | 2,253 | 0.003107 |
# -*- coding: utf-8 *-*
from pyglet.window import key
from pyglet import clock
from . import util, physicalobject
from . import resources
class Ship(physicalobject.PhysicalObject):
"""A class for the player"""
def __init__(self, thrust_image=None, *args, **kwargs):
super().__init__(*args, **kwargs)
... | mammadori/asteroids | game/ship.py | Python | bsd-3-clause | 3,293 | 0.004555 |
from django.contrib import admin
from freemix.exhibit import models
class CanvasAdmin(admin.ModelAdmin):
list_display = ('title', 'description')
search_fields = ('title', 'description',)
admin.site.register(models.Canvas, CanvasAdmin)
class ExhibitAdmin(admin.ModelAdmin):
list_display = ('slu... | zepheira/freemix | freemix/exhibit/admin.py | Python | apache-2.0 | 632 | 0.011076 |
import os
requirements = ["numpy", "scipy", "pandas",
"matplotlib", "peakutils", "uncertainties",
"pyqtgraph"]
for package in requirements:
os.system("pip install " + package)
| laserkelvin/FTSpecViewer | setup.py | Python | gpl-3.0 | 214 | 0 |
"""
This core.py module is part of the Jaide (Junos Aide) package.
It is free software for use in manipulating junos devices. To immediately get
started, take a look at the example files for implementation
guidelines. More information can be found at the github page found here:
https://github.com/NetworkAutomation/ja... | NetworkAutomation/jaide | jaide/core.py | Python | gpl-2.0 | 43,240 | 0.000046 |
from iliasCorrector import db
def _split_ident(ident):
data = ident.split('_')
matr = int(data[-1])
last = data[0]
first = ' '.join(data[1:-2])
return first, last, matr
class Exercise(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80), unique=True)
p... | simonsmiley/iliasCorrector | iliasCorrector/models.py | Python | mit | 2,030 | 0.002463 |
import numpy as np
tansig = lambda n: 2 / (1 + np.exp(-2 * n)) - 1
sigmoid = lambda n: 1 / (1 + np.exp(-n))
hardlim = lambda n: 1 if n >= 0 else 0
purelin = lambda n: n
relu = lambda n: np.fmax(0, n)
square_error = lambda x, y: np.sum(0.5 * (x - y)**2)
sig_prime = lambda z: sigmoid(z) * (1 - sigmoid(z))
relu_pr... | alexvlis/shape | nnmath.py | Python | gpl-3.0 | 518 | 0.021236 |
import pytest
def test_zero_division():
with pytest.raises(ZeroDivisionError):
1 / 0
def test_recursion_depth():
with pytest.raises(RuntimeError) as excinfo:
def f():
f()
f()
assert 'maximum recursion depth exceeded' in str(excinfo.value)
| jskksj/cv2stuff | cv2stuff/tests/test_exception.py | Python | isc | 307 | 0.006515 |
from __future__ import unicode_literals
from django.db import models
from db.models import Bin
class CollectionEntry(models.Model):
bin_obj = models.ForeignKey(Bin, related_name='requested_bins')
fullness = models.IntegerField()
date_added = models.DateTimeField(auto_now_add=True)
| bath-hacker/binny | binny/collector/models.py | Python | mit | 297 | 0.006734 |
# -*- coding: utf-8 -*-
import unittest
from cwr.grammar.factory.config import rule_options
__author__ = 'Bernardo Martínez Garrido'
__license__ = 'MIT'
__status__ = 'Development'
class TestConfigOptions(unittest.TestCase):
def setUp(self):
self._rule = rule_options
def test_zero_options(self):
... | weso/CWR-DataApi | tests/grammar/config/test_options.py | Python | mit | 919 | 0 |
"""
Operations:
P - login
G - list - list the dir's content
G - read - reads a file
G - info - infos about a file
P - write - writes a file
P - mkdir - makes a dir
P - copy - to=...
P - move - to=...
P - delete - DELETE
P - logout
"""
import canister
import bottle
import os.path
import json
imp... | dagnelies/restfs | old/restfs.py | Python | mit | 4,068 | 0.004916 |
"""
-------------------------------------------------------------------------
AIOpening - special.py
useful functions
created: 2017/09/01 in PyCharm
(c) 2017 Sven - ducandu GmbH
-------------------------------------------------------------------------
"""
import numpy as np
import tensorflow as tf
def we... | ducandu/aiopening | aiopening/misc/special.py | Python | mit | 1,167 | 0.003428 |
#
# LMirror is Copyright (C) 2010 Robert Collins <robertc@robertcollins.net>
#
# LMirror 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
# versio... | rbtcollins/lmirror | l_mirror/tests/commands/test_commands.py | Python | gpl-3.0 | 1,692 | 0.004728 |
import tensorflow as tf
from tensorflow.python.ops.rnn_cell import DropoutWrapper, RNNCell, LSTMStateTuple
from my.tensorflow import exp_mask, flatten
from my.tensorflow.nn import linear, softsel, double_linear_logits
class SwitchableDropoutWrapper(DropoutWrapper):
def __init__(self, cell, is_train, inpu... | Incogniiito/Chrononaut | my/tensorflow/rnn_cell.py | Python | apache-2.0 | 9,075 | 0.003857 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Justin Santa Barbara
# 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.apach... | rcbops/nova-buildpackage | nova/image/fake.py | Python | apache-2.0 | 9,011 | 0.008323 |
"""Internal module for Python 2 backwards compatibility."""
import sys
if sys.version_info[0] < 3:
from urlparse import parse_qs, urlparse
from itertools import imap, izip
from string import letters as ascii_letters
from Queue import Queue
try:
from cStringIO import StringIO as BytesIO
... | holys/ledis-py | ledis/_compat.py | Python | mit | 2,327 | 0.006446 |
import platform
import urllib
import subprocess
from progressbar import ProgressBar
class Downloader(object):
WINDOWS_DOWNLOAD_URL = "http://cache.lego.com/downloads/ldd2.0/installer/setupLDD-PC-4_3_8.exe"
MAC_DOWNLOAD_URL = "http://cache.lego.com/downloads/ldd2.0/installer/setupLDD-MAC-4_3_8.zip"
PB = N... | cbrentharris/bricklayer | bricklayer/utils/downloader.py | Python | mit | 951 | 0.005258 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import mock
from nose.tools import ok_
from crontabber.app import CronTabber
from socorro.unittest.cron.jobs.base impo... | m8ttyB/socorro | socorro/unittest/cron/jobs/test_upload_crash_report_json_schema.py | Python | mpl-2.0 | 1,523 | 0 |
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
import os,re,traceback,sys
from waflib import Utils,ansiterm
if not os.environ.get('NOSYNC',False):
if sys.stdout.isatty()and id(sys.stdout)==id(sys.__stdout__):
sys.stdout=ansiterm.AnsiTerm(sys.s... | Gnurou/glmark2 | waflib/Logs.py | Python | gpl-3.0 | 5,584 | 0.068947 |
#!/usr/bin/python
#
# $Id: gen-data-queryperf.py,v 1.1.10.1 2003/05/15 05:07:21 marka Exp $
#
# Contributed by Stephane Bortzmeyer <bortzmeyer@nic.fr>
#
# "A small tool which may be useful with contrib/queryperf. This script
# can generate files of queries, both with random names (to test the
# behaviour with NXdoma... | atmark-techno/atmark-dist | user/bind/contrib/queryperf/utils/gen-data-queryperf.py | Python | gpl-2.0 | 2,783 | 0.004671 |
import numpy as np
from gpaw import KohnShamConvergenceError
class SCFLoop:
"""Self-consistent field loop.
converged: Do we have a self-consistent solution?
"""
def __init__(self, eigenstates=0.1, energy=0.1, density=0.1, maxiter=100,
fixdensity=False, niter_fixdensity=None... | qsnake/gpaw | gpaw/scf.py | Python | gpl-3.0 | 2,689 | 0.002975 |
from netfilterqueue import NetfilterQueue
from dpkt import ip, icmp, tcp, udp
from scapy.all import *
import socket
def print_and_accept(pkt):
data=pkt.get_payload()
res = ip.IP(data)
res2 = IP(data)
i = ICMP(data)
t = TCP(data)
u = UDP(data)
print "SOURCE IP: %s\tDESTINATION IP: %s" % (soc... | rafaelsilvag/pyNFRouter | test/teste.py | Python | gpl-2.0 | 798 | 0.012531 |
#!/usr/bin/env python
import csv
# create an empty list that will be filled with the rows of data from the CSV as dictionaries
csv_content = []
# open and loop through each line of the csv file to populate our data file
with open('aaj1945_DataS1_Egg_shape_by_species_v2.csv') as csv_file:
csv_reader = csv.DictRea... | unmrds/cc-python | .ipynb_checkpoints/eggs-checkpoint.py | Python | apache-2.0 | 1,783 | 0.00673 |
################################################################################
# Copyright 2015 Samuel Gongora Garcia (s.gongoragarcia@gmail.com)
#
# 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 Founda... | satnet-project/propagators | output_predict.py | Python | apache-2.0 | 2,281 | 0.003069 |
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^external/', include('external.urls')),
url(r'^dev/', include('dev.urls')),
]
| SequencingDOTcom/App-Market-API-integration | python/bootstrap/urls.py | Python | mit | 231 | 0 |
# Copyright 2012-2015 MongoDB, 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 writin... | mongodb/motor | test/test_environment.py | Python | apache-2.0 | 11,605 | 0.001034 |
import os
import random
import string
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
TEST_APP_URL = os.getenv('TEST_APP_URL')
TEST_CLIENT_URL = os.getenv('TEST_CLIENT_URL')
E2E_ARGS = os.getenv('E2E_ARGS')
TEST_URL = TEST_CLIENT_URL if E2E_ARGS... | SamR1/FitTrackee | e2e/utils.py | Python | agpl-3.0 | 2,863 | 0 |
UL_CATEGORY_LI = '//ul[@class="category"]/li'
H2_A_TITLELINK = './h2/a[@class="titlelink"]'
SPAN_A_TITLELINK = './span/a[@class="titlelink"]'
DIV_BODYFIELD_P = '//div[contains(@class,"bodyfield")]/p'
CATEGORY_H2_XPATH = [ UL_CATEGORY_LI, H2_A_TITLELINK ]
BODYFIELD_SPAN_XPATH = [ DIV_BODYFIELD_P, SPAN_A_TITLELINK ]
""... | RagtagOpen/bidwire | bidwire/scrapers/massgov/url_scraper_dict.py | Python | mit | 1,717 | 0.008154 |
# orm/loading.py
# Copyright (C) 2005-2020 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""private module containing functions used to convert database
rows into object inst... | graingert/sqlalchemy | lib/sqlalchemy/orm/loading.py | Python | mit | 36,424 | 0 |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
from datetime import (
datetime,
timedelta,
)
from dateutil.relativedelta import relativedelta
from base.tests.model_maker import clean_and_save
from booking.models import (
Booking,
Category,
Location,
)
def get_alpe_d_huez():
... | pkimber/booking | booking/tests/scenario.py | Python | apache-2.0 | 2,769 | 0.001083 |
# Rest Imports
from rest_framework import status
# Local Imports
from ava_core.abstract.test_data import AvaCoreTestData
from ava_core.integration.integration_ldap.models import LDAPIntegrationAdapter
# Implementation
class LDAPIntegrationAdapterTestData(AvaCoreTestData):
"""
Test data for LDAPIntegrationAdap... | alzeih/ava | ava_core/integration/integration_ldap/test_data.py | Python | gpl-3.0 | 6,603 | 0.001212 |
"""Group Anagrams
Given an array of strings, group anagrams together.
Example:
Input:
["eat", "tea", "tan", "ate", "nat", "bat"]
Output:
[
["ate","eat","tea"],
["nat","tan"],
["bat"]
]
Note:
All inputs will be in lowercase.
The order of y... | aiden0z/snippets | leetcode/049_group_anagrams.py | Python | mit | 1,315 | 0.00076 |
class Content(object):
def __init__(self, type_=None, value=None):
self._type = None
self._value = None
if type_ is not None:
self.type = type_
if value is not None:
self.value = value
@property
def type(self):
return self._type
@type.... | galihmelon/sendgrid-python | sendgrid/helpers/mail/content.py | Python | mit | 735 | 0 |
"""
Implement the command-line tool interface.
"""
from __future__ import unicode_literals
import argparse
import os
import sys
import diff_cover
from diff_cover.diff_reporter import GitDiffReporter
from diff_cover.git_diff import GitDiffTool
from diff_cover.git_path import GitPathTool
from diff_cover.violations_report... | hugovk/diff-cover | diff_cover/tool.py | Python | agpl-3.0 | 6,230 | 0.000482 |
"""
Support the OwnTracks platform.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.owntracks/
"""
import json
import logging
import threading
from collections import defaultdict
import homeassistant.components.mqtt as mqtt
from homeassist... | mikaelboman/home-assistant | homeassistant/components/device_tracker/owntracks.py | Python | mit | 7,427 | 0 |
# Consider a row of n coins of values v1 . . . vn, where n is even.
# We play a game against an opponent by alternating turns. In each turn,
# a player selects either the first or last coin from the row, removes it
# from the row permanently, and receives the value of the coin. Determine the
# maximum possible amount o... | bkpathak/Algorithms-collections | src/DP/coin_play.py | Python | apache-2.0 | 2,084 | 0.024952 |
# Yith Library Server is a password storage server.
# Copyright (C) 2012-2013 Yaco Sistemas
# Copyright (C) 2012-2013 Alejandro Blanco Escudero <alejandro.b.e@gmail.com>
# Copyright (C) 2012-2015 Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com>
#
# This file is part of Yith Library Server.
#
# Yith Library Server is... | lorenzogil/yith-library-server | yithlibraryserver/views.py | Python | agpl-3.0 | 4,160 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.12 on 2019-03-05 14:58
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('database', '0020_daymetda... | manterd/myPhyloDB | database/migrations/0021_auto_20190305_1458.py | Python | gpl-3.0 | 1,211 | 0.001652 |
#
# 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... | wooga/airflow | airflow/providers/papermill/operators/papermill.py | Python | apache-2.0 | 2,587 | 0.000773 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
impor... | ity/pants | src/python/pants/pantsd/pants_daemon.py | Python | apache-2.0 | 6,887 | 0.009438 |
from ethereum.slogging import get_logger
log = get_logger('eth.block_creation')
from ethereum.block import Block, BlockHeader
from ethereum.common import mk_block_from_prevstate, validate_header, \
verify_execution_results, validate_transaction_tree, \
set_execution_results, add_transactions, post_finalize
from... | nirenzang/Serpent-Pyethereum-Tutorial | pyethereum/ethereum/meta.py | Python | gpl-3.0 | 2,865 | 0.00349 |
from django import forms
from .models import PassType, Registration
class SignupForm(forms.ModelForm):
pass_type = forms.ModelChoiceField(
queryset=PassType.objects.filter(active=True),
widget=forms.widgets.RadioSelect(),
)
class Meta:
model = Registration
fields = (
... | smokeyfeet/smokeyfeet-registration | src/smokeyfeet/registration/forms.py | Python | mit | 2,149 | 0 |
# -*- coding: utf-8 -*-
{
'name': "Better validation for Attendance",
'summary': """
Short (1 phrase/line) summary of the module's purpose, used as
subtitle on modules listing or apps.openerp.com""",
'description': """
Long description of module's purpose
""",
'author': "J... | jmankiewicz/odooAddons | hr_attendance_new_check/__openerp__.py | Python | agpl-3.0 | 958 | 0.003135 |
import sys
import networkx as nx
def main(graphml):
g = nx.read_graphml(graphml)
nx.write_graphml(g, graphml)
if __name__ == '__main__':
main(sys.argv[1])
| sebwink/deregnet | graphs/kegg/keggtranslator/bin/make_graphml_igraph_readable.py | Python | bsd-3-clause | 169 | 0.011834 |
import numpy as np
# Example taken from : http://cs231n.github.io/python-numpy-tutorial/#numpy
x = np.array([[1,2],[3,4]])
print np.sum(x) # Compute sum of all elements; prints "10"
print np.sum(x, axis=0) # Compute sum of each column; prints "[4 6]"
print np.sum(x, axis=1) # Compute sum of each row; prints "[3 7... | kmova/bootstrap | docker/py2docker/numpy-sum.py | Python | apache-2.0 | 323 | 0.009288 |
# This file is part of pybootchartgui.
# pybootchartgui 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.
# pybootchartgui is dis... | dpaleino/bootchart2 | pybootchartgui/batch.py | Python | gpl-3.0 | 1,604 | 0.006858 |
#!/usr/bin/env python
import httplib
try:
import simplejson as json
except ImportError:
import json
import os
import sys
from urlparse import urljoin
try:
import requests
except ImportError:
raise ImportError('Missing dependency "requests". Do ``pip install requests``.')
try:
import yaml
except I... | lmEshoo/st2contrib | packs/sensu/etc/st2_handler.py | Python | apache-2.0 | 4,880 | 0.002459 |
# Copyright (C) 2012 Nippon Telegraph and Telephone 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 appli... | ykaneko/ryu | ryu/tests/unit/ofproto/test_ofproto_common.py | Python | apache-2.0 | 1,111 | 0 |
# -*- coding: utf-8 -*-
from django.shortcuts import render
from .models import *
from .forms import *
from comunicacion.lugar.models import *
from mapeo.models import *
from django.http import HttpResponse
from django.db.models import Sum, Count, Avg
import collections
import numpy as np
# Create your views here.
def... | ErickMurillo/ciat_plataforma | ficha_granos_basicos/views.py | Python | mit | 17,583 | 0.05029 |
"""Test of models for embargo app"""
import json
import pytest
import six
from django.db.utils import IntegrityError
from django.test import TestCase
from opaque_keys.edx.locator import CourseLocator
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase
from ..models import (
Country,
Coun... | stvstnfrd/edx-platform | openedx/core/djangoapps/embargo/tests/test_models.py | Python | agpl-3.0 | 12,890 | 0.001164 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 7, transform = "Anscombe", sigma = 0.0, exog_count = 100, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_Anscombe/trend_Lag1Trend/cycle_7/ar_/test_artificial_32_Anscombe_Lag1Trend_7__100.py | Python | bsd-3-clause | 263 | 0.087452 |
#!/usr/bin/python3
#import nltk
#import pattern.en
from nltk import word_tokenize
from nltk import pos_tag
from nltk.corpus import wordnet
#import nltk.fuf.linearizer
from nltk.stem.wordnet import WordNetLemmatizer as wnl
from re import sub
import string
import random
from .genderPredictor import genderPredictor
#nlt... | theopak/storytellingbot | Extrapolate/Extrapolate.py | Python | mit | 7,576 | 0.005148 |
#############################################################################
##
## Copyright (C) 2015 The Qt Company Ltd.
## Contact: http://www.qt.io/licensing
##
## This file is part of Qt Creator.
##
## Commercial License Usage
## Licensees holding valid commercial Qt licenses may use this file in
## accordance wit... | martyone/sailfish-qtcreator | tests/system/suite_SCOM/tst_SCOM01/test.py | Python | lgpl-2.1 | 3,047 | 0.009846 |
from __future__ import print_function
import fileinput
from datetime import datetime
for line in fileinput.input():
line = line.rstrip()
# This condition removes CDX header lines
if line[0] is ' ':
continue
# Extract just the timestamp from line
timestamp = line.split(' ', 2)[1]
# D... | vphill/eot-cdx-analysis | code/cdx_extract_date.py | Python | cc0-1.0 | 524 | 0 |
from redbreast.core.utils import *
import pytest
from uliweb import manage, functions
import os
def test_import():
a = CommonUtils.get_class('redbreast.core.spec.TaskSpec')
assert str(a) == "<class 'redbreast.core.spec.task.TaskSpec'>"
def test_import_not_exist():
a = CommonUtils.get_class('... | uliwebext/uliweb-redbreast | test/test_core_utils.py | Python | bsd-2-clause | 2,255 | 0.010643 |
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Denis Engemann <denis.engemann@gmail.com>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
# Eric Larson <larson.eric.d@gmail.com>
# Cathy Nangini <cnangini@gmail.com>
# Mainak Jas <mainak@neuro.hut.fi>
#... | jniediek/mne-python | mne/viz/tests/test_evoked.py | Python | bsd-3-clause | 7,380 | 0.000136 |
"""n-body simulator to derive TDV+TTV diagrams of planet-moon configurations.
Credit for part of the source is given to
https://github.com/akuchling/50-examples/blob/master/gravity.rst
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
"""
import numpy
import math
import matplotlib.pylab as plt... | hippke/TTV-TDV-exomoons | create_figures/system_22.py | Python | mit | 7,952 | 0.005659 |
import platform
import socket
import sys
from mule_local.JobGeneration import *
from mule.JobPlatformResources import *
from . import JobPlatformAutodetect
import multiprocessing
# Underscore defines symbols to be private
_job_id = None
def _whoami(depth=1):
"""
String of function name to recycle code
... | schreiberx/sweet | mule/platforms/50_ppeixoto_usp_gnu/JobPlatform.py | Python | mit | 4,663 | 0.016299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.