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 |
|---|---|---|---|---|---|---|
# -*- 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 model 'Album'
db.create_table(u'chet_album', (
(u'id... | matthiask/django-chet | chet/south_migrations/0001_initial.py | Python | bsd-3-clause | 4,095 | 0.008547 |
# Copyright 2009, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | Xperia-Nicki/android_platform_sony_nicki | external/webkit/LayoutTests/http/tests/websocket/tests/hybi/close-on-unload_wsh.py | Python | apache-2.0 | 2,370 | 0 |
# Copyright (c) 2013 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 agreed to in writ... | zhangjunli177/sahara | sahara/main.py | Python | apache-2.0 | 6,825 | 0 |
class Solution:
# @param version1, a string
# @param version2, a string
# @return an integer
def compareVersion(self, version1, version2):
v1 = version1.split('.')
v2 = version2.split('.')
for i in range(0, min(len(v1), len(v2))):
if int(v1[i]) > int(v2[i]):
... | pikeszfish/Leetcode.py | leetcode.py/CompareVersionNumbers.py | Python | mit | 791 | 0.001264 |
# Copyright 2019 The Johns Hopkins University Applied Physics Laboratory
#
# 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 ... | jhuapl-boss/boss-manage | cloud_formation/configs/migrations/api/00010002_dns_update.py | Python | apache-2.0 | 1,140 | 0.003509 |
import os,shutil
from SCons.Script import DefaultEnvironment
from platformio import util
def copytree(src, dst, symlinks=False, ignore=None):
for item in os.listdir(src):
s = os.path.join(src, item)
d = os.path.join(dst, item)
if os.path.isdir(s):
shutil.copytree(s, d, symlinks,... | aetel/3D-printer | prusa_i3/Firmware/Marlin-2.0.x/buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py | Python | gpl-2.0 | 1,009 | 0.003964 |
from activitystreams import Activity, Object, MediaLink, ActionLink, Link
import re
import datetime
import time
class AtomActivity(Activity):
pass
# This is a weird enum-like thing.
class ObjectParseMode(object):
def __init__(self, reprstring):
self.reprstring = reprstring
def __repr__(self... | lmorchard/badger | libs/activitystreams/atom.py | Python | bsd-3-clause | 8,938 | 0.004363 |
# -*- coding: utf-8 -*-
from flask import request
class View(object):
def __init__(self, core):
self.core = core
def __call__(self, *args, **kwargs):
method = request.method.lower()
handler = getattr(self, method, None)
if callable(handler):
return handler(reque... | ojii/ircbotframework | ircbotframework/app.py | Python | bsd-3-clause | 719 | 0.005563 |
from builtins import range
import sys, os
sys.path.insert(1, os.path.join("..","..",".."))
import h2o
from tests import pyunit_utils
from h2o import H2OFrame
import numpy as np
import numpy.random
import scipy.stats
from sklearn import ensemble
from sklearn.metrics import roc_auc_score
from h2o.estimators.gbm import H2... | YzPaul3/h2o-3 | h2o-py/tests/testdir_algos/gbm/pyunit_bernoulli_synthetic_data_GBM_medium.py | Python | apache-2.0 | 3,234 | 0.009895 |
# stdlib
from collections import defaultdict
import itertools
import re
import socket
import time
import xmlrpclib
# 3p
import supervisor.xmlrpc
# project
from checks import AgentCheck
DEFAULT_HOST = 'localhost'
DEFAULT_PORT = '9001'
DEFAULT_SOCKET_IP = 'http://127.0.0.1'
DD_STATUS = {
'STOPPED': AgentCheck.CRI... | GabrielNicolasAvellaneda/dd-agent | checks.d/supervisord.py | Python | bsd-3-clause | 6,841 | 0.000877 |
from . import ast as A
from . import runtime
from . import scope as S
from . import static
from . import token as K
from . import types as T
from contextlib import contextmanager
from llvmlite import binding
from llvmlite import ir
from os.path import isdir, isfile
from os.path import join
import os.path
import re
nam... | philipdexter/rain | rain/module.py | Python | mit | 12,253 | 0.014037 |
"""
DatabaseMap is used to model a database.
"""
__version__= '$Revision: 3194 $'[11:-2]
__author__ = "Duan Guoqiang (mattgduan@gmail.com)"
import string
import proof.pk.IDMethod as IDMethod
import proof.pk.generator.IDBroker as IDBroker
import proof.mapper.TableMap as TableMap
class DatabaseMap:
def __init__... | mattduan/proof | mapper/DatabaseMap.py | Python | bsd-3-clause | 3,615 | 0.008852 |
# -*- coding: utf-8 -*-
#
# This file is part of the VecNet OpenMalaria Portal.
# For copyright and licensing information about this package, see the
# NOTICE.txt and LICENSE.txt files in its top-level directory; they are
# available at https://github.com/vecnet/om
#
# This Source Code Form is subject to the terms of t... | vecnet/om | website/tests/test_views.py | Python | mpl-2.0 | 874 | 0 |
from mpfmc.tests.MpfMcTestCase import MpfMcTestCase
class TestAnimation(MpfMcTestCase):
def get_machine_path(self):
return 'tests/machine_files/animation'
def get_config_file(self):
return 'test_animation.yaml'
def test_animation_config_processing(self):
# The animation sections ... | missionpinball/mpf-mc | mpfmc/tests/test_Animation.py | Python | mit | 18,424 | 0.000326 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed unde... | stackforge/python-senlinclient | senlinclient/tests/unit/v1/test_cluster_policy.py | Python | apache-2.0 | 4,136 | 0 |
""" Utilities for transforming from the 1.x to other versions.
:Authors: Sana dev team
:Version: 1.1
"""
import logging
from uuid import UUID
import re
import cjson as _json
import shutil, os
from django.contrib.auth.models import User, UserManager
from django.views.generic import RedirectView
#from django.views.gen... | SanaMobile/sana.mds | src/mds/api/v1/v2compatlib.py | Python | bsd-3-clause | 14,907 | 0.012075 |
from pygaze.display import Display
from pygaze.screen import Screen
from pygaze.eyetracker import EyeTracker
import pygaze.libtime as timer
disp = Display()
scr = Screen()
scr.draw_text("Preparing experiment...", fontsize=20)
disp.fill(scr)
disp.show()
tracker = EyeTracker(disp)
tracker.calibrate()
tracker.start_re... | esdalmaijer/PyOpenGaze | example/example_pygaze.py | Python | gpl-3.0 | 561 | 0.008913 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/ship/components/reactor/shared_rct_sfs_imperial_4.iff"
result.attri... | obi-two/Rebelion | data/scripts/templates/object/tangible/ship/components/reactor/shared_rct_sfs_imperial_4.py | Python | mit | 482 | 0.045643 |
# -*- coding:utf-8 -*-
'''
Author: Bu Kun
E-mail: bukun@osgeo.cn
CopyRight: http://www.yunsuan.org
'''
import tornado.web
import tornado.escape
import json
from torlite.core import tools
from torlite.core.base_handler import BaseHandler
from torlite.model.mwiki import MWiki
from torlite.model.mcatalog import MCatalog
... | Geoion/TorCMS | torlite/handlers/reply_handler.py | Python | mit | 3,236 | 0.003399 |
# Copyright (C) 2011 The MITRE Corporation. See the toplevel
# file LICENSE for license terms.
# I just have no place for this.
import socket
import MAT
def findPort(startingAt):
while True:
v = socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex(('127.0.0.1', startingAt))
if v == 0:
... | VHAINNOVATIONS/DmD | scrubber/MIST_2_0_4/src/MAT/lib/mat/python/MAT/Utilities.py | Python | apache-2.0 | 719 | 0.009736 |
import numpy as np
import sys
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
if len(sys.argv) != 2:
print "Correct usage: $ %s caustic_file" % sys.argv[1]
exit(1)
fig = plt.figure()
ax = fig.add_subplot(111, projection="3d")
rows = np.loadtxt(sys.argv[1])
rs = np.array(zip(*cols)[-1... | phil-mansfield/gotetra | render/scripts/plot_caustic_3d.py | Python | mit | 637 | 0.00157 |
import os
from . import SoccerFSA
from . import DataStates
class SoccerPlayer(SoccerFSA.SoccerFSA):
def __init__(self, brain):
SoccerFSA.SoccerFSA.__init__(self,brain)
self.addStates(DataStates)
self.setName('pData')
self.postDistance = 50
self.lastDistance = 0
# Sp... | northern-bites/nao-man | noggin/players/pData.py | Python | gpl-3.0 | 1,354 | 0.004431 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Simple unit test which makes various calls on the code
generated model.
Copyright 2007-2014 Glencoe Software, Inc. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
"""
import pytest
import omero
import omero.clients
from omero... | simleo/openmicroscopy | components/tools/OmeroPy/test/unit/test_model.py | Python | gpl-2.0 | 12,180 | 0.000493 |
from datetime import datetime
from api.utils import api_response
def auth_required(fn):
def wrapped(self, request, *args, **kwargs):
if not request.user.is_authenticated():
return api_response({"error": "not authenticated"}, status=401)
request.user.last_action=datetime.now().replace(t... | 13pi/HipstaChat | api/decorators.py | Python | gpl-2.0 | 684 | 0.002924 |
#!/usr/bin/env python
# Copyright (c) 2009, 2010 Google Inc. All rights reserved.
# Copyright (c) 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of sour... | cs-au-dk/Artemis | WebKit/Tools/Scripts/webkitpy/tool/commands/upload.py | Python | gpl-3.0 | 22,709 | 0.003479 |
import os
import base64
from requests import Session, Request
from OpenSSL import crypto
url = 'http://ct.googleapis.com/aviator/ct/v1/get-roots'
s = Session()
r = Request('GET',
url)
prepped = r.prepare()
r = s.send(prepped)
if r.status_code == 200:
roots = r.json()
# RFC 6962 defines the cert... | wgoulet/CTPyClient | fetchroots.py | Python | apache-2.0 | 1,184 | 0.017736 |
#!/usr/bin/env python
# Copyright 2002 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... | googlearchive/titan | titan/common/lib/google/apputils/datelib.py | Python | apache-2.0 | 15,413 | 0.007591 |
#!/usr/bin/env python
import logging
import optparse
from zillion.utils import cmdline
logger = logging.getLogger(__name__)
def main():
parser = optparse.OptionParser()
options, args = parser.parse_args()
logger.debug("foo")
logger.debug("foo", 1)
logger.debug("foo: %s", 1)
logger.debug("f... | lgastako/loglint | example.py | Python | mit | 413 | 0 |
class Coordinates:
""" WhiteSource model for artifact's coordinates. """
def __init__(self, group_id, artifact_id, version_id):
self.groupId = group_id
self.artifactId = artifact_id
self.versionId = version_id
def create_project_coordinates(distribution):
""" Creates a 'Coordinat... | whitesource/python-plugin | agent/api/model/Coordinates.py | Python | apache-2.0 | 559 | 0.003578 |
# -*- 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... | sasha-gitg/python-aiplatform | google/cloud/aiplatform_v1/services/migration_service/async_client.py | Python | apache-2.0 | 17,064 | 0.001641 |
from flask import render_template
from . import main
@main.app_errorhandler(404)
def page_not_found(e):
return render_template('404.html'), 404
@main.app_errorhandler(500)
def internal_server_error(e):
return render_template('500.html'), 500
| hubinary/flasky | app/main/errors.py | Python | mit | 255 | 0.003922 |
"""
.. py:module:: fnl.stat.textclass
:synopsis: Tools for developing a text classifier.
.. moduleauthor:: Florian Leitner <florian.leitner@gmail.com>
.. License: GNU Affero GPL v3 (http://www.gnu.org/licenses/agpl.html)
"""
from collections import defaultdict, namedtuple, Counter
from itertools import chain
from ... | fnl/libfnl | src/fnl/stat/textclass.py | Python | agpl-3.0 | 15,148 | 0.001783 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#This file is part of CanFestival, a library implementing CanOpen Stack.
#
#Copyright (C): Edouard TISSERANT, Francis DUPIN and Laurent BESSARD
#
#See COPYING file for copyrights details.
#
#This library is free software; you can redistribute it and/or
#modify it under th... | chrta/canfestival-3-ct | objdictgen/commondialogs.py | Python | lgpl-2.1 | 69,421 | 0.008398 |
import numpy as np
from random import shuffle
def softmax_loss_naive(W, X, y, reg):
"""
Softmax loss function, naive implementation (with loops)
Inputs have dimension D, there are C classes, and we operate on minibatches
of N examples.
Inputs:
- W: A numpy array of shape (D, C) containing weights.
- X:... | shengshuyang/StanfordCNNClass | assignment1/cs231n/classifiers/softmax.py | Python | gpl-3.0 | 3,970 | 0.019395 |
"""Offer sun based automation rules."""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.core import callback
from homeassistant.const import (
CONF_EVENT, CONF_OFFSET, CONF_PLATFORM, SUN_EVENT_SUNRISE)
from homeassistant.helpers.event import async_track_sunrise, async_tra... | MartinHjelmare/home-assistant | homeassistant/components/automation/sun.py | Python | apache-2.0 | 1,227 | 0 |
from nltk import NaiveBayesClassifier, SklearnClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.linear_model import PassiveAggressiveClassifier
from sklearn.linear_model import Perceptron
from sklearn.linear_model import RidgeClassifier
from ... | dhermyt/WONS | analysis/textclassification/SklearnClassifierFactory.py | Python | bsd-2-clause | 2,285 | 0.001751 |
# -*- coding: utf-8 -*-
"""
.. module: field
:platform: Unix, Windows
:synopsis: Separates field_type-dependent functionality into Field classes.
.. moduleauthor:: Christian Boelsen <christian.boelsen@hds.com>
"""
__all__ = ('create_field', )
from datetime import datetime
from .exceptions import (
In... | cboelsen/tastytopping | tastytopping/field.py | Python | lgpl-3.0 | 6,454 | 0.001085 |
import csv
import json
csvfile = open('su15.csv', 'r')
jsonfile = open('output.json', 'w')
output = {'name' : 'Summer 2015', 'children': []}
gender = {'children' : []}
i = 0
a = {'test' : []}
for row in csv.DictReader(csvfile):
a['test'].append({'name' : 'Male', 'size' : row['Male']
})
a['test'].append({'name' : '... | SudarshanGp/R_Test | test.py | Python | mit | 1,088 | 0.05239 |
#!/usr/bin/python -tt
# -*- coding: utf-8 -*-
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
"""Wordcount exercise
Google's Python class
La función main() d... | cursoweb/python-archivos | Merlo-Joaquin/wordcount.py | Python | mit | 2,864 | 0.007749 |
__author__ = 'ferrard'
| silverfield/pythonsessions | s13_python_day/__init__.py | Python | mit | 23 | 0 |
'''
author@esilgard April 2016
"sweep" through output directory files
searching for potential PHI and print out warning statements
'''
import os, re
# general directory for output files
file_dir = 'H:\DataExtracts\OncoscapeLungHoughton-4229\Output'
## common names or potential phi (assume first line is a ... | esilgard/caisis_query_and_de_identify | sweeper.py | Python | apache-2.0 | 2,097 | 0.012399 |
import argparse
import time
import subprocess
import logging
from deep_architect import search_logging as sl
from deep_architect import utils as ut
from deep_architect.contrib.communicators.mongo_communicator import MongoCommunicator
from search_space_factory import name_to_search_space_factory_fn
from searcher impor... | negrinho/deep_architect | examples/contrib/kubernetes/master.py | Python | mit | 9,581 | 0.000417 |
# Copyright (C) 2015 Peter Todd <pete@petertodd.org>
#
# This file is part of python-proofmarshal.
#
# It is subject to the license terms in the LICENSE file found in the top-level
# directory of this distribution.
#
# No part of python-proofmarshal, including this file, may be copied, modified,
# propagated, or distri... | proofchains/python-proofmarshal | proofmarshal/serialize.py | Python | gpl-3.0 | 14,738 | 0.003393 |
"""
URLconf for registration and activation, using django-registration's
default mods backend.
If the default behavior of these views is acceptable to you, simply
use a line like this in your root URLconf to set up the default URLs
for registration::
(r'^accounts/', include('project.registration.urls')),
This wi... | emencia/emencia_paste_djangocms_3 | emencia_paste_djangocms_3/django_buildout/project/accounts/urls.py | Python | mit | 2,293 | 0.004361 |
# Copyright 2018 New Vector Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | matrix-org/synapse | synapse/replication/http/__init__.py | Python | apache-2.0 | 1,864 | 0 |
#!/usr/bin/env python
import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../')
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../../')
from code_files import CppFiles, ExtensionFiles, ValidationFiles
from parseXML import ParseXML
from tests import test_functions
###... | hovo1990/deviser | generator/tests/test_cpp_code/run_cpp_tests.py | Python | lgpl-2.1 | 17,841 | 0.000224 |
#!/usr/bin/env python3
import sys
import argparse
from ucca.convert import from_text, to_json
from uccaapp.api import ServerAccessor
desc = """Upload a passage from a streussel format file"""
class StreusselPassageUploader(ServerAccessor):
def __init__(self, user_id, source_id, project_id, **kwargs):
s... | danielhers/ucca | uccaapp/upload_streussel_passages.py | Python | gpl-3.0 | 3,363 | 0.003271 |
"""
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2015 Dirk Beyer
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
... | michkot/benchexec | benchexec/tools/predatorhp.py | Python | apache-2.0 | 3,054 | 0.002292 |
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
from numpy import cos, sqrt, sin, abs
from .go_benchmark import Benchmark
class NeedleEye(Benchmark):
r"""
NeedleEye objective function.
This class defines the Needle-Eye [1]_ global optimization problem. This is a... | DailyActie/Surrogate-Model | 01-codes/scipy-master/benchmarks/benchmarks/go_benchmark_functions/go_funcs_N.py | Python | mit | 4,191 | 0.000716 |
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
def separate_windows(arr):
ret = dict()
for k, v in zip(*arr):
if k in ret:
ret[k].append(v)
else:
ret[k] = [v]
return ret
def load_file(filename, *args, **kwargs):
data = np.genfromtxt(... | dwysocki/trivial | doc/stats/plot.py | Python | gpl-3.0 | 2,722 | 0.005878 |
try:
import xml.etree.cElementTree as ET
except ImportError:
import cElementTree as ET
import Utils.ElementTreeUtils as ETUtils
import sys
import CorpusElements
from optparse import OptionParser
def copyParse(input, source, output, parse, tokenization):
print >> sys.stderr, "Loading input file", input
... | ashishbaghudana/mthesis-ashish | resources/tees/Utils/InteractionXML/CopyParse.py | Python | mit | 4,989 | 0.008419 |
# (c) Copyright 2015 Hewlett Packard Enterprise Development LP
#
# 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... | HewlettPackard/ratekeeper-neutron-ml2-plugin | patches/nova/ratekeeper_monkey_patch.py | Python | apache-2.0 | 2,041 | 0.00196 |
from django.contrib import admin
from metadata.models import *
# Register your models here.
admin.site.register(TanitJobsCategory)
admin.site.register(KeeJobsCategory)
| firasbenmakhlouf/JobLookup | metadata/admin.py | Python | mit | 169 | 0 |
import pulsar as psr
def load_ref_system():
""" Returns l-arginine as found in the IQMol fragment library.
All credit to https://github.com/nutjunkie/IQmol
"""
return psr.make_system("""
N 0.8592 -2.9103 -0.8578
C 1.3352 -1.5376 -1.1529
C 2.8596... | pulsar-chem/Pulsar-Core | lib/systems/l-arginine.py | Python | bsd-3-clause | 1,416 | 0.000706 |
"""
Answers with an Error message to a previous Error message.
"""
import copy
import random
from src import Msg
from src import SomeIPPacket
from src.attacks import AttackerHelper
def sendErrorOnError(a, msgOrig):
""" Attack Specific Function. """
sender = msgOrig.receiver
receiver = msgOrig.sender
... | Egomania/SOME-IP_Generator | src/attacks/sendErrorOnError.py | Python | agpl-3.0 | 1,693 | 0.005316 |
# -*- coding: utf-8 -*-
import pandas as pd
from datetime import datetime
import numpy as np
from DataDictObject import DataDictObject
from TablonReader import TablonReader
from TablonEncoder import TablonEncoder
from TablonLoader import TablonLoaderDB
class DataManagementObject:
"""This is the cla... | tgquintela/pyDataProcesser | pyDataProcesser/DataManagement.py | Python | mit | 16,526 | 0.001029 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, inc
#
# This file is part of Ansible by Red Hat
#
# Ansible 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 Li... | hyperized/ansible | lib/ansible/modules/network/eos/eos_vrf.py | Python | gpl-3.0 | 10,723 | 0.001585 |
import molotov
@molotov.scenario(100)
async def Molotov_test(session):
async with session.get('https://blazedemo.com/') as resp:
assert resp.status == 200
| Blazemeter/taurus | examples/molotov/blazedemo.py | Python | apache-2.0 | 169 | 0 |
# encoding: utf-8
from __future__ import print_function
import collections
import sys
import warnings
# import bcolz
import numpy as np
import tables
import config
from data import (merge_arrays, get_fields, ColumnArray, index_table,
build_period_array)
from expr import (Variable, Var... | benjello/liam2 | liam2/entities.py | Python | gpl-3.0 | 33,581 | 0.000566 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "curso.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| cursoweb/ejemplo-django | manage.py | Python | mit | 248 | 0 |
## Copyright (C) 2007 Sadique Puthen <sputhenp@redhat.com>
### This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
## Thi... | portante/sosreport | sos/plugins/ipsec.py | Python | gpl-2.0 | 1,514 | 0.009908 |
'''
Kaya Baber
Physics 440 - Computational Physics
Assignment 3
Problem 2
'''
from scipy.integrate import odeint
import numpy as np
import matplotlib.pyplot as plt
import math
def f(thetas, t, b, gamma, omega):
#pendulum driven-damped function
theta=thetas[0]
thetaDot=thetas[1]
thetaDouble=-b*thetaDot ... | KayaBaber/Computational-Physics | Assignment_3_chaos_and_pendulums/Phys440_Assignment03_Prob2.py | Python | mit | 2,476 | 0.023021 |
import gamePlay
from copy import deepcopy
def value(board):
value = 0
for row in board:
for elem in row:
if elem == "W":
value = value + 1
elif elem == "B":
value = value - 1
return value
def betterThan(val1, val2, color, reversed):
if color == "W":
retVal = val1 > val2
els... | OldPanda/B551 | hw4/simpleGreedy.py | Python | gpl-2.0 | 907 | 0.083793 |
import asyncio
import inspect
import warnings
from asgiref.sync import sync_to_async
class RemovedInDjango41Warning(DeprecationWarning):
pass
class RemovedInDjango50Warning(PendingDeprecationWarning):
pass
RemovedInNextVersionWarning = RemovedInDjango41Warning
class warn_about_renamed_method:
def _... | elena/django | django/utils/deprecation.py | Python | bsd-3-clause | 4,818 | 0.000623 |
#!/bin/python
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core import debug
from fenrirscreenreader.utils import line_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self... | chrys87/fenrir | src/fenrirscreenreader/commands/commands/review_curr_line.py | Python | lgpl-3.0 | 1,171 | 0.01281 |
import sys, os, time, json, datetime, errno, stat, getpass, requests, pprint
if sys.version_info[0] < 3: import urlparse
else: import urllib.parse as urlparse
import h2o
debug_rest = False
verbosity = 0 # 0, 1, 2, 3
pp = pprint.PrettyPrinter(indent=4) # pretty printer for debugging
def setVerbosity(level):
glob... | mathemage/h2o-3 | py/h2o_test_utils.py | Python | apache-2.0 | 31,016 | 0.005771 |
# -*- coding: utf-8 -*-
{
'name' : 'Live Chat',
'version': '1.0',
'sequence': 170,
'summary': 'Live Chat with Visitors/Customers',
'category': 'Website',
'complexity': 'easy',
'website': 'https://www.odoo.com/page/live-chat',
'description':
"""
Live Chat Support
=================... | maxive/erp | addons/im_livechat/__manifest__.py | Python | agpl-3.0 | 1,269 | 0.000788 |
import json
import numpy as np
import pytest
import requests
from mipframework.testutils import get_test_params
from tests import vm_url
from tests.algorithm_tests.test_logistic_regression import expected_file
headers = {"Content-type": "application/json", "Accept": "text/plain"}
url = vm_url + "LOGISTIC_REGRESSION"
... | madgik/exareme | Exareme-Docker/src/mip-algorithms/tests/integration_tests/test_exareme_integration_logistic_regression.py | Python | mit | 894 | 0.001119 |
# 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 app... | Canpio/Paddle | python/paddle/fluid/tests/unittests/test_array_read_write_op.py | Python | apache-2.0 | 3,404 | 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/ns/nspbr_args.py | Python | apache-2.0 | 1,045 | 0.025837 |
from django.shortcuts import render
from .models import Blurb, Schedule
def index(request):
blurbs = Blurb.objects.filter(display=True)
schedule = Schedule.objects.filter(display=True)
return render(request, "frontpage.html", {"blurbs": blurbs, "schedule": schedule})
| lopopolo/hyperbola | hyperbola/frontpage/views.py | Python | mit | 284 | 0.003521 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#+---------------------------------------------------------------------------+
#| 01001110 01100101 01110100 01111010 01101111 01100010 |
#| |
#| Netzob : Inferring comm... | lootr/netzob | netzob/test/src/test_netzob/test_Common/suite_Type.py | Python | gpl-3.0 | 2,410 | 0.012469 |
# Copyright 2015 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... | shakamunyi/tensorflow | tensorflow/python/framework/ops.py | Python | apache-2.0 | 181,558 | 0.006059 |
"""
Shim to maintain backwards compatibility with old IPython.qt imports.
"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import sys
from warnings import warn
from IPython.utils.shimmodule import ShimModule, ShimWarning
warn("The `IPython.qt` package has been ... | kelseyoo14/Wander | venv_2_7/lib/python2.7/site-packages/IPython/qt.py | Python | artistic-2.0 | 744 | 0 |
import os as os
import zipfile as Z
from os.path import isfile, join
from getpass import getuser
from matplotlib import pyplot as plt
zipfiles = []
kptList = []
name = []
inputzips = []
netID = getuser()
zippath = "/fslhome/" + netID + "/vasp/alloydatabase/alloyzips/"
newpath = "/fslhome/" + netID + "/vasp/alloyd... | hallover/alloy-database | code/timeErrorPlot.py | Python | mit | 3,797 | 0.008428 |
# -*- coding: utf 8 -*-
"""
Define a suite a tests for the canstrat functions.
"""
from welly import Well
import welly.quality as q
tests = {
'Each': [
q.no_flat,
q.no_monotonic,
q.no_gaps,
],
'Gamma': [
q.all_positive,
q.all_below(450),
q.check_units(['API',... | agile-geoscience/welly | tests/test_quality.py | Python | apache-2.0 | 2,002 | 0 |
# -*- coding: utf-8 -*-
import pytest
from bottle import Bottle, debug, request, response
from webtest import TestApp
from webargs import ValidationError, fields
from webargs.bottleparser import BottleParser
hello_args = {
'name': fields.Str(missing='World', validate=lambda n: len(n) >= 3),
}
hello_multiple = {
... | hyunchel/webargs | tests/test_bottleparser.py | Python | mit | 4,813 | 0.004363 |
#!/usr/bin/env python
#
# 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 "Lic... | innovimax/vxquery | vxquery-benchmark/src/main/resources/util/diff_xml_files.py | Python | apache-2.0 | 3,401 | 0.006469 |
from unittest.mock import MagicMock, patch
from zerver.lib.test_classes import WebhookTestCase
class FreshdeskHookTests(WebhookTestCase):
STREAM_NAME = "freshdesk"
URL_TEMPLATE = "/api/v1/external/freshdesk?stream={stream}"
WEBHOOK_DIR_NAME = "freshdesk"
def test_ticket_creation(self) -> None:
... | andersk/zulip | zerver/webhooks/freshdesk/tests.py | Python | apache-2.0 | 4,844 | 0.001034 |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.test.runner import DiscoverRunner
from pipeline.conf import settings as pipeline_settings
class TestSuiteRunner(DiscoverRunner):
def __init__(self, *args, **kwargs):
settings.TESTING_ENVIRONMENT = True
super(TestSuiteRunner, sel... | tomka/CATMAID | django/lib/custom_testrunner.py | Python | gpl-3.0 | 635 | 0.00315 |
from mido import MidiFile
from time import sleep
import pibrella
""" fade test
pibrella.light.red.fade(0,100,10)
sleep(11)
pibrella.light.red.fade(100,0,10)
sleep(11)
"""
""" start
pibrella.buzzer.note(-9)
sleep(.9)
pibrella.buzzer.off()
sleep(0.1)
pibrella.buzzer.note(-9)
sleep(0.9)
pibrella.buzzer.off()
sleep(0.1)
... | brata-hsdc/brata.station | bin/pibrellaMidi.py | Python | apache-2.0 | 1,422 | 0.006329 |
#!/usr/bin/env python
from itertools import count
import doctest
def delete_range(lines, r=None):
"""
>>> a = list(range(10))
>>> delete_range(a, (1, 3))
[0, 4, 5, 6, 7, 8, 9]
"""
r = r or (0, len(lines))
return replace_range(lines, [], (r[0], r[1] + 1))
def insert_range(lines, new_lines... | hughdbrown/sed | sed/engine/sed_util.py | Python | mit | 3,112 | 0.000321 |
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 25 13:50:30 2017
@author: Owner
"""
from __future__ import print_function
import os
import numpy as np
np.random.seed(1337)
import matplotlib.pyplot as plt
import pandas as pd
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence ... | chngchinboon/intercomstats | scripts/tagclassifer_keras.py | Python | mit | 9,514 | 0.018604 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
import unittest
from ...utility import xl_cell_to_rowcol_abs
class TestUtility(unittest.TestCase):
""... | jmcnamara/XlsxWriter | xlsxwriter/test/utility/test_xl_cell_to_rowcol_abs.py | Python | bsd-2-clause | 1,642 | 0 |
import os
import yaml
from network import Network
from storage import Storage
from cloudtools import conn, make_network_name
from config import TEMPLATE_PATH
with open(os.path.join(TEMPLATE_PATH, "network.yaml")) as f:
netconf = yaml.load(f)
with open(os.path.join(TEMPLATE_PATH, "vm.yaml")) as f:
vmconf = yam... | sshnaidm/openstack-sqe | tools/cloud/domain.py | Python | apache-2.0 | 3,609 | 0.003325 |
#!/usr/bin/env python
'''
Handles access to the WebDAV's server creditentials.
'''
from collections import namedtuple
import secretstorage
APPLICATION_NAME = "davify"
FileStorage = namedtuple('FileStorage',
'username password protocol server port path')
def get_secret_storage():
bus =... | AlbertWeichselbraun/davify | src/davify/keyring.py | Python | gpl-3.0 | 1,784 | 0 |
#!/usr/bin/env python
class DrawingObjectResponse(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually."""
def __init__(self):
"""
Attributes:
swaggerTypes (dict): The key is attribute name and the value is attribut... | sohail-aspose/Aspose_Words_Cloud | SDKs/Aspose.Words_Cloud_SDK_for_Python/asposewordscloud/models/DrawingObjectResponse.py | Python | mit | 822 | 0.013382 |
from datetime import datetime
class Logger(object):
FATAL = 0
ERROR = 1
WARN = 2
INFO = 3
DEBUG = 4
TRACE = 5
def __init__(self, f, log_level=3):
level = int(log_level)
if level < 0 or level > Logger.TRACE:
raise Exception("Invalid Log Level %d" % level)
... | zmap/ztag | ztag/log.py | Python | apache-2.0 | 1,994 | 0 |
""" This file handles default application config settings for Flask-User.
:copyright: (c) 2013 by Ling Thio
:author: Ling Thio (ling.thio@gmail.com)
:license: Simplified BSD License, see LICENSE.txt for more details."""
def set_default_settings(user_manager, app_config):
""" Set default app.config set... | neurosnap/Flask-User | flask_user/settings.py | Python | bsd-2-clause | 10,164 | 0.01525 |
import CONST
from CONST import *
clock = pygame.time.Clock()
class Menu():
def __init__(self):
self.bg_image = pygame.image.load(os.path.join("data","title1.png")).convert_alpha()
self.subLogo = textFont("Initial Fantasy: Glitch", BLACK, 36, "Coalition.ttf")
self.selection = 0;
sel... | iPatso/PyGameProjs | PyGames/CS254_platform/CS254_platform/src/menu.py | Python | apache-2.0 | 2,114 | 0.005203 |
# 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 ... | v-iam/azure-sdk-for-python | azure-mgmt-web/azure/mgmt/web/models/app_service_certificate_resource.py | Python | mit | 2,874 | 0.001392 |
# implementation of card game - Memory
import simplegui
import random
#globals
frame_size = [800,100]
l1 = range(1,9) + range(1,9)
random.shuffle(l1)
#exposed = [False for l in range(len(l1))]
exposed = [True, False, True, False, True, False, True, False, True, False, True, False, True, False, True, False]
# helper... | joshsomma/rice_python_1 | memory.py | Python | apache-2.0 | 1,375 | 0.015273 |
def test_delite_group(app):
app.session.login( username="admin", password="secret")
app.group.delete_first_group()
app.session.logout()
if __name__ == '__main__':
pytest.main('test_del_group.py') | Alex-Chizhov/python_training | home_work_6/test/test_del_group.py | Python | apache-2.0 | 201 | 0.034826 |
def bs(data, target, low, high):
if low > high:
return False
else:
mid = (low + high)//2
if target == data[mid]:
return True
elif target < data[mid]:
return bs(data, target, low, mid - 1)
else:
return bs(data, target, mid + 1, high)
if... | xiao0720/leetcode | binary_search.py | Python | mit | 415 | 0.019277 |
from .base import *
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'ip5ezdgcr92+p@(o4g$kc5lzw&$-rjqf7d9-h)16(!z&(lzils'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG_TOOLBAR_PATCH_SETTINGS = False
INTERNAL_IPS = ('127.0.0.1', '::1',)
ALLOWED_H... | zapcoop/vertex | vertex_api/vertex/settings/dev.py | Python | agpl-3.0 | 714 | 0.001401 |
import re
import random
from util import hook
# @hook.regex(r'^uguubot(.*)')
@hook.command('decide')
@hook.command
def choose(inp):
"choose <choice1>, [choice2], [choice3], [choice4], ... -- " \
"Randomly picks one of the given choices."
try: inp = inp.group(1)
except: inp = inp
replacewords = {... | bytebit-ch/uguubot | plugins/choose.py | Python | gpl-3.0 | 632 | 0.017405 |
#
# Author:
# - Dmitry Golubkov, <dmitry.v.golubkov@cern.ch>, 2016-2018
#
# Updates by:
# - Mikhail Titov, <mikhail.titov@cern.ch>, 2018
#
import json
try:
import requests
import urllib
except ImportError:
pass
API_VERSION = 'v1'
class DEFTClient(object):
API_BASE_PATH = '/api/{0}'.format(API_VERS... | XDatum/prodsys-pa-model | p2pamodel/providers/deftclient.py | Python | apache-2.0 | 4,707 | 0 |
#kgb import controllers
| BorgERP/borg-erp-6of3 | verticals/medical61/web_doc_oemedical/__init__.py | Python | agpl-3.0 | 25 | 0.08 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import numpy.linalg
def norm_along_column(a, ord=2):
norm = lambda x: np.linalg.norm(x, ord=ord)
return np.apply_along_axis(norm, 0, a)
def eig_residul(a, b, x, v, rel=True):
av = a @ v
bv = b @ v
rs = norm_along_column(av - x * b... | ibara1454/pyss | pyss/util/analysis.py | Python | mit | 443 | 0.002257 |
"""Crawl settings."""
import os, sys
"""
Inserts path to project root into sys.path of of crawl_supervisor.
Splits the directory path to this settings file, and cuts off the path up
to the root of the project directory, allowing crawl_supervisor to import
modules from other apps.
"""
sys.path.insert(1, '/'.join(os.p... | 0x0mar/memex-explorer | source/apps/crawl_space/settings.py | Python | bsd-2-clause | 1,268 | 0.003155 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.