text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
#!/usr/bin/env python
import os
import sys
try:
import py2deb
except ImportError:
import fake_py2deb as py2deb
import constants
__app_name__ = constants.__app_name__
__description__ = """Very simple Audiobook player.
Supports playing, pausing, seeking (sort of) and saving state when changing book/... | epage/nqaap | support/builddeb.py | Python | lgpl-2.1 | 4,263 | 0.026742 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
@frappe.whitelist()
def query_task(doctype, txt, searchfield, start, page_len, filters... | neilLasrado/erpnext | erpnext/projects/utils.py | Python | gpl-3.0 | 2,678 | 0.020164 |
kunci = "Python"
password = raw_input("Masukan password : ")
if password == kunci:
print"Password Benar"
else:
print"Password Salah"
| GunadarmaC0d3/Gilang-Aditya-Rahman | Python/Penggunaan else if.py | Python | gpl-2.0 | 141 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import print_function
import datetime
import fcntl
import os
import struct
import sys
import termios
try:
from io import BytesIO
except ImportError:
from cStringIO import StringIO as BytesIO
import six
from natural.constant import... | tehmaze/natural | natural/data.py | Python | mit | 3,460 | 0.000291 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def add_honeypot(apps, schema_editor):
Destination = apps.get_model("notify", "Destination")
try:
obj = Destination.objects.get(name="honeypot")
except Destination.DoesNotExist:
obj = Destinat... | andreasf/django-notify | notify/migrations/0002_add_honeypot.py | Python | mit | 553 | 0 |
#
# Copyright (C) 2000 Stephen Davies
# Copyright (C) 2000 Stefan Seefeld
# All rights reserved.
# Licensed to the public under the terms of the GNU LGPL (>= 2),
# see the file COPYING for details.
#
from Synopsis.Processor import Parameter
from Synopsis.Formatters.HTML.View import View
from Synopsis.Formatters.HTML.T... | stefanseefeld/synopsis | Synopsis/Formatters/HTML/Views/RawFile.py | Python | lgpl-2.1 | 3,392 | 0.003243 |
#!/usr/bin/env python
# Copyright 2015, Institute for Systems Biology.
# 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 app... | isb-cgc/ISB-CGC-data-proc | tcga_etl_pipeline/maf/part1/extract2.py | Python | apache-2.0 | 3,767 | 0.005575 |
from . import auth, users, rooms
from .config import config
import time
from flask import session
from pprint import pprint
import emoji
import re
escape_chars = (
("&", "&"),
("<", "<"),
(">", ">"),
)
def parse_markdown(message):
message = re.sub('\*{1}([^\*]+)\*{1}', '<b>\\1</b>', messag... | Chittr/Chittr | chittr/api.py | Python | mit | 1,106 | 0.012658 |
from time import sleep
import unittest2 as unittest
from tweepy.api import API
from tweepy.auth import OAuthHandler
from tweepy.models import Status
from tweepy.streaming import Stream, StreamListener
from config import create_auth
from test_utils import mock_tweet
from mock import MagicMock, patch
class MockStreamL... | dnr2/fml-twitter | tweepy-master/tests/test_streaming.py | Python | mit | 4,635 | 0.002589 |
"""Test for version 3 of the zero_out op."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow.python.platform
import tensorflow as tf
from tensorflow.g3doc.how_tos.adding_an_op import gen_zero_out_op_3
class ZeroOut3Test(tf.test.TestCase... | arunhotra/tensorflow | tensorflow/g3doc/how_tos/adding_an_op/zero_out_3_test.py | Python | apache-2.0 | 1,175 | 0.011064 |
import unittest
from scrapy.contrib.downloadermiddleware.redirect import RedirectMiddleware
from scrapy.spider import BaseSpider
from scrapy.exceptions import IgnoreRequest
from scrapy.http import Request, Response, HtmlResponse, Headers
class RedirectMiddlewareTest(unittest.TestCase):
def setUp(self):
s... | mzdaniel/oh-mainline | vendor/packages/scrapy/scrapy/tests/test_downloadermiddleware_redirect.py | Python | agpl-3.0 | 7,244 | 0.002761 |
"""Support for Blockchain.com sensors."""
from __future__ import annotations
from datetime import timedelta
import logging
from pyblockchain import get_balance, validate_address
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import ATTR_ATT... | rohitranjan1991/home-assistant | homeassistant/components/blockchain/sensor.py | Python | mit | 1,990 | 0 |
from __future__ import division, print_function
import autograd.numpy as np
import autograd.numpy.random as npr
from autograd.scipy.misc import logsumexp
from autograd.convenience_wrappers import value_and_grad as vgrad
from functools import partial
from os.path import join, dirname
import string
import sys
def EM(in... | barak/autograd | examples/hmm_em.py | Python | mit | 2,862 | 0.003494 |
import sys
from deap import base, creator, tools
import numpy as np
from csep.loglikelihood import calcLogLikelihood
# from models.mathUtil import calcNumberBins
import models.model
import random
import array
import time
from operator import attrgetter
# from scoop import futures
import fgeneric
import bbobbenchmarks a... | PyQuake/earthquakemodels | code/gaModel/gamodel_bbob.py | Python | bsd-3-clause | 6,592 | 0.003337 |
from rutinas import *
inputdir="ETERNA-INI/"
outputdir="ETERNA-OUT/"
inputdb=argv[1]
f=open(inputdir+"%s-INI/numeracionsismos.dat"%inputdb,"r")
for line in f:
if "#" in line:continue
line=line.strip()
numsismo=line.split()[0]
print "Generando datos de sismo '%s'..."%numsismo
cmd="python prd2dat.py... | seap-udea/tQuakes | util/Legacy/allprd.py | Python | gpl-2.0 | 391 | 0.038363 |
# Copyright 2015 Facundo Batista, Nicolás Demarchi
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ... | arielrossanigo/fades | tests/test_pipmanager.py | Python | gpl-3.0 | 4,315 | 0.001391 |
from treeseq_funcs import *
| tos-kamiya/pyrem_torq | src/pyrem_torq/treeseq/__init__.py | Python | mit | 29 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Author(s): Abhijeet Kasurde <akasurde@redhat.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version':... | dataxu/ansible | lib/ansible/modules/cloud/vmware/vmware_local_role_manager.py | Python | gpl-3.0 | 10,915 | 0.003207 |
import ble
import mqtt
from config import *
try:
ble.start()
mqtt.start()
finally:
#notify MQTT subscribers that gateway is offline
mqtt.publish(TOPIC_PREFIX, "offline")
ble.stop()
| blassphemy/mqtt-ble-gateway | main.py | Python | apache-2.0 | 208 | 0.009615 |
#abstract_component.py
import threading
class AbstractComponent:
logger = None
def init(self):
pass
def finalize(self):
pass
class AbstractQueryProviderComponent(AbstractComponent):
async_query_availabale = False
def getAvailableQueryCodeSet(self):
raise NotImplementedError('You have to overri... | 3WiseMen/python | pystock/pystock_xingAPI/abstract_component.py | Python | mit | 1,088 | 0.029412 |
import lexer
s = "program id; var beto: int; { id = 1234; }"
lexer.lexer.input(s)
for token in lexer.lexer:
print token
| betoesquivel/PLYpractice | testingLexer.py | Python | mit | 126 | 0 |
# coding: utf-8
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
INSTALLED_APPS = (
'tests.myapp',
'test_without_migrations',
'django_nose'
)
SITE_ID=1,
SECRET_KEY='secret'
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddl... | henriquebastos/django-test-without-migrations | tests/nose_settings.py | Python | mit | 509 | 0.005894 |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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 appl... | our-city-app/oca-backend | src/shop/handlers.py | Python | apache-2.0 | 26,782 | 0.002576 |
import json
import string
import random
import requests
import logging
import local_config
from couchdb import Server, http
from couchdb.http import PreconditionFailed, ResourceConflict
logger = logging.getLogger(__name__)
local_config.configure_logger(logger)
def create_db(database):
server = Server('http://... | cozy-labs/cozy-fuse | cozyfuse/dbutils.py | Python | bsd-3-clause | 10,338 | 0.000193 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
VMWARE external inventory script
=================================
shamelessly copied from existing inventory scripts.
This script and it's ini can be used more than once,
i.e vmware.py/vmware_colo.ini vmware_idf.py/vmware_idf.ini
(script can be link)
so if you don'... | mwarkentin/ansible | plugins/inventory/vmware.py | Python | gpl-3.0 | 6,210 | 0.007085 |
from selenium.webdriver.support.select import Select
def get_selected_option(browser, css_selector):
# Takes a css selector for a <select> element and returns the value of
# the selected option
select = Select(browser.find_element_by_css_selector(css_selector))
return select.first_selected_option.get_a... | egineering-llc/egat_example_project | tests/test_helpers/selenium_helper.py | Python | mit | 338 | 0.002959 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2018-12-15 19:34
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('archive', '0001_initial'),
]
operations = [
migrations.AlterField(
... | WarwickAnimeSoc/aniMango | archive/migrations/0002_auto_20181215_1934.py | Python | mit | 1,365 | 0.003663 |
# Copyright (c) 2010 Spotify AB
# Copyright (c) 2010-2011 Yelp
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, m... | darcyliu/storyboard | boto/emr/connection.py | Python | mit | 19,314 | 0.002537 |
from . import db
class Role(db.Model):
__tablename__ = 'roles'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(64), unique=True)
users = db.relationship('User', backref='role', lazy='dynamic')
def __repr__(self):
return '<Role %s>' % self.name
class User(db.Model... | mfwarren/FreeCoding | 2014/12/fc_30/app/models.py | Python | mit | 596 | 0 |
##############################################################################
# Copyright (c) 2013-2017, 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... | skosukhin/spack | var/spack/repos/builtin/packages/jags/package.py | Python | lgpl-2.1 | 1,927 | 0.000519 |
import logging
import re
import socket
from mopidy.config import validators
from mopidy.internal import log, path
def decode(value):
if isinstance(value, bytes):
value = value.decode(errors="surrogateescape")
for char in ("\\", "\n", "\t"):
value = value.replace(
char.encode(enco... | kingosticks/mopidy | mopidy/config/types.py | Python | apache-2.0 | 9,146 | 0 |
#import coin
class IDatabase:
def enter_coin(coin):
raise Exception('NotImplementedError') | SVladkov/Numismatic | database/idatabase.py | Python | gpl-3.0 | 94 | 0.042553 |
from django.test import TestCase
from ships.models import *
class ShipModelTest(TestCase):
pass
| davidgillies/ships | ships_proj/ships/tests/test_models.py | Python | gpl-2.0 | 109 | 0.018349 |
import sys
import pickle
##########################################################
# usage
# pypy find_2g.py xid_train.p ../../data/train
# xid_train.p is a list like ['loIP1tiwELF9YNZQjSUO',''....] to specify
# the order of samples in traing data
# ../../data/train is the path of original train data
##############... | bikash/kaggleCompetition | microsoft malware/Malware_Say_No_To_Overfitting/kaggle_Microsoft_malware_small/find_2g.py | Python | apache-2.0 | 1,327 | 0.027882 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
---------------------------------------------------------------------------------------------------
dlg_subida
mantém as informações sobre a dialog de subida
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Pub... | mlabru/ptracks | view/piloto/dlg_subida.py | Python | gpl-3.0 | 7,178 | 0.001123 |
# Copyright 2015, A10 Networks
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | dougwig/a10-neutron-lbaas | a10_neutron_lbaas/neutron_ext/extensions/a10DeviceInstance.py | Python | apache-2.0 | 4,037 | 0.000991 |
# 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 ... | AutorestCI/azure-sdk-for-python | azure-mgmt-monitor/azure/mgmt/monitor/models/diagnostic_settings_category_resource.py | Python | mit | 1,650 | 0.000606 |
# -*- encoding: utf-8 -*-
"""Test class for InterSatellite Sync feature
:Requirement: Satellitesync
:CaseAutomation: Automated
:CaseLevel: Acceptance
:CaseComponent: UI
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
from robottelo.decorators import (
run_only_on,
stubbed,
tier1,
t... | sghai/robottelo | tests/foreman/ui/test_satellitesync.py | Python | gpl-3.0 | 3,555 | 0 |
import os
import re
import copy
import paramiko
import StringIO
import unicodedata
from paramiko import SSHException, BadHostKeyException
# CloudScape Libraries
from cloudscape.common import config
from cloudscape.common import logger
from cloudscape.common.scp import SCPClient
from cloudscape.common.utils import vali... | djtaylor/cloudscape-DEPRECATED | python/cloudscape/common/remote.py | Python | gpl-3.0 | 25,284 | 0.009294 |
from operator import attrgetter
from django.test import TestCase
from models import Post, Question, Answer
class OrderWithRespectToTests(TestCase):
def test_basic(self):
q1 = Question.objects.create(text="Which Beatle starts with the letter 'R'?")
q2 = Question.objects.create(text="What is your ... | mzdaniel/oh-mainline | vendor/packages/Django/tests/modeltests/order_with_respect_to/tests.py | Python | agpl-3.0 | 2,870 | 0.002787 |
from stagecraft.apps.datasets.models import DataGroup, DataSet, DataType
from django.test import TestCase
from stagecraft.libs.mass_update import DataSetMassUpdate
from nose.tools import assert_equal
class TestDataSetMassUpdate(TestCase):
@classmethod
def setUpClass(cls):
cls.data_group1 = DataGroup.... | alphagov/stagecraft | stagecraft/libs/mass_update/test_data_set_mass_update.py | Python | mit | 3,422 | 0 |
try:
from settings_local import MyConf
except ImportError:
from feedreader.conf.base import Dev as MyConf
try:
from settings_local import MyTestConf
except ImportError:
from feedreader.conf.base import Test as MyTestConf
| jo-soft/jadfr | jadfr/feedreader/conf/my_conf.py | Python | gpl-3.0 | 238 | 0 |
#!/bin/env python
# -*- coding: utf-8 -*-
PYS_SERVICE_MOD_PRE='pys_' # 模块名称的前缀
PYS_HEAD_LEN=12 # 报文头长度
PYS_MAX_BODY_LEN=10485760 # 最大报文长度
| dungeonsnd/test-code | dev_examples/pyserver/src/util/pys_define.py | Python | gpl-3.0 | 184 | 0.033784 |
# -*- coding:utf-8 -*-
from functools import wraps
from flask import abort
from flask import request
def kwargs_required(*required_args):
def decorate(func):
@wraps(func)
def wrapper(*args, **kwargs):
for arg in required_args:
if arg not in kwargs:
... | pycook/cmdb | cmdb-api/api/lib/decorator.py | Python | gpl-2.0 | 838 | 0 |
# -*- coding: utf-8 -*-
#
# Zend Framework 2 documentation build configuration file, created by
# sphinx-quickstart on Fri Jul 6 18:55:07 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file... | froschdesign/zf2-documentation | docs/src/conf.py | Python | bsd-3-clause | 8,058 | 0.007322 |
#!/usr/bin/python
import shtest, sys, common
from common import *
from math import *
def frac_test(p, types=[]):
if is_array(p):
result = [a - floor(a) for a in p]
else:
result = [a - floor(a)]
return shtest.make_test(result, [p], types)
def insert_into(test):
test.add_test(frac_test(... | libsh-archive/sh | test/regress/frac.cpp.py | Python | lgpl-2.1 | 1,097 | 0.003646 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleads/google-ads-python | google/ads/googleads/v9/errors/types/ad_parameter_error.py | Python | apache-2.0 | 1,192 | 0.000839 |
" Settings for tests. "
from settings.project import *
# Databases
DATABASES= {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
'USER': '',
'PASSWORD': '',
'TEST_CHARSET': 'utf8',
... | klen/django-netauth | example_project/settings/test.py | Python | lgpl-3.0 | 347 | 0.005764 |
# -*- coding: utf-8 -*-
from framework.tasks import app
from framework.tasks.handlers import enqueue_task
from website import settings
from . import piwik
@app.task(bind=True, max_retries=5, default_retry_delay=60)
def _update_node(self, node_id, updated_fields=None):
# Avoid circular imports
from framewor... | AndrewSallans/osf.io | framework/analytics/tasks.py | Python | apache-2.0 | 822 | 0 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'UserProfile.is_mysqldba_oncall'
db.add_column(u'user_profiles', 'is_mysqldba_oncall',
... | mozilla/inventory | systems/migrations/0002_auto__add_field_userprofile_is_mysqldba_oncall__add_field_userprofile_.py | Python | bsd-3-clause | 21,325 | 0.008159 |
#
# 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 us... | BryanCutler/spark | python/pyspark/ml/classification.py | Python | apache-2.0 | 126,641 | 0.002953 |
import pytest
import chainerx
def test_name_native():
backend = chainerx.get_global_default_context().get_backend('native')
assert 'native' == backend.name
def test_get_device_native():
backend = chainerx.get_global_default_context().get_backend('native')
device = backend.get_device(0)
assert 0... | okuta/chainer | tests/chainerx_tests/unit_tests/test_backend.py | Python | mit | 1,149 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# pysia documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# 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
# autog... | jnmclarty/pysia | docs/conf.py | Python | mit | 8,373 | 0.005374 |
# -*- coding: utf-8 -*-
# TODO:
# * Move/rename namespace polluting attributes
# * Documentation
# * Make backends optional: Meta.backends = (path, modelinstance/model, view)
import hashlib
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.datastructures i... | shirishagaddi/django-seo | rollyourown/seo/base.py | Python | bsd-3-clause | 14,784 | 0.004532 |
# -*- coding: utf-8 -*-
"""Functional tests using WebTest.
See: http://webtest.readthedocs.org/
"""
import pytest
from flask import url_for
from myflaskapp.models.user import User
from .factories import UserFactory
class TestLoggingIn:
def test_can_log_in_returns_200(self, user, testapp):
# Goes to ho... | wdm0006/myflaskapp | tests/test_functional.py | Python | bsd-3-clause | 3,662 | 0.000273 |
"""
App wide event registry
Everything in the application is communicated via pubsub. These are the events
that tie everything together.
"""
import wx # type: ignore
WINDOW_STOP = wx.Window.NewControlId()
WINDOW_CANCEL = wx.Window.NewControlId()
WINDOW_CLOSE = wx.Window.NewControlId()
WINDOW_ST... | chriskiehl/Gooey | gooey/gui/events.py | Python | mit | 840 | 0.014286 |
from pixie.vm.reader import read, StringReader
from pixie.vm.object import Object
from pixie.vm.cons import Cons
from pixie.vm.numbers import Integer
from pixie.vm.symbol import symbol, Symbol
from pixie.vm.persistent_vector import PersistentVector
import pixie.vm.rt as rt
import unittest
data = {u"(1 2)": (1, 2,),
... | andrewchambers/pixie | pixie/vm/test/test_reader.py | Python | gpl-3.0 | 1,607 | 0.001245 |
# Copyright 2018 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | tensorflow/profiler-ui | server/server.py | Python | apache-2.0 | 2,149 | 0.011633 |
# -*- coding: utf-8 -*-
#
# django-bulbs documentation build configuration file, created by
# sphinx-quickstart on Wed Sep 18 16:55:34 2013.
#
# 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.
#
... | pombredanne/django-bulbs | docs/conf.py | Python | mit | 8,285 | 0.007483 |
# -*- coding: utf-8 -*-
from __future__ import division, unicode_literals, absolute_import, print_function
import json
import copy
"""
Oграничения режима sequence_set:
1) OCCMATRIX не копируется для дочерних сетов
2) Режим U-ramping выключен для дочерних сетов
3) Есть еще, режим afm_ordering, возможно neb
4) kpoints... | dimonaks/siman | siman/set_functions.py | Python | gpl-2.0 | 28,264 | 0.022053 |
import sys
import copy
import json
import os.path
import unittest
from hashlib import sha256
from io import BytesIO
from metacore import storj
from metacore.database import files
from metacore.error_codes import *
from metacore.tests import *
if sys.version_info.major == 3:
from unittest.mock import patch, Mock
e... | Storj/metacore | metacore/tests/test_upload.py | Python | agpl-3.0 | 12,336 | 0 |
## encoding=utf-8
#!/usr/bin/env python
"""
cubieboard ip module, which show ip
"""
__author__ = "Dingo"
__copyright__ = "Copyright 2013, Cubieboard Player Project"
__credits__ = ["PySUNXI project"]
__license__ = "GPL"
__version__ = "0.0.2"
__maintainer__= "Dingo"
__email__ = "btrfs@sina.com"
import os, s... | netdingo/cbplayer | disk.py | Python | gpl-2.0 | 882 | 0.037415 |
# Copyright 2016 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... | npuichigo/ttsflow | third_party/tensorflow/tensorflow/contrib/learn/python/learn/dataframe/transforms/example_parser.py | Python | apache-2.0 | 2,407 | 0.005401 |
import pymongo
import json
cache = {}
client = pymongo.MongoClient()
try:
dbConf = json.load(open("./model/db.json","r"))
except:
try:
dbConf = json.load(open("./db.json","r"))
except:
dbConf = {"dbname": "voteview"}
db = client[dbConf["dbname"]]
def metaLookup(api = ""):
if not api:
... | JeffreyBLewis/WebVoteView | model/searchMeta.py | Python | apache-2.0 | 568 | 0.03169 |
# encoding=utf-8
'''
Created on 2013-9-8
@author: gudh
'''
start_pos = (5, 222) # 开始的位置
block_size = (67, 67) # 块大小
rel_pos = (33, 28) # 相对块头位置
colors = (
(255, 255, 255), # 白
(164, 130, 213), # 紫
(247, 214, 82), # 黄
(244, 160, 90), # 土
(90, 186, 238), # 蓝
(247, 69, 95), # 红
(173, 235, 82) # 绿
)
colornames = (u'ba', ... | Yhzhtk/pytool | game/aixiaochu/xiaochu.py | Python | gpl-2.0 | 2,786 | 0.013943 |
import os
import shutil
import tempfile
from nose.tools import eq_, ok_
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User, Permission
from django.core.files import File
from crashstats.tokens.models import Token
from crashstats.crashstats.tests.test_views import BaseTestViews
f... | bsmedberg/socorro | webapp-django/crashstats/symbols/tests/test_views.py | Python | mpl-2.0 | 15,401 | 0 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import signal
import tornado.ioloop
import tornado.web
import tornado.httpserver
import tornadoredis
import torndb
from tornado.options import options, define
import log
import handlers.test
from settings import (
DEBUG, PORT, HOST,
MYSQL_CONFIG, REDIS_CONFIG
)
... | zhkzyth/storm_maker | template/src/app.py | Python | mit | 1,540 | 0 |
"""
.. module:: poes
:synopsis: A module for reading, writing, and storing poes Data
.. moduleauthor:: AJ, 20130129
*********************
**Module**: gme.sat.poes
*********************
**Classes**:
* :class:`poesRec`
**Functions**:
* :func:`readPoes`
* :func:`readPoesFtp`
* :func:`mapPoesMongo`
* :func:`... | Shirling-VT/davitpy_sam | davitpy/gme/sat/poes.py | Python | gpl-3.0 | 33,273 | 0.033751 |
from django.contrib import admin
from .models import *
class CategoryAdmin(admin.ModelAdmin):
list_display = ('id', 'title')
class ReviewCategoryAdmin(admin.ModelAdmin):
list_display = ('id', 'title')
class BlogCategoryAdmin(admin.ModelAdmin):
list_display = ('id', 'title')
class CardAdmin(admin.Mode... | BijoySingh/HomePage | homepage/admin.py | Python | gpl-2.0 | 1,571 | 0.00191 |
#!/usr/bin/env python
#
# CLUES - Cluster Energy Saving System
# Copyright (C) 2015 - GRyCAP - Universitat Politecnica de Valencia
#
# 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... | grycap/clues | cluesplugins/nomad.py | Python | gpl-3.0 | 29,940 | 0.012792 |
import json
import logging
import re
from contextlib import contextmanager
@contextmanager
def disable_warnings(logger_name):
"""
Suppresses expected warning messages to keep the test output clean.
"""
logger = logging.getLogger(logger_name)
current_level = logger.level
logger.setLevel(logging... | respawner/peering-manager | utils/testing/functions.py | Python | apache-2.0 | 1,327 | 0.000754 |
from flask import render_template, redirect, request, url_for, flash
from flask_login import login_user, logout_user, login_required, current_user
from . import auth
from .. import db
from ..models import User
from ..email import send_email
from .forms import LoginForm, RegistrationForm, ChangePasswordForm,\
Passwo... | haup/totoro | totoro/app/auth/views.py | Python | gpl-3.0 | 6,038 | 0 |
from django.shortcuts import redirect
from django.views.decorators.csrf import csrf_exempt
from django.http import HttpResponse
from paste.models import Paste, Language
@csrf_exempt
def add(request):
print "jojo"
if request.method == 'POST':
language = request.POST['language']
content = r... | spezifanta/Paste-It | api/v01/views.py | Python | mit | 749 | 0.006676 |
import utils
import os
from functools import partial
import sys
from itertools import groupby as itertools_groupby
mlst_timer = partial(utils.timer, name='MLST')
def get_species_scheme_map_version(mlst_folder):
species_scheme_map_version = 1
mlst_db_path = os.path.join(os.path.dirname(os.path.dirname(mlst_... | B-UMMI/INNUca | modules/mlst.py | Python | gpl-3.0 | 7,916 | 0.003284 |
"""Add user table
Revision ID: 42ad047fd7ff
Revises: 5cd786f3176
Create Date: 2014-10-03 12:14:11.091123
"""
# revision identifiers, used by Alembic.
revision = '42ad047fd7ff'
down_revision = '5cd786f3176'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - p... | msimacek/koschei | alembic/versions/42ad047fd7ff_add_user_table.py | Python | gpl-2.0 | 903 | 0.014396 |
# THIS FILE IS AUTO-GENERATED. DO NOT EDIT
from verta._swagger.base_type import BaseType
class UacGetOrganizationByIdResponse(BaseType):
def __init__(self, organization=None):
required = {
"organization": False,
}
self.organization = organization
for k, v in required.items():
if self[k] ... | mitdbg/modeldb | client/verta/verta/_swagger/_public/uac/model/UacGetOrganizationByIdResponse.py | Python | mit | 653 | 0.01072 |
"""
podpy is an implementatin of the pixel optical depth method as described in
Turner et al. 2014, MNRAS, 445, 794, and Aguirre et al. 2002, ApJ, 576, 1.
Please contact the author (Monica Turner) at turnerm@mit.edu if you have
any questions, comment or issues.
"""
| turnerm/podpy | podpy/__init__.py | Python | mit | 271 | 0.01845 |
# being a bit too dynamic
from distutils.version import LooseVersion
import operator
def _mpl_version(version, op):
def inner():
try:
import matplotlib as mpl
except ImportError:
return False
return (
op(LooseVersion(mpl.__version__), LooseVersion(versio... | toobaz/pandas | pandas/plotting/_matplotlib/compat.py | Python | bsd-3-clause | 554 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import socket, time
import sys
import multiprocessing
def readlines(sock, recv_buffer=4096, delim='\n'):
buffer = ''
data = True
while data:
data = sock.recv(recv_buffer)
buffer += data
while buffer.find(delim) != -1:
line, buffer = buffer.split('\n', 1)
yi... | redarmy30/Eurobot-2017 | old year/RESET-master/Testing/server_small.py | Python | mit | 805 | 0.034783 |
# Copyright 2015 Mirantis, 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 ... | gitfred/fuel-extension-volume-manager | volume_manager/tests/test_migration_volume_manager_extension_001_add_volumes_table.py | Python | apache-2.0 | 3,073 | 0 |
"""
Tests for DistCI task management interfaces
Copyright (c) 2012-2013 Heikki Nousiainen, F-Secure
See LICENSE for details
"""
from nose.plugins.skip import SkipTest
from webtest import TestApp, TestRequest
import json
import tempfile
import os
import shutil
from distci import frontend
class TestTasks:
app = N... | F-Secure/distci | src/distci/frontend/tests/test-frontend-tasks.py | Python | apache-2.0 | 4,501 | 0.004666 |
import os
import string
import random
import mmap
import sys
DATATYPES = dict(
ascii_letters=string.ascii_letters.encode(),
ascii_lowercase=string.ascii_lowercase.encode(),
ascii_uppercase=string.ascii_uppercase.encode(),
digits=string.digits.encode(),
hexdigits=string.hexdigits.encode(),
octdi... | zlorb/mitmproxy | pathod/language/generators.py | Python | mit | 2,469 | 0.00081 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import gettext
from enum import Enum, unique
_ = gettext.gettext
strategy_descriptions = [_("New resourcelist strategy"),
_("New changelist strategy"),
_("Incremental changelist strategy")]
@unique
class Strategy(Enum... | EHRI/rspub-core | rspub/core/rs_enum.py | Python | apache-2.0 | 3,776 | 0.001324 |
# -*- encoding: utf-8 -*-
"""Implements Architecture UI"""
from robottelo.constants import FILTER
from robottelo.ui.base import Base
from robottelo.ui.locators import common_locators, locators
from robottelo.ui.navigator import Navigator
class Architecture(Base):
"""Manipulates architecture from UI"""
def n... | elyezer/robottelo | robottelo/ui/architecture.py | Python | gpl-3.0 | 1,561 | 0 |
# -*- coding: utf-8 -*-
# See LICENSE file for full copyright and licensing details.
from . import hotel_wizard
from . import sale_make_invoice_advance
| JayVora-SerpentCS/vertical-hotel | hotel/wizard/__init__.py | Python | agpl-3.0 | 153 | 0 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'Score.created_at'
db.add_column(u'core_score', 'created_a... | SM2015/orchid | core/migrations/0002_auto__add_field_score_created_at__add_field_score_updated_at__add_fiel.py | Python | mit | 11,751 | 0.007404 |
from django.contrib.auth.models import User
from is_core.main import UIRestModelISCore
from .models import Issue
class IssueIsCore(UIRestModelISCore):
model = Issue
class UserIsCore(UIRestModelISCore):
model = User | asgeirrr/django-is-core | example/issues/cores.py | Python | lgpl-3.0 | 228 | 0.004386 |
'''
This version of the terrain generator library interpreter is set up to produce terrain maps using Perlin noise.
Important settings and inits specific to the Perlin generator can be found in the code by searching for cfref:perlin-gen
Additional display options may be viewed by swapping WHICH_COLOR_SCHEME constant... | BFriedland/TerrainGenerators | PerlinGeneratorDemo.py | Python | mit | 17,655 | 0.020164 |
# -*- coding: utf-8 -*-
from uamobile.factory.base import AbstractUserAgentFactory
from uamobile.ezweb import EZwebUserAgent
from uamobile.parser import CachingEZwebUserAgentParser
class EZwebUserAgentFactory(AbstractUserAgentFactory):
device_class = EZwebUserAgent
parser = CachingEZwebUserAgentParser()
... | csakatoku/uamobile | uamobile/factory/ezweb.py | Python | mit | 321 | 0.009346 |
# 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 ... | ZhangXFeng/hadoop | src/hadoop-mapreduce1-project/src/contrib/cloud/src/py/hadoop/cloud/util.py | Python | apache-2.0 | 2,562 | 0.016393 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-present Taiga Agile LLC
#
# 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 ver... | taigaio/taiga-back | taiga/webhooks/signal_handlers.py | Python | agpl-3.0 | 2,526 | 0.000396 |
from caffe import io as c
import numpy as np
import os,sys
if len(sys.argv) < 3:
print 'Use: convertProtobinToNumpy protobinFile numpyOutput'
sys.exit()
protoData = c.caffe_pb2.BlobProto()
f = open(sys.argv[1],'rb')
protoData.ParseFromString(f.read())
f.close()
array = c.blobproto_to_array(protoData)
np.save(sys.... | jccaicedo/localization-agent | learn/cnn/convertProtobinToNumpy.py | Python | mit | 447 | 0.017897 |
"""
# TOP2049 Open Source programming suite
#
# Atmel AT89C2051 DIP20 Support
#
# Copyright (c) 2010 Guido
# Copyright (c) 2010 Michael Buesch <m@bues.ch>
#
# 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
# ... | mbuesch/toprammer | libtoprammer/chips/at89c2051dip20.py | Python | gpl-2.0 | 6,509 | 0.036104 |
# -*- coding: utf-8 -*-
'''
Module to manage Linux kernel modules
'''
# Import python libs
import os
import re
# Import salt libs
import salt.utils
def __virtual__():
'''
Only runs on Linux systems
'''
return 'kmod' if __grains__['kernel'] == 'Linux' else False
def _new_mods(pre_mods, post_mods):
... | victorywang80/Maintenance | saltstack/src/salt/modules/kmod.py | Python | apache-2.0 | 6,443 | 0.000466 |
import numpy as np
def point_in_hull(point, hull, tolerance=1e-12):
return all((np.dot(eq[:-1], point) + eq[-1] <= tolerance) for eq in hull.equations)
def n_points_in_hull(points, hull):
n_points = 0
for i in range(points.shape[0]):
if point_in_hull(points[i, :], hull):
n_points = n... | ethz-asl/segmatch | segmappy/segmappy/tools/hull.py | Python | bsd-3-clause | 583 | 0.001715 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2012:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can redis... | shinken-monitoring/mod-perfdata-service | module/module.py | Python | agpl-3.0 | 5,056 | 0.001978 |
import json
from bson.errors import InvalidId
from flask import Blueprint, jsonify, request, g
item_api = Blueprint('itemApi', __name__)
def get_item_as_object(item) -> dict:
return_item = {
"_id": str(item['_id']),
"name": item['name'],
"description": item['description'],
"imageU... | project-hopkins/Westworld | hopkin/routes/items.py | Python | gpl-3.0 | 8,707 | 0.001034 |
#### 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 = Creature()
result.template = "object/mobile/shared_dressed_diplomat_zabrak_male_01.iff"
result.attribute_template... | anhstudios/swganh | data/scripts/templates/object/mobile/shared_dressed_diplomat_zabrak_male_01.py | Python | mit | 457 | 0.045952 |
"""Version information."""
__version__ = '0.0.2'
| kstaniek/pampio | pampio/version.py | Python | apache-2.0 | 50 | 0 |
# Copyright 2015 Rackspace US, 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 wri... | samstav/fastfood | fastfood/book.py | Python | apache-2.0 | 10,125 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.