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
class scaling_data:
def __init__ (self, filename):
import re
self.data = []
self.N_chunk = 0
self.N_basic = 0
fd = open(filename)
for line in fd:
if self.N_chunk == 0:
result = re.compile("^running.* -N ([0-9]+) -b ([0-9]*) ").search(line)
if res... | FreeON/spammpack | src-charm/tools/process_scaling_data.py | Python | bsd-3-clause | 16,233 | 0.030863 |
#!/usr/local/bin/python3
def one(alist):
for passnum in range(len(alist)-1,0,-1):
for i in range(passnum):
if alist[i]>alist[i+1]:
temp = alist[i]
alist[i] = alist[i+1]
alist[i+1] = temp
alist = [54,26,93,17,77,31,44,55,20]
print(alist)
one(alist... | ShaftesburySchoolDorset/PythonChallenges | algorithm_identification/1.py | Python | gpl-3.0 | 334 | 0.038922 |
#!/usr/bin/env python
import sys
import re
import getopt
from feed_maker_util import IO
def main():
state = 0
url_prefix = "https://spring.io"
result_list = []
num_of_recent_feeds = 1000
optlist, _ = getopt.getopt(sys.argv[1:], "n:")
for o, a in optlist:
if o == '-n':
nu... | terzeron/FeedMakerApplications | study/_spring/capture_item_link_title.py | Python | gpl-2.0 | 1,528 | 0.001309 |
# -*- coding: utf-8 -*-
from queue import Queue
from lxml import etree
import requests
import random
from settings import *
import time
import socket
from pybloom_live import BloomFilter
from settings import log
import os
from settings import REFRESH_BF
from settings import MIN_NUM
import redis
import threading
import... | yutian2011/IPProxy | proxy.py | Python | gpl-3.0 | 5,041 | 0.011902 |
# -*- coding: UTF-8 -*-
__revision__ = '$Id$'
# Copyright (c) 2011 Ivo Nunes
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later ... | santiavenda2/griffith | lib/plugins/movie/PluginMovieIMDB-pt.py | Python | gpl-2.0 | 7,570 | 0.004761 |
from .entailment.decomposable_attention import DecomposableAttention
from .memory_networks.differentiable_search import DifferentiableSearchMemoryNetwork
from .memory_networks.memory_network import MemoryNetwork
from .memory_networks.softmax_memory_network import SoftmaxMemoryNetwork
from .multiple_choice_qa.decomposab... | RTHMaK/RPGOne | deep_qa-master/deep_qa/models/__init__.py | Python | apache-2.0 | 3,009 | 0.00432 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2009 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved.
# Jordi Esteve <jesteve@zikzakmedia.com>
# $Id$
#
# Th... | jmesteve/saas3 | openerp/addons_extra/l10n_es_fiscal_year_closing/wizard/__init__.py | Python | agpl-3.0 | 1,141 | 0.001753 |
# -*- coding: utf-8 -*-
'''
Neutron class
'''
# Import python libs
from __future__ import absolute_import, with_statement
import logging
# Import third party libs
import salt.ext.six as six
# pylint: disable=import-error
HAS_NEUTRON = False
try:
from neutronclient.v2_0 import client
from neutronclient.shell ... | smallyear/linuxLearn | salt/salt/utils/openstack/neutron.py | Python | apache-2.0 | 33,523 | 0.00006 |
def analyze(data, weight_fn=None):
"""Returns the average and sample variance (s**2) of a list of floats.
`weight_fn` is a function that takes a list index and a window width, and
returns a weight that is used to calculate a weighted average. For example,
see `default_weights` or `linear_weights` belo... | avih/treeherder | treeherder/perfalert/perfalert/__init__.py | Python | mpl-2.0 | 5,173 | 0.000773 |
# Copyright (c) 2010 by Yaco Sistemas <pmartin@yaco.es>
#
# 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 3 of the License, or
# (at your option) any later version.
... | Yaco-Sistemas/django-autoreports | autoreports/urls.py | Python | lgpl-3.0 | 1,686 | 0.021945 |
from setuptools import setup, find_packages
setup(
name="mongodb",
version="3.0.1",
author="Marcus LaFerrera (@mlaferrera)",
url="https://github.com/PUNCH-Cyber/stoq-plugins-public",
license="Apache License 2.0",
description="Save results and archive payloads using MongoDB",
packages=find_p... | PUNCH-Cyber/stoq-plugins-public | mongodb/setup.py | Python | apache-2.0 | 364 | 0 |
# -*- coding: utf-8 -*-
__all__ = ["mpd"]
| ggilestro/majordomo | actors/__init__.py | Python | mit | 42 | 0 |
# coding=utf-8
"""
Diamond collector that monitors relevant MySQL performance_schema values
For now only monitors replication load
[Blog](http://bit.ly/PbSkbN) announcement.
[Snippet](http://bit.ly/SHwYhT) to build example graph.
#### Dependencies
* MySQLdb
* MySQL 5.5.3+
"""
from __future__ import division
... | MichaelDoyle/Diamond | src/collectors/mysqlstat/mysql55.py | Python | mit | 8,223 | 0 |
"""The harness interface
The interface between the client and the server when hosted.
"""
__author__ = """Copyright Andy Whitcroft 2006"""
import os, sys
import common
class harness(object):
"""The NULL server harness
Properties:
job
The job object for this job
"""
... | yochow/autotest | client/bin/harness.py | Python | gpl-2.0 | 2,286 | 0.006124 |
# Copyright 2012 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 ... | ksh/gpirecertification | controllers/assessments.py | Python | apache-2.0 | 11,743 | 0.007153 |
import re
from django.db.models import fields
from django.template.defaultfilters import slugify
def _unique_slugify(instance, value, slug_field_name='slug', queryset=None, slug_separator='-'):
slug_field = instance._meta.get_field(slug_field_name)
slug_len = slug_field.max_length
# Sort out the initial s... | underlost/GamerNews | gamernews/apps/news/fields.py | Python | mit | 3,543 | 0.005927 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# NetProfile: Bills module - Views
# Copyright © 2017 Alex Unigovsky
#
# This file is part of NetProfile.
# NetProfile 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... | unikmhz/npui | netprofile_bills/netprofile_bills/views.py | Python | agpl-3.0 | 3,005 | 0 |
#!/usr/bin/python3
def soma_hipotenusas(n):
chipotenusa=1
somahipot=[]
while chipotenusa <=n:
cat1 = 1
while cat1 <=n:
cat2=1
cat1+=1
while cat2 <=n:
if (cat1**2 + cat2**2) == chipotenusa**2:
if chipotenusa not in somah... | david81brs/seaport | week6/l5_hipotenusas.py | Python | gpl-2.0 | 632 | 0.022152 |
import logging
import json
from ansible.runner import Runner
from taskflow.patterns import linear_flow, unordered_flow
from taskflow.task import Task
shell_task = Runner(
host_list=['eselnlx1453'],
pattern= '*',
module_name = 'shell',
module_args='echo "Hello World"')
c... | fs714/drcontroller | drcontroller/recovery/base.py | Python | apache-2.0 | 2,725 | 0.008807 |
#! /usr/bin python
import numpy as np
import matplotlib.pyplot as plt
if __name__ == "__main__":
print("Generate and demodulate IEEE 802.15.4 compliant CSS baseband signal")
slow_rate = False
phy_packetsize_bytes = 38
nframes = 40
chirp_number = 2
m = css_mod.modulator(slow_rate=slow_rate, phy_packetsize_bytes... | bastibl/gr-ieee802-15-4 | python/css_analyze_tx_signal.py | Python | gpl-3.0 | 6,539 | 0.029209 |
#!/usr/bin/env python
import amr
import sys
import subprocess
import smatch_modified
import os
import random
import time
#import optparse
#import argparse #argparse only works for python 2.7. If you are using older versin of Python, you can use optparse instead.
#import locale
ERROR_LOG=sys.stderr
verbose=False
isi... | VladimirVystupkin/AMRParsing1.x | smatch_v1_0/smatch-table.py | Python | gpl-2.0 | 12,971 | 0.046334 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='IntegerArrayDefaultModel',
... | DONIKAN/django | tests/postgres_tests/array_default_migrations/0001_initial.py | Python | bsd-3-clause | 654 | 0.003058 |
import os
import sys
import inspect
_module = sys.modules[__name__]
_safe_import_list = [_x.__name__ for _x in _module, os, sys, inspect]
for mod in [m for m in sys.modules.keys() if m != __name__ and sys.modules[m] != None and m.startswith(__name__) and len(m.split(__name__ + ".")[-1].split(".")) == 1 and (not sys.m... | deathglitch/metarigging | python/metaui/__init__.py | Python | mit | 1,252 | 0.009585 |
"""
color_scheme_matcher.
Licensed under MIT.
Copyright (C) 2012 Andrew Gibson <agibsonsw@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 without limit... | arnedesmedt/dotfiles | .config/sublime-text-3/Packages.symlinkfollow/mdpopups/st3/mdpopups/st_color_scheme_matcher.py | Python | mit | 23,380 | 0.003208 |
import pytest
from django.urls import reverse
from adhocracy4.dashboard import components
from adhocracy4.test.helpers import assert_template_response
from adhocracy4.test.helpers import redirect_target
from adhocracy4.test.helpers import setup_phase
from meinberlin.apps.topicprio.models import Topic
from meinberlin.a... | liqd/a4-meinberlin | tests/topicprio/dashboard_components/test_views_module_topics.py | Python | agpl-3.0 | 3,141 | 0 |
import os
import struct
from binascii import unhexlify
from shutil import copy as copyfile
from twisted.internet.defer import inlineCallbacks
from Tribler.Core.CacheDB.SqliteCacheDBHandler import TorrentDBHandler, MyPreferenceDBHandler, ChannelCastDBHandler
from Tribler.Core.CacheDB.sqlitecachedb import str2bin
from ... | Captain-Coder/tribler | Tribler/Test/Core/test_sqlitecachedbhandler_torrents.py | Python | lgpl-3.0 | 13,903 | 0.002374 |
# -*- coding: iso-8859-15 -*-
#
# Testing Suite for >> Get_Channels.py [QGIS Version]
#
# Copyright (C) 2017 J. Vicente Perez, Universidad de Granada
#
# 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 ... | geolovic/TProfiler | Tools/debug/Chi_Map_QGIS_testing_suite.py | Python | gpl-3.0 | 6,907 | 0.000869 |
import sqlite3
import jukebox
from song_metadata import SongMetadata
from file_metadata import FileMetadata
class JukeboxDB:
def __init__(self, metadata_db_file_path=None, debug_print=False):
self.debug_print = debug_print
self.db_connection = None
if metadata_db_file_path is not None and... | pauldardeau/cloud-jukebox | jukebox_db.py | Python | bsd-3-clause | 18,366 | 0.000436 |
#!/usr/bin/env python
from __future__ import division, print_function
# cloudberryCam v0 copyright (c) 2013-2015 Lars Rosengreen
# 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 ... | lrosengreen/cloudberry | server.py | Python | gpl-3.0 | 2,533 | 0.006711 |
import types
from flask import jsonify
from werkzeug.exceptions import default_exceptions
from werkzeug.exceptions import HTTPException
from twiml_server import app
def make_json_app():
def make_json_error(ex):
response = jsonify(message=str(ex))
response.status_code = (ex.code
... | vfulco/twilio_server | twiml_server/common/util.py | Python | gpl-3.0 | 541 | 0 |
"""
tests.components.light.test_mqtt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests mqtt light.
config for RGB Version with brightness:
light:
platform: mqtt
name: "Office Light RGB"
state_topic: "office/rgb1/light/status"
command_topic: "office/rgb1/light/switch"
brightness_state_topic: "office/rgb1/brightness/s... | badele/home-assistant | tests/components/light/test_mqtt.py | Python | mit | 5,134 | 0 |
from test.vim_test_case import VimTestCase as _VimTest
from test.constant import *
class TextTabStopTextAfterTab_ExpectCorrectResult(_VimTest):
snippets = ('test', '$1 Hinten\n$1')
keys = 'test' + EX + 'hallo'
wanted = 'hallo Hinten\nhallo'
class TextTabStopTextBeforeTab_ExpectCorrectResult(_VimTest):
... | yslin/tools-zodlin | ubuntu/vim/.vim/lang/all/ultisnips/test/test_Mirror.py | Python | apache-2.0 | 8,787 | 0.000114 |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | GoogleCloudPlatform/python-docs-samples | functions/billing/main.py | Python | apache-2.0 | 7,657 | 0.000522 |
from dasdocc.conf import base | JohnRandom/django-aggregator | dasdocc/conf/staging.py | Python | bsd-3-clause | 29 | 0.034483 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2011 Yesudeep Mangalapilly <yesudeep@gmail.com>
# Copyright 2012 Google, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | austinwagner/sublime-sourcepawn | watchdog/events.py | Python | mit | 18,129 | 0.006619 |
u"""
Fixer for Python 3 function parameter syntax
This fixer is rather sensitive to incorrect py3k syntax.
"""
# Note: "relevant" parameters are parameters following the first STAR in the list.
from lib2to3 import fixer_base
from lib2to3.fixer_util import token, String, Newline, Comma, Name
from libfuturize.fixer_uti... | thonkify/thonkify | src/lib/libpasteurize/fixes/fix_kwargs.py | Python | mit | 6,066 | 0.001813 |
# Copyright 2014 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the ... | txomon/vdsm | vdsm/network/tc/qdisc.py | Python | gpl-2.0 | 4,910 | 0 |
import numpy as np
import matplotlib.pyplot as plt
N = 200
D = 2
X = np.random.randn(N, D)
# Bias term
ones = np.array([[1]*N]).T
# Concatenate with input X
Xb = np.concatenate((ones, X), axis=1)
# Randomly initialize w
w = np.random.randn(D)
z = X.dot(w)
def sigmoid(z):
return 1/(1 + np.exp(-z))
def hyper... | adexin/Python-Machine-Learning-Samples | Logistic_regression/Ecommerce_logpredict/logistic.py | Python | mit | 495 | 0.00202 |
# Copyright (c) 2020, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
import itertools
import numpy as np
import pytest
from coremltools.converters.mil.mil import Builder... | apple/coremltools | coremltools/converters/mil/mil/passes/test_noop_elimination.py | Python | bsd-3-clause | 13,225 | 0.001966 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.db.models.fields.files import ImageFieldFile, ImageField
from django.utils.translation import ugettext_lazy as _
from django.db.models.signals import pre_save, pre_delete
from PIL import Image as PILImage
from storageimage import settings
class StorageImageFie... | sixpearls/wagtail-storageimage | storageimage/models.py | Python | bsd-2-clause | 2,687 | 0.00521 |
# Universidade de Aveiro - Physics Department
# 2016/2017 Project - Andre Calatre, 73207
# "Simulation of an epidemic" - 25/3/2017
# The following code has been based on:
# Forest Fire Model from http://scipython.com/blog/the-forest-fire-model/
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import... | calatre/epidemics_network | models/other/ep2.py | Python | apache-2.0 | 3,929 | 0.000509 |
#!/usr/bin/env python
"""Load all flows so that they are visible in the registry."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
# pylint: disable=unused-import
# These imports populate the Flow registry
from grr_response_server.flows.general import ad... | dunkhong/grr | grr/server/grr_response_server/flows/general/registry_init.py | Python | apache-2.0 | 1,568 | 0 |
from random import shuffle
import pytest
from utils import testgen
from utils.version import current_version
from cfme.web_ui import paginator, summary_title
from cfme.containers.pod import Pod, paged_tbl as pod_paged_tbl
from cfme.containers.provider import ContainersProvider, paged_tbl as provider_paged_tbl,\
... | rananda/cfme_tests | cfme/tests/containers/test_relationships.py | Python | gpl-2.0 | 4,007 | 0.002496 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2018_01_01/models/frontend_ip_configuration_py3.py | Python | mit | 4,846 | 0.003921 |
#!/usr/bin/env python
import sys, os, logging, urllib, datetime
def fetchtemp():
cmd = '/opt/vc/bin/vcgencmd measure_temp'
line = os.popen(cmd).readline().strip()
output = line.split('=')[1].split("'")[0]#+' C'
return output
format = "%Y-%m-%d,%H:%M:%S"
today = datetime.datetime.today()
s = today.strftime(form... | mc3k/graph-stats | datagen.py | Python | mit | 433 | 0.027714 |
# peppy Copyright (c) 2006-2010 Rob McMullen
# Licenced under the GPLv2; see http://peppy.flipturn.org for more info
"""Spell checking provider
"""
import os, sys
import wx
from wx.lib.pubsub import Publisher
from peppy.yapsy.plugins import *
from peppy.lib.stcspellcheck import *
class SpellCheck(IPeppyPlugin):
... | robmcmullen/peppy | peppy/plugins/spelling.py | Python | gpl-2.0 | 958 | 0.004175 |
'''
Tests for fileinput module.
Nick Mathewson
'''
import unittest
from test.support import verbose, TESTFN, run_unittest
from test.support import unlink as safe_unlink
import sys, re
from io import StringIO
from fileinput import FileInput, hook_encoded
# The fileinput module has 2 interfaces: the FileInput class whi... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.1/Lib/test/test_fileinput.py | Python | mit | 8,498 | 0.004001 |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import shutil
import stat
import tempfile
from telemetry.internal.platform import tracing_agent
from telemetry.internal.platform.tracing_agent imp... | Chilledheart/chromium | tools/telemetry/telemetry/internal/platform/tracing_agent/chrome_tracing_agent.py | Python | bsd-3-clause | 3,194 | 0.007514 |
"""distutils.unixccompiler
Contains the UnixCCompiler class, a subclass of CCompiler that handles
the "typical" Unix-style command-line C compiler:
* macros defined with -Dname[=value]
* macros undefined with -Uname
* include search directories specified with -Idir
* libraries specified with -lllib
*... | Orav/kbengine | kbe/src/lib/python/Lib/distutils/unixccompiler.py | Python | lgpl-3.0 | 13,419 | 0.00149 |
#
# corpusbuilder.py
# Builds and extends a news corpus stored in SQLite
# Gareth Dwyer, 2016
# # # # # # # # # # # # # #
# standard imports
# third party imports
import newspaper
# local imports
import config
from article import Article
from common import log
from dbhelper import DBHelper
from publisher import Pu... | sixhobbits/CorpusBuilder | corpusbuilder.py | Python | apache-2.0 | 1,608 | 0.00995 |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate()
mobi... | agry/NGECore2 | scripts/mobiles/tatooine/razorback_felspur.py | Python | lgpl-3.0 | 1,656 | 0.02657 |
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.glrm import H2OGeneralizedLowRankEstimator
def glrm_benign():
print "Importing benign.csv data..."
benignH2O = h2o.upload_file(pyunit_utils.locate("smalldata/logreg/benign.csv"))
benignH2O.describe()
for i... | madmax983/h2o-3 | h2o-py/tests/testdir_algos/glrm/pyunit_benign_glrm.py | Python | apache-2.0 | 663 | 0.022624 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for core additions
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"""
__a... | raymondnijssen/QGIS | tests/src/python/test_core_additions.py | Python | gpl-2.0 | 1,581 | 0.000633 |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from six.moves import http_client
import json
i... | catapult-project/catapult | dashboard/dashboard/services/issue_tracker_service_test.py | Python | bsd-3-clause | 11,440 | 0.002535 |
from django.dispatch import Signal
user_enrolled = Signal(providing_args=['experiment', 'alternative', 'user', 'session'])
| uhuramedia/django-experiments | experiments/signals.py | Python | mit | 124 | 0.008065 |
# -*- coding: utf-8 -*-
import random
from openerp import SUPERUSER_ID
from openerp.osv import osv, orm, fields
from openerp.addons.web.http import request
class payment_transaction(orm.Model):
_inherit = 'payment.transaction'
_columns = {
# link with the sale order
'sale_order_id': fields.m... | eLBati/odoo | addons/website_sale/models/sale_order.py | Python | agpl-3.0 | 10,830 | 0.006833 |
# Copyright (c) 2014 Brad Neuman
# Common place to put useful re-usable queries into the blame database
def GetCurrentBlame(cursor):
"return a list of tuples of (filename, author, num_lines) that represents"
"the current count of lines from git blame, excluding merges"
cursor.execute('''
select * fro... | bradneuman/BlameOverTime | blameDBQuery.py | Python | mit | 8,282 | 0.006762 |
#!/usr/bin/env python
##################################################
## DEPENDENCIES
import sys
import os
import os.path
try:
import builtins as builtin
except ImportError:
import __builtin__ as builtin
from os.path import getmtime, exists
import time
import types
from Cheetah.Version import MinCompatib... | pli3/Openwebif | plugin/controllers/views/web/sleeptimer.py | Python | gpl-2.0 | 5,627 | 0.01244 |
# -*- 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
from sentry.utils.db import is_postgres
class Migration(SchemaMigration):
# Flag to indicate if this migration is too risky
# to run online and... | mvaled/sentry | src/sentry/south_migrations/0425_auto__add_index_pullrequest_organization_id_merge_commit_sha.py | Python | bsd-3-clause | 107,666 | 0.008053 |
{
'name' : 'Signature templates for user emails',
'version' : '1.0.0',
'author' : 'IT-Projects LLC, Ivan Yelizariev',
'license': 'LGPL-3',
'category' : 'Social Network',
'website' : 'https://yelizariev.github.io',
'depends' : ['base'],
'data':[
'res_users_signature_views.xml',
... | iledarn/addons-yelizariev | res_users_signature/__openerp__.py | Python | lgpl-3.0 | 445 | 0.01573 |
import hashlib
import logging
import requests
from builds.models import Version
from projects.utils import slugify_uniquely
from search.indexes import PageIndex, ProjectIndex, SectionIndex
from betterversion.better import version_windows, BetterVersion
log = logging.getLogger(__name__)
def sync_versions(project, ... | takluyver/readthedocs.org | readthedocs/restapi/utils.py | Python | mit | 4,957 | 0.001412 |
# XXX(usmanm): PySpark in sensitive to modifying Python objects in functions
# like `map`. Please be wary of that! Using deepcopy everywhere will always
# work, but obviously is going to slow things down.
import json
import os
import re
import sys
import tempfile
import types
import zipfile
from copy import deepcopy
... | Locu/chronology | metis/metis/core/execute/spark/executor.py | Python | mit | 8,583 | 0.009321 |
# Copyright 2014 Google Inc. All Rights Reserved.
"""Commands for reading and manipulating snapshots."""
from googlecloudsdk.calliope import base
class Snapshots(base.Group):
"""List, describe, and delete Google Compute Engine snapshots."""
Snapshots.detailed_help = {
'brief': 'List, describe, and delete Goo... | harshilasu/LinkurApp | y/google-cloud-sdk/lib/googlecloudsdk/compute/subcommands/snapshots/__init__.py | Python | gpl-3.0 | 353 | 0.002833 |
from openerp.addons.web import http
from openerp.addons.web.http import request
from openerp.tools.translate import _
import json
class Twitter(http.Controller):
@http.route(['/twitter_reload'], type='json', auth="user", website=True)
def twitter_reload(self):
return request.website.fetch_favorite_twe... | mycodeday/crm-platform | website_twitter/controllers/main.py | Python | gpl-3.0 | 1,936 | 0.006198 |
# global imports
import numpy as np
import scipy.special as scsp
import scipy.optimize as scop
# local imports
import helper as bhlp
"""
ref Helias14:
Helias, Tetzlaff, Diesmann (2014) The Correlation Structure of
Local Neuronal Networks Intrinsically Results from Recurrent Dynamics
PLoS Comput Biol 10(1): e1003428
D... | jakobj/binary_network | meanfield.py | Python | bsd-2-clause | 6,477 | 0.000772 |
# -*- coding: utf-8 -*-
"""
Unit tests for reverse URL lookups.
"""
from __future__ import unicode_literals
import sys
import unittest
import warnings
from django.contrib.auth.models import User
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist
from django.core... | benjaminrigaud/django | tests/urlpatterns_reverse/tests.py | Python | bsd-3-clause | 37,955 | 0.003478 |
from __future__ import absolute_import
import random
from six import text_type
from typing import Any, Dict, Optional, SupportsInt
from zerver.models import PushDeviceToken, UserProfile
from zerver.models import get_user_profile_by_id
from zerver.lib.timestamp import timestamp_to_datetime
from zerver.decorator import... | peguin40/zulip | zerver/lib/push_notifications.py | Python | apache-2.0 | 10,547 | 0.005404 |
from setuptools import setup
version = '1.2.dev0'
long_description = '\n\n'.join([
open('README.rst').read(),
open('CREDITS.rst').read(),
open('CHANGES.rst').read(),
])
install_requires = [
'setuptools',
'zest.releaser',
],
tests_require = [
'coverage',
'mock',
'nose',
]
... | nens/qgispluginreleaser | setup.py | Python | gpl-3.0 | 1,483 | 0.000674 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('quotation', '0005_auto_20150828_2207'),
]
operations = [
migrations.CreateModel(
name='Orderingcompany',
... | lowitty/eeep | quotation/migrations/0006_orderingcompany.py | Python | mit | 542 | 0.001845 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
###########################################################
# This file has been created by ARSF Data Analysis Node and
# is licensed under the GPL v3 Licence. A copy of this
# licence is available to download with this file.
#################################################... | pmlrsg/arsf_tools | las13/las13.py | Python | gpl-3.0 | 9,486 | 0.013388 |
# Copyright 2015 Deutsche Telekom AG
# 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... | pczerkas/tempest | tempest/api/compute/keypairs/base.py | Python | apache-2.0 | 1,347 | 0 |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... | mahabs/nitro | nssrc/com/citrix/netscaler/nitro/resource/config/aaa/aaagroup_vpntrafficpolicy_binding.py | Python | apache-2.0 | 7,121 | 0.037073 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from django import template
from tardis.tardis_portal.models import Dataset_File
from django.db.models import Sum
register = template.Library()
@register.filter
def experiment_file_count(value):
return Dataset_File.objects.filter(dataset__experiments__pk=value).count()
... | steveandroulakis/mytardis | tardis/tardis_portal/templatetags/experimentstats.py | Python | bsd-3-clause | 497 | 0 |
import pytest, copy
from .common import * # NOQA
RANCHER_VSPHERE_USERNAME = os.environ.get("RANCHER_VSPHERE_USERNAME", "")
RANCHER_VSPHERE_PASSWORD = os.environ.get("RANCHER_VSPHERE_PASSWORD", "")
RANCHER_VSPHERE_VCENTER = os.environ.get("RANCHER_VSPHERE_VCENTER", "")
RANCHER_VSPHERE_VCENTER_PORT = \
os.environ.g... | cjellick/rancher | tests/validation/tests/v3_api/test_vmwarevsphere_driver.py | Python | apache-2.0 | 7,582 | 0.000396 |
#
# 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... | ArvinDevel/incubator-pulsar | pulsar-functions/instance/src/test/python/test_python_instance.py | Python | apache-2.0 | 2,008 | 0.00498 |
from PyQt4 import QtGui, QtCore
class Window(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.mapper = QtCore.QSignalMapper(self)
self.toolbar = self.addToolBar('Foo')
self.toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextOnly)
for text in 'One... | Schizo/MediaBrowser | python/Temp/sandboxSignalMapper.py | Python | mit | 1,120 | 0.002679 |
import copy
import unittest
from numpy.testing import assert_equal
from test_simobj import VectCalc
from arrayaccess import DefaultArrayAccess
class TestCopy(unittest.TestCase):
simclass = VectCalc
copyfunc = staticmethod(copy.copy)
clone_v1 = [20] * 10
def check_copy(self, name, value):
o... | tkf/railgun | tests/test_simple_copy.py | Python | mit | 1,929 | 0 |
import os
import re
import hashlib
import datetime
from django.conf import settings
from django.core.management.base import BaseCommand
from webgis.mapcache import Disk
from webgis.app.models import Project_registry
from webgis.map.metadata_parser import MetadataParser
from webgis.map.project import get_last_project_... | gislab-npo/gislab-web | server/webgis/mapcache/management/commands/mapcache_clean.py | Python | gpl-2.0 | 3,659 | 0.004646 |
from django.db import models
from django.db.models import Count
from django.db.models.query import QuerySet
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from model_utils import Choices
from observations.models import Observation
from observations.utils import jd_now
CONSTE... | zsiciarz/variablestars.net | stars/models.py | Python | mit | 6,165 | 0.000162 |
"""
Django settings for composersCouch project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ... | TimothyBest/Django_Boilerplate | mysite/mysite/settings.py | Python | mit | 6,250 | 0.00192 |
"""
Test cases to cover Accounts change email related to APPSEMBLER_MULTI_TENANT_EMAILS.
"""
import json
from unittest.mock import patch, Mock
from rest_framework import status
from rest_framework.test import APITestCase
from django.urls import reverse
from student.models import PendingEmailChange
from .test_utils... | appsembler/edx-platform | openedx/core/djangoapps/appsembler/multi_tenant_emails/tests/test_account_change_email.py | Python | agpl-3.0 | 5,779 | 0.004326 |
import bpy
# from math import pi, sin, cos
# from bpy_extras.view3d_utils import location_3d_to_region_2d
# from bgl import glEnable, glDisable, glBegin, glEnd, glVertex2f, glVertex3f, glColor4f, glLineWidth, GL_LINE_STRIP, GL_LINE_STIPPLE, GL_BLEND, GL_LINE_LOOP, GL_POLYGON
# from fashion_project.modules.utils impor... | TriumphLLC/FashionProject | modules/operators/wires/basic.py | Python | gpl-3.0 | 916 | 0.010804 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# list... | morelab/weblabdeusto | server/src/weblab/exc.py | Python | bsd-2-clause | 550 | 0.010929 |
import unittest
import numpy
import pytest
from chainerx_tests import array_utils
import chainer.testing
import chainerx
import chainerx.testing
from chainerx_tests import dtype_utils
from chainerx_tests import op_utils
@op_utils.op_test(['native:0', 'cuda:0'])
@chainer.testing.parameterize_pytest('shape,indices',... | tkerola/chainer | tests/chainerx_tests/unit_tests/routines_tests/test_indexing.py | Python | mit | 8,519 | 0 |
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.conf import settings
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
from django.utils.http import urlsafe_base64_encode
def send_activation_email(request, user):
b64uid = urlsafe_base64_encode(str(us... | editorsnotes/editorsnotes | editorsnotes/auth/utils.py | Python | agpl-3.0 | 1,133 | 0.000883 |
#### 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_skreeg_hue.iff"
result.attribute_template_id = 9
result.stfNa... | anhstudios/swganh | data/scripts/templates/object/mobile/shared_skreeg_hue.py | Python | mit | 576 | 0.041667 |
import re
import json
import requests
from util import irc
from util.handler_utils import cmdhook, authenticate, get_target
from qtbot3_common.types.message import Message
def scrape(board: str, filtertext: str):
try:
data = requests.get("http://boards.4chan.org/{board}/catalog".format(board=board)).tex... | yukaritan/qtbot3 | qtbot3_service/plugins/4chan.py | Python | gpl-3.0 | 1,490 | 0.004027 |
# This file is part of Voice
#
# Voice 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.
#
# Voice is distributed in the hope that it wi... | Aeva/voice | voice/engines/__init__.py | Python | gpl-3.0 | 650 | 0 |
from .scholar import *
| toni-heittola/pelican-btex | scholar/__init__.py | Python | mit | 23 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the XLSX output module."""
import os
import unittest
import zipfile
from xml.etree import ElementTree
from plaso.containers import events
from plaso.formatters import interface as formatters_interface
from plaso.formatters import manager as formatters_manager
fr... | dc3-plaso/plaso | tests/output/xlsx.py | Python | apache-2.0 | 5,608 | 0.010342 |
# Configuration file for jupyter-notebook.
#------------------------------------------------------------------------------
# Configurable configuration
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Logg... | Enjoying-Learning/Enjoying | docs/config/jupyter_notebook_config.py | Python | mit | 22,055 | 0.002222 |
import logging, os
import psycopg2
# settings
database_name = 'postgres_database'
user = 'postgres_user'
password = 'some_password_here_lol'
port = 5432
host = 'postgres_host_normally_localhost'
path_to_gnaf_data = '/path/to/gnaf/data/'
# setup
logging.basicConfig(format='%(asctime)s %(levelname)s:%(message)s', leve... | ajosephau/psma-gnaf-loader | main.py | Python | gpl-3.0 | 6,393 | 0.003441 |
"""
Celery tasks for import module.
"""
from __future__ import unicode_literals
import json
import logging
from django.conf import settings
import requests
from statsd.defaults.django import statsd
from lore.celery import async
from learningresources.api import update_xanalytics
from xanalytics import send_request, ... | mitodl/lore | importer/tasks.py | Python | agpl-3.0 | 2,045 | 0.001956 |
import unittest
from type import Type
class TestType(unittest.TestCase):
def setUp(self):
self.__statement1 = [
'type name, attri1;',
' type name,attri1 ;',
'type name , attri1; ',
' type name ,attri1 ; ',
]
self.__statement2 = [
... | cepheidxa/python | selinux_check/test_type.py | Python | gpl-3.0 | 4,408 | 0.002949 |
# 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... | hfp/tensorflow-xsmm | tensorflow/contrib/lookup/lookup_ops_test.py | Python | apache-2.0 | 106,863 | 0.011922 |
"""A guestbook sample with sqlite3."""
import logging
import os
import jinja2
import sqlite3
import webapp2
from google.appengine.api import app_identity
from google.appengine.api import modules
from google.appengine.api import runtime
from google.appengine.api import users
from google.appengine.ext import ndb
JINJ... | googlearchive/appengine-sqlite-guestbook-python | main.py | Python | apache-2.0 | 5,760 | 0.000174 |
# RABDAM
# Copyright (C) 2020 Garman Group, University of Oxford
# This file is part of RABDAM.
# RABDAM 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 3 of
# the License, or (at your... | GarmanGroup/RABDAM | rabdam/Subroutines/CalculateBDamage.py | Python | lgpl-3.0 | 35,945 | 0.001641 |
# Copyright 2014 - Numergy
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | ed-/solum | solum/objects/sqlalchemy/infrastructure_stack.py | Python | apache-2.0 | 1,686 | 0 |
import io
import zipfile
from tornado import testing
from waterbutler.core import streams
from waterbutler.core.utils import AsyncIterator
from tests import utils
class TestZipHandler(utils.HandlerTestCase):
HOOK_PATH = 'waterbutler.server.api.v0.zip.ZipHandler._send_hook'
@testing.gen_test
def test_... | TomBaxter/waterbutler | tests/server/api/v0/test_zip.py | Python | apache-2.0 | 919 | 0.001088 |
# Copyright 2014 IBM Corp.
#
#
# 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... | raildo/nova | nova/tests/functional/api_sample_tests/test_floating_ips_bulk.py | Python | apache-2.0 | 3,805 | 0.000526 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.