code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python
from argparse import ArgumentParser
from subprocess import check_output
import itertools
import sys
from sonLib.bioio import fastaRead
def kmers(iterable, k):
iters = itertools.tee(iterable, k)
for i, iter in enumerate(iters):
for _ in xrange(i):
next(iter, None)
... | joelarmstrong/analysis-purgatory | get_signatures.py | Python | mit | 2,924 |
from __future__ import print_function
import unittest
import json
import math
class Test(unittest.TestCase):
def test_linestrings_intersect(self):
from geojson_utils import linestrings_intersect
diagonal_up_str = '{ "type": "LineString","coordinates": [[0, 0], [10, 10]]}'
diagonal_down_st... | brandonxiang/geojson-python-utils | test.py | Python | mit | 5,920 |
import os
import re
import struct
from . import helpers
from .raid import RaidController, RaidLD, RaidPD, DeviceCapacity
from .mixins import TextAttributeParser
from .smart import SMARTinfo
if os.name == 'nt':
raidUtil = 'C:\\Program Files (x86)\\MegaRAID Storage Manager\\StorCLI64.exe'
elif 'VMkernel' in os.una... | Bloodoff/raidinfo | lib/raid_megaraid.py | Python | gpl-3.0 | 8,614 |
from django.contrib import admin
from restApi.models import Artist, Art, Song
# Register your models here.
admin.site.register(Artist)
admin.site.register(Art)
admin.site.register(Song)
| rllola/creativePlaylist | backEnd/creativePlaylist/restApi/admin.py | Python | mit | 188 |
import urllib2
from cStringIO import StringIO
import _response
# GzipConsumer was taken from Fredrik Lundh's effbot.org-0.1-20041009 library
class GzipConsumer:
def __init__(self, consumer):
self.__consumer = consumer
self.__decoder = None
self.__data = ""
def __getattr__(self, key):
... | jasrusable/fun | venv/lib/python2.7/site-packages/twill/other_packages/_mechanize_dist/_gzip.py | Python | gpl-2.0 | 3,299 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import core, workspace
from caffe2.python.test_util import TestCase
import numpy as np
class TestDataCoupleOp(TestCase):
def test_data_couple_op... | ryfeus/lambda-packs | pytorch/source/caffe2/python/operator_test/data_couple_op_test.py | Python | mit | 1,003 |
###########################################################################
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/l... | google/starthinker | starthinker/task/dv_editor/campaign.py | Python | apache-2.0 | 4,362 |
import lacuna.bc
import lacuna.building
import lacuna.spy
class security(lacuna.building.MyBuilding):
path = 'security'
def __init__( self, client, body_id:int = 0, building_id:int = 0 ):
super().__init__( client, body_id, building_id )
@lacuna.building.MyBuilding.call_returning_meth
def vie... | tmtowtdi/MontyLacuna | lib/lacuna/buildings/callable/security.py | Python | mit | 2,190 |
# -*- coding: utf-8 -*-
from ..internal.SimpleCrypter import SimpleCrypter
class FilecloudIoFolder(SimpleCrypter):
__name__ = "FilecloudIoFolder"
__type__ = "crypter"
__version__ = "0.09"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?(filecloud\.io|ifile\.it)/_\w+'
__config__ = [... | Arno-Nymous/pyload | module/plugins/crypter/FilecloudIoFolder.py | Python | gpl-3.0 | 933 |
# coding=utf-8
# Copyright 2019 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 ... | google-research/football | gfootball/scenarios/tests/11_vs_11_easy_deterministic.py | Python | apache-2.0 | 2,272 |
# Copyright (C) 2005 by Async Open Source
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is d... | Schevo/kiwi | gazpacho-plugin/kiwiwidgets.py | Python | lgpl-2.1 | 9,606 |
# -*- coding: utf-8 -*-
import unittest
from readthedocs.projects.version_handling import version_windows
class TestVersionWindows(unittest.TestCase):
def setUp(self):
self.versions = [
'0.1.0',
'0.2.0',
'0.2.1',
'0.3.0',
'0.3.1',
'... | tddv/readthedocs.org | readthedocs/rtd_tests/tests/test_version_windows.py | Python | mit | 3,636 |
from http import client
import json
import xmltodict
import codecs
import api.geomatic
from settings import *
# Utilities
def open_connection():
return client.HTTPConnection(NGINX_HOST, NGINX_PORT)
def assertCode(response, expected_code=200):
""" Assert that response code is the expected """
assert r... | kobe25/sbcatalog | test/integration/test_01_api.py | Python | agpl-3.0 | 3,061 |
#!/Library/Frameworks/Python.framework/Versions/3.4/bin/python3
#!encoding: UTF-8
import json, sys
if __name__ == "__main__":
for i in sys.argv[1:]:
with open(i, "r") as minion:
a = json.loads(minion.read())
time = 0
out = ""
for j in a:
prin... | PrashntS/Hashes | tests/routine.two.py | Python | mit | 541 |
import pandas as pd
# TODO: Set weight1, weight2, and bias
weight1 = 10.0
weight2 = 10.0
bias = -8.0
# DON'T CHANGE ANYTHING BELOW
# Inputs and outputs
test_inputs = [(0, 0), (0, 1), (1, 0), (1, 1)]
correct_outputs = [False, True, True, True]
outputs = []
# Generate and check output
for test_input, correct_output i... | morphean/deep-learning | neural-network/perceptron_OR.py | Python | apache-2.0 | 1,047 |
import requests
from requests import HTTPError
from cloudbot import hook
from cloudbot.bot import bot
from cloudbot.util import web
api_url = "https://translate.yandex.net/api/v1.5/tr.json/"
lang_dict = {}
lang_dir = []
@hook.on_start()
def load_key():
api_key = bot.config.get_api_key("yandex_translate")
if... | tiredtyrant/CloudBot | plugins/yandex_translate.py | Python | gpl-3.0 | 3,542 |
import os
from collections import defaultdict
from pkg_resources import resource_filename
MODELS_FOLDER = resource_filename(__name__, "models")
LANGUAGES = ("ru", "en")
FILES = dict()
FILES["build_config"] = "build_config.json"
FILES["train_config"] = "train_config.json"
FILES["train_model_config"] = "train_model.jso... | IlyaGusev/rnnmorph | rnnmorph/settings.py | Python | apache-2.0 | 1,849 |
"""zca - ZCA whitening"""
__version__ = '0.1.0'
__author__ = 'Maarten Versteegh <maartenversteegh@gmail.com>'
from .zca import ZCA
__all__ = ['ZCA']
| mwv/zca | zca/__init__.py | Python | gpl-3.0 | 151 |
# 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 use ... | dcorbacho/libcloud | libcloud/test/compute/test_digitalocean_v2.py | Python | apache-2.0 | 11,147 |
from .generator import noisef, noises
from .filtration import show | mjirik/ndnoise | ndnoise/__init__.py | Python | mit | 66 |
"""
Usage:
utils/send_aws_email.py <aws_key> <aws_secret> <region>
"""
import boto3
from clients.email.aws_ses import AwsSesClient
from docopt import docopt
def send_test_email(aws_client):
ses_client = AwsSesClient(aws_client)
from_ = input("enter from address (nobody@digital.cabinet-office.gov.uk): ")... | alphagov/notifications-delivery | notifications_delivery/utils/send_aws_email.py | Python | mit | 894 |
# Copyright (c) 2018 PaddlePaddle 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 appli... | luotao1/Paddle | python/paddle/fluid/tests/unittests/test_space_to_depth_op.py | Python | apache-2.0 | 5,176 |
import gdb
import re
import sys
if sys.version > '3':
long = int
objfile = gdb.current_objfile() or gdb.objfiles()[0]
int_ptr = gdb.lookup_type('int').pointer()
ot_pretty_printers = []
def AddToPrettyPrinter(rx):
def class_wrapper(cls):
ot_pretty_printers.append( (re.compile(rx), cls) )
ret... | dbarbier/ot-svn | lib/src/libOT-gdb.py | Python | gpl-3.0 | 3,111 |
# -*- coding: utf-8 -*-
"""
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License,
or (at your option) any later version.
This program is distributed in... | fener06/pyload | module/plugins/accounts/FileserveCom.py | Python | gpl-3.0 | 2,287 |
from mobacache.cache import * | redrush85/mobacache | mobacache/__init__.py | Python | mit | 29 |
""".. Ignore pydocstyle D400.
==================
Null Flow Executor
==================
.. automodule:: resolwe.flow.executors.null.run
"""
| jberci/resolwe | resolwe/flow/executors/null/__init__.py | Python | apache-2.0 | 142 |
#!/usr/bin/env python3
# Copyright (c) 2020-2021 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import argparse
import io
import requests
import subprocess
import sys
DEFAULT_GLOBAL_FAUCET = 'https://... | jamesob/bitcoin | contrib/signet/getcoins.py | Python | mit | 6,271 |
'''
File : thumbs.py
Author : Nadav Samet
Contact : thesamet@gmail.com
Date : 2010 Jun 17
Description : Thumbnailing functionality.
'''
import gtk
import os
import gc
THUMB_SIZE = 160
class ThumbLoader(object):
"""Thumbnail processing object."""
def __init__(self, iconview, model, image_list):
... | thesamet/webilder | src/webilder/thumbs.py | Python | bsd-3-clause | 3,839 |
# -*- coding: utf-8 -*-
from generators.rdf.rdf_management import empty_graph
from entities.events.models import *
from entities.organizations.models import *
from entities.persons.models import *
from entities.projects.models import *
from entities.publications.models import *
import logging
logger = logging.getLo... | morelab/labman_ud | labman_ud/maintenance_tasks/rdf/republish_all_data_as_rdf.py | Python | gpl-3.0 | 2,387 |
# -*- coding: utf-8 -*-
# <Lettuce - Behaviour Driven Development for python>
# Copyright (C) <2010-2012> Gabriel Falcão <gabriel@nacaolivre.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 Foundatio... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/lettuce/django/management/commands/harvest.py | Python | agpl-3.0 | 9,169 |
# -*- coding: utf-8 -*-
# The MIT License (MIT)
#
# Copyright © 2014 Tim Bielawa <timbielawa@gmail.com>
#
# 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 with... | pombredanne/bitmath | tests/test_basic_math.py | Python | mit | 7,349 |
# Copyright 2011 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | viggates/nova | nova/api/openstack/compute/plugins/v3/admin_actions.py | Python | apache-2.0 | 4,150 |
# -*- 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/wizard/account_chart.py | Python | agpl-3.0 | 5,123 |
# Third-party modules
import numpy as np
import pandas as pd
from sklearn.model_selection import KFold
# Hand-made modules
from .base import PathHandlerBase, BloscpackMixin
KWARGS_READ_CSV = {
"sep": "\t",
"header": 0,
"parse_dates": [0],
"index_col": 0
}
KWARGS_TO_CSV = {
"sep": "\t"
}
OBJECTIVE_L... | gciteam6/xgboost | src/models/split.py | Python | mit | 2,303 |
# -*- coding: utf-8 -*-
# Copyright 2013 mysqlapi authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import os
import signal
import crane_ec2
from mysqlapi.api import creator
from mysqlapi.api.models import DatabaseManager, Instance
o... | tsuru/mysqlapi | wsgi.py | Python | bsd-3-clause | 850 |
from horizon.test import helpers as test
class FirstpanelTests(test.TestCase):
# Unit tests for firstpanel.
def test_me(self):
self.assertTrue(1 + 1 == 2)
| TechBK/horizon-dev | openstack_dashboard/dashboards/techbk_head/firstpanel/tests.py | Python | apache-2.0 | 173 |
import random
import time
#You are playing an antique RPG game.
#You are asked for your age. returns a message depending on whether player is over 18.
#You are asked if you want to read an introduction to the game.
#If you choose yes, it will print out a brief introduction.
#You encounter a maze. You are given an optio... | walter2645-cmis/walter2645-cmis-cs2 | conditionals.py | Python | cc0-1.0 | 5,546 |
"""
WSGI config for todoproject project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_S... | jmickela/django-heroku-todo | todoproject/wsgi.py | Python | apache-2.0 | 485 |
#!/usr/bin/python
import hsgw
import re
from sys import argv, exit
if len(argv) != 2 and len(argv) != 3:
print argv[0], "<key> [<regex>]"
exit(1)
conn = hsgw.HomeserverConnection(key = argv[1], refresh_cobjects = True)
for x,y in conn.co_by_id.items():
if (len(argv) == 2):
print y['name'].encode... | okohlbacher/pyHSgw | pyhsgw/hs_show_addr.py | Python | bsd-3-clause | 497 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
E-I network connected with NEST topology
----------------------------------------
Simulation of a network consisting of an excitatory and an inhibitory
neuron population with distance-dependent connectivity.
The code bases on the script
brunel_alpha_nest.py
which... | espenhgn/VIOLA | test_data/topo_brunel_alpha_nest.py | Python | gpl-2.0 | 44,541 |
import os
import semver
import json
from collections import OrderedDict
prompts = OrderedDict([
('name', {
'default': os.path.basename(os.getcwd()),
'label': 'name'
}),
('version', {
'default': '1.0.0',
'validator': semver.parse,
'label': 'version'
}),
('des... | emallson/nppm | nppm/commands/init.py | Python | gpl-3.0 | 1,941 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
import logya.content
from pathlib import Path
from logya.util import paths
markdown_extensions = ['attr_list', 'def_list', 'fenced_code', 'toc']
site_root = 'tests/fixtures/site/'
site_paths = paths(site_root)
def test_content_type():
for value, exp... | yaph/logya | tests/test_content.py | Python | mit | 2,721 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | x2nie/odoo | openerp/addons/base/ir/ir_ui_view.py | Python | agpl-3.0 | 50,961 |
def bin_column(self, column_name, bins=None, include_lowest=True, strict_binning=False, bin_column_name=None):
"""
Summarize rows of data based on the value in a single column by sorting them
into bins, or groups, based on a list of bin cutoff points or a specified number of
equal-width bins.
Para... | shibanis1/spark-tk | python/sparktk/frame/ops/bin_column.py | Python | apache-2.0 | 7,479 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author Vincent Renaville/Joel Grand-Guillaume.
# Copyright 2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Pub... | vauxoo-dev/account-financial-tools | __unported__/account_default_draft_move/__openerp__.py | Python | agpl-3.0 | 2,406 |
#!/usr/bin/env python
# Copyright 2014 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.
"""Tests for scripts/tools/mastermap.py"""
import json
import unittest
import test_env # pylint: disable=W0611
from tools import m... | eunchong/build | scripts/tools/unittests/mastermap_test.py | Python | bsd-3-clause | 3,672 |
# Copyright (c) 2016 GohighSec, 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 wr... | openstack/python-barbicanclient | barbicanclient/v1/client.py | Python | apache-2.0 | 3,253 |
import json
import os
import tempfile
import shutil
import pytest
import requests_mock
from click.testing import CliRunner
# By doing this import we make sure that the plugin is made available
# but the entry points loading inside gg.main.
# An alternative would we to set `PYTHONPATH=. py.test` (or something)
# but t... | peterbe/gg | gg/builtins/cleanup/tests/test_gg_cleanup.py | Python | mit | 2,436 |
"""
https://github.com/hyves-org/p2ptracker
Copyright (c) 2011, Ramon van Alteren
MIT license: http://www.opensource.org/licenses/MIT
"""
from flaskext.testing import TestCase
import redis
import logging
from p2ptracker import create_app, utils, bencode
from p2ptracker.tests.helpers import utils as testutils
import o... | TMG-nl/p2ptracker | p2ptracker/tests/test_announce.py | Python | mit | 13,825 |
def which(program):
"""From:
http://stackoverflow.com/questions/377017/test-if-executable-exists-in-python"""
import os
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
fpath, fname = os.path.split(program)
if fpath:
if is_exe(program):
... | thescouser89/snippets | python/snippets/find_if_program_installed.py | Python | mit | 596 |
#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/set_ops.py
__version__=''' $Id: set_ops.py 3959 2012-09-27 14:39:39Z robin $ '''
__doc__="""From before Python had a Set cla... | nickpack/reportlab | src/reportlab/lib/set_ops.py | Python | bsd-3-clause | 1,378 |
from __future__ import absolute_import, unicode_literals
from django.db.models.lookups import Lookup
from django.db.models.query import QuerySet
from django.db.models.sql.where import SubqueryConstraint, WhereNode
from django.utils.six import text_type
class FilterError(Exception):
pass
class FieldError(Excep... | car3oon/saleor | saleor/search/backends/base.py | Python | bsd-3-clause | 8,616 |
# 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 'Method.kwargs'
db.add_column('cbv_method', 'kwargs', self.gf('django.db.models.fields.Char... | abhijo89/django-cbv-inspector | cbv/migrations/0002_auto__add_field_method_kwargs__add_field_klass_docstring.py | Python | bsd-2-clause | 3,629 |
import pylab as pl
orig = pl.csv2rec('nature08230-s2.csv')
country = []
year = []
hdi = []
tfr = []
for row in orig:
for y in range(1975, 2006):
if pl.isnan(row['hdi%d'%y]) \
or pl.isnan(row['tfr%d'%y]):
continue
country.append(row['country'])
year.append(y)
... | aflaxman/pymc-example-tfr-hdi | src/data.py | Python | gpl-3.0 | 688 |
#
# CDR-Stats License
# http://www.cdr-stats.org
#
# 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/.
#
# Copyright (C) 2011-2015 Star2Billing S.L.
#
# The Initial Develope... | areski/cdr-stats | cdr_stats/voip_billing/admin.py | Python | mpl-2.0 | 32,472 |
# Copyright 2007-2015 UShareSoft SAS, 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 requi... | MaxTakahashi/hammr | hammr/commands/os/os.py | Python | apache-2.0 | 5,937 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('backend', '0005_organization_registered'),
]
operations = [
migrations.RemoveField(
model_name='organization',
... | euhackathon/commission-today-api | backend/backend/migrations/0006_auto_20141203_0021.py | Python | mit | 1,218 |
# Simple transform tests
from pygame import transform, surface, draw
def _make_object():
"""Create a vaguely interesting object to transform."""
obj = surface.Surface((40, 80), depth=32)
draw.line(obj, (255, 0, 0, 255), (10, 10), (10, 40), 3)
draw.line(obj, (255, 255, 0, 255), (10, 10), (40, 10), 3)
d... | GertBurger/pygame_cffi | conformance/conf_tests/test_transforms.py | Python | lgpl-2.1 | 1,975 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2011 ~ 2013 Deepin, Inc.
# 2011 ~ 2013 Wang Yong
#
# Author: Wang Yong <lazycat.manatee@gmail.com>
# Maintainer: Wang Yong <lazycat.manatee@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the t... | linuxdeepin/deepin-translator | src/translate_window.py | Python | gpl-3.0 | 4,229 |
from django import forms
from ..models import WinkAPI
class APIForm(forms.ModelForm):
client_id = forms.CharField(label = 'Client ID')
client_password = forms.CharField(label = 'Client Password')
class Meta:
model = WinkAPI
fields = ('client_id', 'client_password')
| odingrey/Django-Wink | wink/wink/forms/api.py | Python | mit | 291 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_artifacts_operations.py | Python | mit | 14,239 |
###############################################################################
# -*- coding: utf-8 -*-
# Order: A tool to characterize the local structure of liquid water
# by geometric order parameters
#
# Authors: Pu Du
#
# Released under the MIT License
####################################################... | ipudu/order | order/interface.py | Python | mit | 584 |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
class TorrentPipeline(object):
def process_item(self, item, spider):
return item
| arthuralvim/palestra_pug_scrapy | torrent/torrent/pipelines.py | Python | mit | 287 |
import datetime
import hashlib
import json
import logging
import os
import shutil
import subprocess
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.core.files.storage import default_storage as storage
from django.core.urlresolvers import reverse
from django.template im... | kumar303/zamboni | mkt/webapps/tasks.py | Python | bsd-3-clause | 32,860 |
# mako/runtime.py
# Copyright 2006-2020 the Mako authors and contributors <see AUTHORS file>
#
# This module is part of Mako and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""provides runtime services for templates, including Context,
Namespace, and various helper functions... | scheib/chromium | third_party/mako/mako/runtime.py | Python | bsd-3-clause | 28,040 |
import os
from django.core.urlresolvers import reverse
from onadata.apps.main.tests.test_base import TestBase
from onadata.apps.viewer.models.export import Export
from onadata.apps.main.models.meta_data import MetaData
from onadata.apps.viewer.views import export_list
class TestExportList(TestBase):
def setUp(... | jomolinare/kobocat | onadata/apps/viewer/tests/test_export_list.py | Python | bsd-2-clause | 8,203 |
from ohno.dungeon.feature.basefeature import BaseFeature
from ohno.dungeon.feature.door import Door
from ohno.dungeon.feature.trap import Trap
from ohno.dungeon.feature.staircase import Staircase
def create(ohno, maptile):
"""Checks `maptile` for which feature to create"""
if maptile.glyph in '-|]' and maptile... | helgefmi/ohno | ohno/dungeon/feature/feature.py | Python | mit | 543 |
#!/usr/bin/env python3
import textwrap
from string import Template
from factor import precalculate, FactorialNumber
CPP="""// generated by $script
#include <cstddef>
namespace avx512binom {
constexpr size_t primes_count = $primes_count;
constexpr size_t numbers_count = $numbers_count;
constexpr size_t f... | WojciechMula/toys | avx512-binomialcoef/python/precalc_factors.py | Python | bsd-2-clause | 2,645 |
import mock
import datetime
import pytz
from django.core.management.base import BaseCommand, CommandError
from django.utils import timezone
from django.test import override_settings
from django.conf import settings
from projects.models import (
Project,
Allocation,
)
from projects.management.commands.check_ex... | ResearchComputing/RCAMP | rcamp/tests/test_projects_commands.py | Python | mit | 10,093 |
#!/usr/bin/env python
# encoding: utf-8
"""Verify that all `OsfStorageFileVersion` records created earlier than two
days before the latest inventory report are contained in the inventory, point
to the correct Glacier archive, and have an archive of the correct size.
Should be run after `glacier_inventory.py`.
"""
impo... | kushG/osf.io | scripts/osfstorage/glacier_audit.py | Python | apache-2.0 | 3,201 |
# Copyright 2016 EMC Corporation
# 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 ... | Hybrid-Cloud/cinder | cinder/api/v3/views/group_types.py | Python | apache-2.0 | 1,885 |
# -*- coding: utf-8 -*-
import traceback
from . import modeling
from flask import render_template, jsonify, request
from ..tools.simulation.release import getModel, simulate, __example_system, name_handler
from ..models import EquationBase, Design, ComponentPrototype, Relationship
# /modeling/
@modeling.route('/')
d... | igemsoftware/SYSU-Software-2015 | server/routes/modeling_view.py | Python | lgpl-3.0 | 17,015 |
# -*- coding: utf-8 -*-
u"""
Created on 2015-7-23
@author: cheng.li
"""
from PyFin.Math.Distributions.NormalDistribution import NormalDistribution
from PyFin.Math.Distributions.NormalDistribution import CumulativeNormalDistribution
from PyFin.Math.Distributions.NormalDistribution import InverseCumulativeNormal
__all... | wegamekinglc/Finance-Python | PyFin/Math/Distributions/__init__.py | Python | mit | 429 |
#
# Copyright 2015 Quantopian, 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 wr... | wilsonkichoi/zipline | tests/test_benchmark.py | Python | apache-2.0 | 6,927 |
def parse_environment(raw_environment):
environment = {}
for line in raw_environment.split('\n'):
line = line.strip()
if not line:
continue
if line.startswith('#'):
continue
try:
key, value = line.split(':', 1)
except ValueError:
... | mhahn/stacker | stacker/environment.py | Python | bsd-2-clause | 456 |
'''
Processes a CSV file containing a list of files into a WXS file with
components for each listed file.
The CSV columns are:
source of file, target for file, group name
Usage::
py txt_to_wxs.py [path to file list .csv] [path to destination .wxs]
This is necessary to handle structures where some directories... | FFMG/myoddweb.piger | monitor/api/python/Python-3.7.2/Tools/msi/csv_to_wxs.py | Python | gpl-2.0 | 5,066 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
('profiles', '0002_default_group'),
]
operations = [
migrations.RemoveField(
mod... | joelstanner/django-imager | imager/profiles/migrations/0003_auto_20150317_0030.py | Python | mit | 469 |
from __future__ import print_function
from mpop.satellites import GeostationaryFactory
from mpop.projector import get_area_def
import datetime
## uncomment these two lines for more debugging information
#from mpop.utils import debug_on
#debug_on()
from my_msg_module import get_last_SEVIRI_date
time_slot = get_last_SE... | meteoswiss-mdr/monti-pytroll | scripts/demo_downscale.py | Python | lgpl-3.0 | 1,401 |
"""Amazon boto3 interface."""
try:
import boto3
from botocore import exceptions
from botocore.awsrequest import AWSRequest
from botocore.response import get_response
except ImportError:
boto3 = None
class _void:
pass
class BotoCoreError(Exception):
pass
exceptions = _v... | ZoranPavlovic/kombu | kombu/asynchronous/aws/ext.py | Python | bsd-3-clause | 486 |
# -*- coding: utf-8 -*-
# Copyright (c) 2006-2010 Tampere University of Technology
#
# 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 r... | tema-mbt/tema-adapterlib | adapterlib/testrunner.py | Python | mit | 15,926 |
from setuptools import setup
from Cython.Build import cythonize
setup(
name='dependency_decoding',
version='0.0.1',
ext_modules=cythonize("*.pyx"))
| andersjo/dependency_decoding | setup.py | Python | gpl-3.0 | 161 |
import re
from st2actions.runners.pythonrunner import Action
REGEX_PATTERN = '^([0-9A-Fa-f]+)$'
class ExtractAction(Action):
def run(self, text):
words = [word for word in text.split(' ') if len(word) >= 32]
for word in words:
if re.search(REGEX_PATTERN, word):
retu... | StackStorm/st2incubator | packs/purr/actions/extract_hash.py | Python | apache-2.0 | 349 |
from flask import request
import config
from connections import send_ws
from consts import WS_CHAT_MESSAGE
from decorators import validate
from errors import APIException
from handlers.v2.base import RestBase
from models import ChatMessage
from loggers import logger
from serializers import MessageSerializer
from valid... | AHAPX/dark-chess | src/handlers/v2/chat.py | Python | gpl-3.0 | 1,365 |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2015, MuChu Hsu
Contributed by Muchu Hsu (muchu1983@gmail.com)
This file is part of BSD license
<https://opensource.org/licenses/BSD-3-Clause>
"""
import unittest
import logging
import json
from cameo.parserForCROWDCUBE import ParserForCROWDCUBE
"""
測試 解析 CROWDCUBE 頁面
"""
clas... | muchu1983/104_cameo | test/unit/test_parserForCROWDCUBE.py | Python | bsd-3-clause | 1,031 |
__author__ = 'keyvan'
def dim(structure):
return structure.__dim__()
def subsets_of_len_two(seq):
indexed_seq = list(seq)
length = len(indexed_seq)
for i in xrange(length):
for j in xrange(i + 1, length):
yield (indexed_seq[i], indexed_seq[j])
def subsets_of(collection, subsets... | rodsol/opencog | opencog/python/learning/bayesian_learning/util.py | Python | agpl-3.0 | 539 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2012, 2013 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your opt... | JakeCowton/invenio-data | invenio_data/modules/deposit/workflows/lhcb.py | Python | gpl-2.0 | 3,270 |
"""
Test that genomic metrics work.
"""
import unittest
import numpy as np
import deepchem as dc
import pytest
try:
import tensorflow as tf
has_tensorflow = True
except:
has_tensorflow = False
from deepchem.metrics.genomic_metrics import get_motif_scores
from deepchem.metrics.genomic_metrics import get_pssm_sco... | deepchem/deepchem | deepchem/metrics/tests/test_genomics.py | Python | mit | 3,564 |
#!/usr/bin/env python
"""
Find and run the unit tests
"""
import unittest
import sys
if __name__ == '__main__':
suite = unittest.TestLoader().discover('unittests')
results = unittest.TextTestRunner(verbosity=3).run(suite)
if results.errors or results.failures:
sys.exit(1)
| jonnybazookatone/slackback | slackback/tests/run_tests.py | Python | mit | 296 |
# -*- coding: utf-8 -*-
from django.conf.urls import url
from api import views
urlpatterns = (
url(r'^auth/sign_in/?$', views.SignInView.as_view(), name='api_sign_in'),
url(r'^game/?$', views.GamesView.as_view(), name='api_game'),
) | Kriegspiel/ks-python-api | kriegspiel_api_server/api/urls.py | Python | mit | 241 |
from klogger import *
import klogger
from multiprocessing.pool import ThreadPool
import time
@debug
def foo(n):
if n < 0:
return
foo2(foo, n - 1)
@info
def foo2(f, *args):
return f(*args)
@progress_task(max_value=10)
def bar():
for i in range(10):
tick_progress(amount=1)
time... | kaniblu/logjob | test.py | Python | gpl-3.0 | 868 |
# Fuck you Disyer. Stealing my fucking paypal. GET FUCKED: toontown.parties.DistributedPartyJukeboxActivityBase
from panda3d.core import CollideMask, CollisionNode, CollisionTube, lookAt
from direct.actor.Actor import Actor
from direct.task.Task import Task
from otp.otpbase.OTPBase import OTPBase
from toontown.too... | DedMemez/ODS-August-2017 | parties/DistributedPartyJukeboxActivityBase.py | Python | apache-2.0 | 9,445 |
# -*- coding: utf-8 -*-
"""
Authors: Tim Hessels
UNESCO-IHE 2016
Contact: t.hessels@unesco-ihe.org
Repository: https://github.com/wateraccounting/wa
Module: Collect/MOD17
"""
# import general python modules
import os
import numpy as np
import pandas as pd
import gdal
import urllib
import urllib2
from bs4 impo... | wateraccounting/wa | Collect/MOD17/DataAccessNPP.py | Python | apache-2.0 | 13,891 |
# Copyright (C) 2009-2015 Contributors as noted in the AUTHORS file
#
# This file is part of Autopilot.
#
# Autopilot 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 y... | rogerlindberg/autopilot | src/lib/reporting/logger.py | Python | gpl-3.0 | 4,940 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2013-TODAY OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | OpusVL/odoo | addons/note/tests/__init__.py | Python | agpl-3.0 | 1,038 |
#
# Copyright 2012 The HumanGeo Group, 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 o... | humangeo/rawes | rawes/http_connection.py | Python | apache-2.0 | 2,148 |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import int_or_none
_translation_table = {
'a': 'h', 'd': 'e', 'e': 'v', 'f': 'o', 'g': 'f', 'i': 'd', 'l': 'n',
'm': 'a', 'n': 'm', 'p': 'u', 'q': 't', 'r': 's', 'v': 'p', 'x': 'r',
'y': 'l', 'z': 'i',
'$': ':', '&... | mxamin/youtube-dl | youtube_dl/extractor/cliphunter.py | Python | unlicense | 2,832 |
# encoding: utf-8
from __future__ import unicode_literals
import operator
import pytest
from marrow.mongo import Filter
from marrow.schema.compat import odict, py3
@pytest.fixture
def empty_ops(request):
return Filter()
@pytest.fixture
def single_ops(request):
return Filter({'roll': 27})
def test_ops_iterat... | marrow/mongo | test/query/test_ops.py | Python | mit | 5,358 |
# Copyright (c) 2014 Yubico AB
# 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 program... | Yubico/yubioath-desktop-dpkg | yubioath/gui/controller.py | Python | gpl-3.0 | 14,732 |
import urllib2
import re
import datetime
import pytz
from lxml import etree
from StringIO import StringIO
from urllib import urlencode
from optparse import make_option
from dateutil.parser import parse as dateparse
from django.core.management.base import BaseCommand, CommandError
from fec_alerts.models import new_... | sunlightlabs/read_FEC | fecreader/fec_alerts/management/commands/scrape_rss_filings.py | Python | bsd-3-clause | 6,222 |
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 05 13:59:31 2014
@author: Chengcheng
"""
from snownlp import SnowNLP
import gettweets
import numpy
import codecs
import pickle
import os
import re
class pnn:
def __init__(self):
self.sigma = 0.03
if os.path.exists('data/dict.dat')... | wattlebird/Following_Classification | pnn.py | Python | mit | 4,030 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.