code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/python2.5
# Copyright 2010 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | jgeewax/googlepersonfinder | app/developers.py | Python | apache-2.0 | 875 |
from bson import ObjectId
import simplejson as json
from eve.tests import TestBase
from eve.tests.test_settings import MONGO_DBNAME
from eve.tests.utils import DummyEvent
from eve import STATUS_OK, LAST_UPDATED, ID_FIELD, ISSUES, STATUS, ETAG
from eve.methods.patch import patch_internal
# @unittest.skip("don't need... | opticode/eve | eve/tests/methods/patch.py | Python | bsd-3-clause | 19,911 |
from __future__ import absolute_import
import urwid
from . import common
def _mkhelp():
text = []
keys = [
("A", "accept all intercepted flows"),
("a", "accept this intercepted flow"),
("C", "clear flow list or eventlog"),
("d", "delete flow"),
("D", "duplicate flow"),
... | xtso520ok/mitmproxy | libmproxy/console/flowlist.py | Python | mit | 8,997 |
# 49
m = 0
b = 1
f = 1
while f is not None:
a = f
f = None
while True:
x = str(a ** b)
if len(x) > b:
break
if len(x) == b:
if f is None:
f = a
m += 1
a += 1
b += 1
print m
| higgsd/euler | py/63.py | Python | bsd-2-clause | 273 |
import argparse
import os
from db import db
from management import submissions
from models import Submission
from tests import utils
def test_delete_disconnected_db_submissions(journalist_app, app_storage, config):
"""
Test that Submission records without corresponding files are deleted.
"""
with jo... | freedomofpress/securedrop | securedrop/tests/test_submission_cleanup.py | Python | agpl-3.0 | 2,674 |
# -*- coding: utf-8 -*-
# Copyright (c) 2002 - 2015 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Package implementing an interface to the pyunit unittest package.
The package consist of a single dialog, which may be called as a
standalone version using the eric6_unittest script or from within the eric6
IDE. If ... | testmana2/test | PyUnit/__init__.py | Python | gpl-3.0 | 429 |
__author__ = 'panzer'
def do_twice(f, arg):
f(arg)
f(arg)
def print_twice(s):
print s
print s
def do_four(f, arg):
do_twice(f, arg)
do_twice(f, arg)
do_twice(print_twice, 'spam')
do_four(print_twice, 'spam')
| BigFatNoob-NCSU/x9115george2 | hw/code/2/3_4.py | Python | mit | 240 |
"""Generate hammer command tree in json format by inspecting every command's
help.
"""
import json
from robottelo import ssh
from robottelo.cli import hammer
def generate_command_tree(command):
"""Recursively walk trhough the hammer commands and subcommands and fetch
their help. Return a dictionary with the... | tkolhar/robottelo | scripts/hammer_command_tree.py | Python | gpl-3.0 | 894 |
from a10sdk.common.A10BaseClass import A10BaseClass
class RulesList(A10BaseClass):
"""This class does not support CRUD Operations please use parent.
:param std_list_action: {"enum": ["deny", "permit"], "type": "string", "description": "'deny': Specify community to reject; 'permit': Specify community to ... | amwelch/a10sdk-python | a10sdk/core/ip/ip_community_list_standard_num.py | Python | apache-2.0 | 2,739 |
import serial
import time
import logger
strd_0 = " SIN SERVICIO "
strd_1 = " "
def main():
try:
for intento in range(0,2):
serial_MDB = serial.Serial('/dev/ttyUSBMDB', 9600, timeout = 0.1)
serial_MDB.write('\x0C\x00\x00\x00\x00') #Inhabilitar Monedero MDB
rx... | the-adrian/KernotekV2.0 | InhibirMDB.py | Python | gpl-3.0 | 1,039 |
"""
Anscombe's quartet
==================
_thumb: .4, .4
"""
import seaborn as sns
sns.set_theme(style="ticks")
# Load the example dataset for Anscombe's quartet
df = sns.load_dataset("anscombe")
# Show the results of a linear regression within each dataset
sns.lmplot(x="x", y="y", col="dataset", hue="dataset", data... | mwaskom/seaborn | examples/anscombes_quartet.py | Python | bsd-3-clause | 430 |
class Name: # Use (object) in 2.X
"name descriptor docs"
def __get__(self, instance, owner):
print('fetch...')
return instance._name
def __set__(self, instance, value):
print('change...')
instance._name = value
def __delete__(self, inst... | simontakite/sysadmin | pythonscripts/learningPython/desc-person.py | Python | gpl-2.0 | 1,014 |
from __future__ import absolute_import
import errno
import os
import time
from rpython.rlib.objectmodel import compute_identity_hash
from rpython.rlib.rfloat import round_double
from rpython.rlib.streamio import open_file_as_stream
from topaz.coerce import Coerce
from topaz.error import RubyError, error_for_oserror,... | topazproject/topaz | topaz/modules/kernel.py | Python | bsd-3-clause | 21,357 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-27 02:00
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='MenuIt... | azuer88/kerbus-alpha | src/kerbus/asimplemenu/migrations/0001_initial.py | Python | gpl-2.0 | 636 |
"""Plot to test HTML tooltip plugin
As a data explorer, I want to add rich information to each point in a
scatter plot, as details-on-demand"""
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np, pandas as pd
from mpld3_rewrite import plugins
css = """
table
{
border-collapse... | mpld3/mpld3_rewrite | test_plots/test_plot_w_html_tooltips.py | Python | bsd-3-clause | 1,286 |
""" Forms for use with User objects """
from django import forms
from django.contrib.auth.models import User
class UserForm(forms.ModelForm):
"""
Form for django.contrib.auth.models.User
"""
class Meta:
"""
Meta data for User Form
"""
model = User
fields = ('us... | Gimpneek/jobseek | jobseekr/cv/forms/user.py | Python | agpl-3.0 | 1,096 |
# -*- coding: utf-8 -*-
"""
Started on fri, dec 8th, 2017
@author: carlos.arana
"""
# Librerias utilizadas
import pandas as pd
import numpy as np
import sys
# Librerias locales utilizadas
module_path = r'D:\PCCS\01_Dmine\Scripts'
if module_path not in sys.path:
sys.path.append(module_path)
from SUN.asignar_sun i... | Caranarq/01_Dmine | 06_Energia/P0613/P0613.py | Python | gpl-3.0 | 9,853 |
# coding=utf-8
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: https://sickrage.github.io
#
# This file is part of SickRage.
#
# SickRage 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 L... | nopjmp/SickRage | sickbeard/notifiers/emby.py | Python | gpl-3.0 | 4,210 |
#!/usr/bin/python
import csv
import os
import sys
#SOURCE_DIR="/vagrant/files/physionet-challenge-2012"
SOURCE_DIR="/vagrant/files/datasource/physionet-challenge-2012"
CONCEPT_FILE="/vagrant/files/datasource/physionet-challenge-2012/headeronly/concept.txt"
#DEATH_FILE="/vagrant/files/datasource/physionet-challenge-20... | Clinical3PO/Platform | dev/Clinical3PO-Vagrant/files/datasource/physionet-challenge-2012/etl/dataTransform.py | Python | apache-2.0 | 6,635 |
#!/usr/bin/env python
# Copyright (c) 2014, Stanford University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this list ... | paepcke/json_to_relation | scripts/lookupOpenEdxHash.py | Python | bsd-3-clause | 2,745 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack Foundation
# Copyright 2011 - 2012, Red Hat, 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
#
# ... | ntt-sic/cinder | cinder/openstack/common/rpc/impl_qpid.py | Python | apache-2.0 | 26,814 |
# coding=utf-8
import glob, hashlib, os, re, shutil, subprocess, sys
from textwrap import dedent
import tools.shared
from tools.shared import *
from tools.line_endings import check_line_endings
from runner import RunnerCore, path_from_root, checked_sanity, test_modes, get_zlib_library, get_bullet_library
class T(Runn... | slightperturbation/Cobalt | ext/emsdk_portable/emscripten/tag-1.34.1/tests/test_core.py | Python | apache-2.0 | 251,267 |
# An OLE file format parser
import os
import struct
import logging
import datetime
PIDSI = {'PIDSI_CODEPAGE':0x01, 'PIDSI_TITLE':0x02, 'PIDSI_SUBJECT':0x03, 'PIDSI_AUTHOR':0x04, 'PIDSI_KEYWORDS':0x05,
'PIDSI_COMMENTS':0x06, 'PIDSI_TEMPLATE':0x07, 'PIDSI_LASTAUTHOR':0x08, 'PIDSI_REVNUMBER':0x09, 'PIDSI_EDITTI... | z3r0zh0u/pyole | pyole.py | Python | mit | 60,571 |
# Copyright 2011 Google Inc. All Rights Reserved.
"""Locked file interface that should work on Unix and Windows pythons.
This module first tries to use fcntl locking to ensure serialized access
to a file, then falls back on a lock file if that is unavialable.
Usage:
f = LockedFile('filename', 'r+b', 'rb')
f.... | samuelclay/NewsBlur | vendor/oauth2client/locked_file.py | Python | mit | 10,284 |
# -*- coding: utf-8 -*-
"""
sphinx.ext.autosummary.generate
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Usable as a library or script to generate automatic RST source files for
items referred to in autosummary:: directives.
Each generated RST file contains a single auto*:: directive which
extracts the doc... | shadowmint/nwidget | lib/pyglet-1.4.4/doc/ext/autosummary/generate.py | Python | apache-2.0 | 13,676 |
from libra.repository.mongodb.mongodb import Repository
from libra.repository.mongodb.orm import Collection, Property, PropertyDict
__all__ = (
"Repository",
"Collection",
"Property",
"PropertyDict"
)
| pitomba/libra | libra/repository/__init__.py | Python | mit | 218 |
# orm/util.py
# Copyright (C) 2005-2021 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
import re
import types
import weakref
from . import attributes # noqa
from .base imp... | zzzeek/sqlalchemy | lib/sqlalchemy/orm/util.py | Python | mit | 72,410 |
# Common functions for Scons scripts...
import os
def FileListAppend(fileList, buildRelativeFolder, includeFolder, wantedExtension):
fullFolder = os.path.join(buildRelativeFolder, includeFolder)
for filename in os.listdir(fullFolder):
if not filename.endswith("." + wantedExtension): continue
fullFilePathN... | dava/dava.engine | Programs/ColladaConverter/Collada15/SconsCommon.py | Python | bsd-3-clause | 855 |
# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-common.
#
# logilab-common is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as publ... | musicmetric/logilab-common | test/unittest_configuration.py | Python | gpl-2.0 | 10,551 |
# https://www.hackerrank.com/challenges/restaurant
import sys
import math
"""
def gcd(a, b):
if b>a:
t = a
a = b
b = t
while b!=0:
t = b
b = a % b
a = t
return a
"""
"""
t = int(raw_input())
while t>0:
l, b = [int(x) for x in raw_input().split()]
print l * b / gcd(l, b)**2
t -= 1
"""
"""
t = int(raw... | capsci/chrome | practice/python/resta.py | Python | mit | 2,221 |
#! -*- coding: utf-8 -*-
from trans_l.decorators import transliterate_function
@transliterate_function(language_code="ru", reversed=False)
def trans_word(word):
return word
| WilfMan/vkontakte | trans.py | Python | mit | 179 |
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
import json
class test(Document):
def db_insert(self):
d = self.get_valid_dict(co... | saurabh6790/frappe | frappe/core/doctype/test/test.py | Python | mit | 970 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
HTTP/Web class.
Holds commonly-used HTTP/web request/post methods.
Compatible with Python 2.5, 2.6, 2.7
"""
import time
import urllib2, cookielib, urllib, httplib
from sys import stderr
DOWNLOAD_TIMEOUT = 10
class Httpy:
"""
Class used for communicating with web... | 4pr0n/gonewilder | py/Httpy.py | Python | gpl-2.0 | 9,304 |
from django.db import models
from django.contrib.auth.models import User
from django.http import Http404
from ckeditor_uploader.fields import RichTextUploadingField
from wquests import common_functions
class WebQuest(models.Model):
creator_ref = models.ForeignKey(User, on_delete=models.DO_NOTHING, verbose_name="C... | priakni/wquests | wquests/wqengine/models.py | Python | mit | 4,476 |
__license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
from calibre.devices.usbms.driver import USBMS
class TECLAST_K3(USBMS):
name = 'Teclast K3/K5 Device Interface'
gui_name = 'K3/K5'
description = _('Communicate with... | yeyanchao/calibre | src/calibre/devices/teclast/driver.py | Python | gpl-3.0 | 3,441 |
# Copyright 2013-2014 Sebastian Kreft
#
# 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 ... | TimeIncOSS/git-lint | test/unittest/test_gitlint.py | Python | apache-2.0 | 20,634 |
# Copyright (C) 2012 - 2014 EMC Corporation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... | hybrid-storage-dev/cinder-client-fs-111t-hybrid-cherry | v2/cgsnapshots.py | Python | apache-2.0 | 4,004 |
# # -*- coding: utf-8 -*-
#
# from django.db import models
# from protoLib.models import *
#
#
# class WflowAdminResume(ProtoModelExt):
# """ Contains the latest news summary that require administrator action
# When creating a record of WFlow you can create an instance of this table or increment the cou... | DarioGT/docker-carra | src/protovarios/models.py | Python | mit | 3,499 |
import asyncore
import socket
import json
class AsynService(asyncore.dispatcher):
def __init__(self, host, port, engine):
asyncore.dispatcher.__init__(self)
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
self.bind((host, port))
self.listen(1)
self.running = False
... | astrellon/maze | server/python/cmds/command_asyn_service.py | Python | mit | 3,001 |
# -*- coding: utf-8 -*-
def command():
return "stop-all-instance"
def init_argument(parser):
parser.add_argument("--farm-no", required=True)
def execute(requester, args):
farm_no = args.farm_no
parameters = {}
parameters["FarmNo"] = farm_no
return requester.execute("/StopAllInstance", param... | primecloud-controller-org/pcc-cli | src/pcc/api/instance/stop_all_instance.py | Python | apache-2.0 | 327 |
# Copyright (c) 2014 Adafruit Industries
# Author: Tony DiCola
# Based on Adafruit_I2C.py created by Kevin Townsend.
#
# 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, inc... | adafruit/Adafruit_Python_GPIO | Adafruit_GPIO/I2C.py | Python | mit | 9,083 |
#!/usr/bin/env python3
# -*-coding:UTF-8 -*
import os
import sys
import json
import redis
from TorSplashCrawler import TorSplashCrawler
sys.path.append(os.path.join(os.environ['AIL_BIN'], 'lib/'))
import ConfigLoader
import crawlers
if __name__ == '__main__':
if len(sys.argv) != 2:
print('usage:', 'tor_... | CIRCL/AIL-framework | bin/torcrawler/tor_crawler.py | Python | agpl-3.0 | 1,546 |
import time
import inspect
def log(*objects, sep=' ', end='\n'):
"""Function used to log activities to console.
Basically print() on steroids."""
callerframerecord = inspect.stack()[1]
frame = callerframerecord[0]
info = inspect.getframeinfo(frame)
filename = info.filename.split('/')[l... | Ankhee/steam-games-graph | scripts/utils.py | Python | gpl-3.0 | 618 |
# Copyright 2021 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, ... | GoogleCloudPlatform/cloud-data-quality | tests/integration/test_advanced_dq_rules.py | Python | apache-2.0 | 12,219 |
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
src = "../libturboparser/"
setup(cmdclass={'build_ext': build_ext},
ext_modules=[Extension("turboparser", ["turbo_parser.pyx"], language="c++",
include_dirs=["../src/semantic_parser", "../src/pars... | PhdDone/TurboParser | python/setup.py | Python | lgpl-3.0 | 556 |
# Lint as: python3
# Copyright 2018 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 ... | tensorflow/lingvo | lingvo/core/test_utils_test.py | Python | apache-2.0 | 2,160 |
import sys, os
import re
import unittest
import traceback
import pywin32_testutil
# A list of demos that depend on user-interface of *any* kind. Tests listed
# here are not suitable for unattended testing.
ui_demos = """GetSaveFileName print_desktop win32cred_demo win32gui_demo
win32gui_dialog win32gui_... | huguesv/PTVS | Python/Product/Miniconda/Miniconda3-x64/Lib/site-packages/win32/test/testall.py | Python | apache-2.0 | 5,687 |
from django.shortcuts import render
def list(request):
return render(request, 'qa/list.html')
def form(request):
return render(request, 'qa/form.html')
| bugness/ask-and-answer | qa/views.py | Python | mit | 164 |
####
#### Give a report on the "sanity" of the users and groups YAML
#### metadata files.
####
#### Example usage to analyze the usual suspects:
#### python3 sanity-check-users-and-groups.py --help
#### Get report of current problems:
#### python3 ./scripts/sanity-check-users-and-groups.py --users metadata/users.yaml... | geneontology/go-site | scripts/sanity-check-users-and-groups.py | Python | bsd-3-clause | 7,704 |
from time import sleep
from scrapy.downloadermiddlewares.retry import RetryMiddleware
from scrapers.manolo_scraper import settings
class ProxyMiddleware(object):
def process_request(self, request, spider):
try:
proxy = settings.HTTP_PROXY
request.meta['proxy'] = proxy
exc... | aniversarioperu/django-manolo | scrapers/manolo_scraper/middlewares.py | Python | bsd-3-clause | 928 |
import sys
sys.path.insert(1, "../../")
import h2o, tests
def demo_gbm():
h2o.demo(func="gbm", interactive=False, test=True)
if __name__ == "__main__":
tests.run_test(sys.argv, demo_gbm)
| brightchen/h2o-3 | h2o-py/tests/testdir_demos/pyunit_gbm_demo.py | Python | apache-2.0 | 198 |
#!/usr/bin/python
# -*- Mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
#
# 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 ... | miurahr/ModemManager | test/mm-test.py | Python | gpl-2.0 | 15,258 |
from __future__ import absolute_import
###########################################################################
# (C) Vrije Universiteit, Amsterdam (the Netherlands) #
# #
# This file is part of AmCAT - The Amsterdam Content ... | aemal/westcat | settings/__init__.py | Python | agpl-3.0 | 1,565 |
import binascii
import base64
class UnexpectedDER(Exception):
pass
def encode_constructed(tag, value):
return chr(0xa0+tag) + encode_length(len(value)) + value
def encode_integer(r):
assert r >= 0 # can't support negative numbers yet
h = "%x" % r
if len(h)%2:
h = "0" + h
s = binascii.u... | kazcw/NGCCCBase | ecdsa/der.py | Python | mit | 6,199 |
import sublime, sublime_plugin
import os.path
import platform
def compare_file_names(x, y):
if platform.system() == 'Windows' or platform.system() == 'Darwin':
return x.lower() == y.lower()
else:
return x == y
class SwitchFileCommand(sublime_plugin.WindowCommand):
def run(self, extensions=... | koery/win-sublime | Data/Packages/Default/switch_file.py | Python | mit | 1,112 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington
# See opus_core/LICENSE
# Utility classes that can be used to generate parse tree patterns. These
# utilities take a sample expression or statement, and return a parse tree that... | apdjustino/DRCOG_Urbansim | src/opus_core/variables/utils/parse_tree_pattern_generator.py | Python | agpl-3.0 | 1,882 |
from __future__ import division
import numpy as np
class QuantileBasedSelection(object):
def __init__(self, is_minimize=True, is_normalize=False):
self.is_minimize = is_minimize
self.is_normalize = is_normalize
def __call__(self, evals, coefficient=None, xp=np):
quantiles = self.compu... | satuma777/evoltier | evoltier/weight.py | Python | gpl-3.0 | 2,268 |
# Copyright 2019 DeepMind Technologies Limited. 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 ... | deepmind/dm-haiku | haiku/_src/layer_norm_test.py | Python | apache-2.0 | 9,340 |
from sympy.core import Tuple, Basic, Add
from sympy.strategies import typed, canon, debug, do_one, unpack
from sympy.functions import transpose
from sympy.utilities import sift
from sympy.matrices.expressions.matexpr import MatrixExpr, ZeroMatrix, Identity
from sympy.matrices.expressions.matmul import MatMul
from symp... | amitjamadagni/sympy | sympy/matrices/expressions/blockmatrix.py | Python | bsd-3-clause | 12,332 |
from flask import current_app, jsonify, request
from notifications_python_client.errors import HTTPError
from app import status_api_client, version
from app.status import status
@status.route('/_status', methods=['GET'])
def show_status():
if request.args.get('elb', None) or request.args.get('simple', None):
... | alphagov/notifications-admin | app/status/views/healthcheck.py | Python | mit | 776 |
# Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
import os
import re # noqa
import sys
import ldap
import djcelery
from datetime import timedelta
from kombu import Queue, Exchange
from kombu.common import Broadcast
# global settings
from django.conf import global_settings
# ugettext lazy
from django.utils.... | snahelou/awx | awx/settings/defaults.py | Python | apache-2.0 | 37,609 |
from __future__ import with_statement
import textwrap
import os
import sys
import pytest
from os.path import join, normpath
from tempfile import mkdtemp
from mock import patch
from tests.lib import assert_all_changes, pyversion
from tests.lib.local_repos import local_repo, local_checkout
from pip.utils import rmtree
... | qbdsoft/pip | tests/functional/test_uninstall.py | Python | mit | 13,733 |
import sys
sys.path.append("../")
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn import decomposition
import jieba
import time
import glob
import sys
import os
import random
if len(sys.argv)<2:
print "usage: extract_topic.py di... | beni55/jieba | test/extract_topic.py | Python | mit | 1,456 |
# Implementation of Extensible Dependency Grammar, as described in
# Debusmann, R. (2007). Extensible Dependency Grammar: A modular
# grammar formalism based on multigraph description. PhD Dissertation:
# Universität des Saarlandes.
#
########################################################################
#
# ... | LowResourceLanguages/hltdi-l3 | l3xdg/graph.py | Python | gpl-3.0 | 23,447 |
# Copyright (C) 2013-2015 MetaMorph Software, Inc
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this data, including any software or models in source or binary
# form, as well as any drawings, specifications, and documentation
# (collectively "the Data"), to deal in the Data ... | pombredanne/metamorphosys-desktop | metamorphosys/META/src/JobManager/get_longrunning_jobs.py | Python | mit | 4,502 |
import os
import pytest
from py.path import local
from socceraction.data import opta as opta
from socceraction.data.opta import (
OptaCompetitionSchema,
OptaEventSchema,
OptaGameSchema,
OptaPlayerSchema,
OptaTeamSchema,
)
def test_create_opta_json_loader(tmpdir: local) -> None:
"""It should ... | ML-KULeuven/socceraction | tests/data/test_load_opta.py | Python | mit | 8,173 |
from __future__ import unicode_literals
import json
from flask import Flask, request, abort, render_template
from hazm import Normalizer
from InformationSearcher import InformationSearcher
app = Flask(__name__)
normalizer = Normalizer()
information_searcher = InformationSearcher('../resources/index/')
@app.route('/... | sobhe/baaz | web/main.py | Python | mit | 927 |
#!/usr/bin/env python
# Copyright 2017-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | opencord/voltha | experiments/streaming_client.py | Python | apache-2.0 | 3,594 |
#!/usr/bin/env python
ref_file = open('../../../result/mirage_output_miR-124_vs_RefSeq_NM_2015-07-20_miR-124_overexpression.result','r')
input_file = open('../../../result/gene_exp_miR-124_overexpression_RefSeq_Rep_isoforms.diff','r')
output_file = open('../../../result/gene_exp_miR-124_overexpression_RefSeq_Rep_i... | Naoto-Imamachi/MIRAGE | scripts/module/preparation/CC2_MRE_type_with_GU_wobbles_vs_exp_miR-124.py | Python | mit | 2,426 |
from django import template
register = template.Library()
@register.filter
def underscore_to_space(value):
return value.replace("_", " ").replace(" BE", "")
| C4ptainCrunch/hackeragenda | events/templatetags/events_tags.py | Python | gpl-3.0 | 164 |
"""This is the root component for the Asphalt webnotifier tutorial."""
import logging
from difflib import HtmlDiff
from asphalt.core import CLIApplicationComponent
from async_generator import aclosing
from webnotifier.detector import ChangeDetectorComponent
logger = logging.getLogger(__name__)
class ApplicationCom... | asphalt-framework/asphalt | examples/tutorial2/webnotifier/app.py | Python | apache-2.0 | 1,002 |
# https://canvas.instructure.com/doc/api/assignments.html
from datetime import datetime
from canvas.core.courses import get_courses, get_courses_whitelisted, get_course_people, get_courses_by_account_id
from canvas.core.io import write_xlsx_file, tada
from canvas.core.assignments import get_assignments
def... | dgrobani/py3-canvaslms-api | assignments/assignments_turnitin_msonline_list.py | Python | mit | 3,100 |
''' Example that creates a planar silicon sensor with a given geometry.
Calculates the electrical potential and fields. For comparison also the
analytical result of a planar sensor with 100% fill factor (width = pitch)
is created.
.. WARNING::
The calculation of the depletion region is simplifi... | SiLab-Bonn/Scarce | scarce/examples/sensor_planar.py | Python | mit | 5,156 |
#!/usr/bin/python
import numpy as np
from skimage import measure
class CPM:
def __init__(self, L,cells=[1],V0=None,th=1): #Create Potts model
self.L=L #lattice length/width
self.size=L**2 #model size
self.cells=cells
self.c=1+np.sum(self.cells)
self.q=1+len(self.cells) #number of states
self.J=np.zer... | MiguelAguilera/CellularPottsModel | CPM.py | Python | gpl-3.0 | 4,709 |
"""This module contains functions pertaining to numbers in Punjabi."""
from cltk.corpus.punjabi.alphabet import DIGITS_GURMUKHI as DIGITS
__author__ = ['Nimit Bhardwaj <nimitbhardwaj@gmail.com>']
__license__ = 'MIT License. See LICENSE.'
def punToEnglish_number(number):
"""Thee punToEnglish_number function will ... | LBenzahia/cltk | cltk/corpus/punjabi/numerifier.py | Python | mit | 1,080 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2011 Juan Grande
#
# 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
#
# Unle... | jgrande/p3bot | src/main/python/p3bot.py | Python | apache-2.0 | 7,406 |
import core.modules
from core.modules.vistrails_module import Module, ModuleError
import numpy
from Array import *
class ArrayAccess(object):
my_namespace = "numpy|array|access"
class GetShape(Module, ArrayAccess):
""" Get the size of each dimension of an N-dimensional array"""
def compute(self):
... | Nikea/VisTrails | contrib/NumSciPy/ArrayAccess.py | Python | bsd-3-clause | 13,375 |
""" This scripts converts SER, DM3, and DM4 files into PNG """
import argparse
from ncempy.io.dm import fileDM
from ncempy.io.ser import fileSER
import ntpath
import os
from matplotlib import cm
from matplotlib.image import imsave
def _discover_emi(file_route):
file_name = ntpath.basename(file_route)
folder ... | ercius/openNCEM | ncempy/command_line/ncem2png.py | Python | gpl-3.0 | 5,664 |
# -*- encoding: utf-8 -*-
import controllers
import models
| suhe/odoo | res-addons/website_sale_digital/__init__.py | Python | gpl-3.0 | 59 |
#!/usr/bin/env python
"""Convenience functions for writing LSST microservices"""
import logging
import os
import sys
import time
import logging.handlers
import requests
import structlog
from flask import Flask, jsonify, current_app
# pylint: disable=redefined-builtin,too-many-arguments
from past.builtins import basestr... | lsst-sqre/sqre-apikit | apikit/convenience.py | Python | mit | 18,708 |
import threading
import time
import json
import requests
class BiographySource(threading.Thread):
def __init__(self, config, identifier):
threading.Thread.__init__(self)
self._config = config
self._result = False
self._identifier = identifier
# Starting poi... | HenriNijborg/MIS | MMR/mmr/action/sources/biographysource.py | Python | mit | 1,725 |
# Copyright (C) 2016-2021 ycmd contributors
#
# This file is part of ycmd.
#
# ycmd 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.
#
#... | puremourning/ycmd-1 | ycmd/tests/python/debug_info_test.py | Python | gpl-3.0 | 2,083 |
import csv
import sys
def parse_csv(filename):
f = open(filename, 'rb')
reader = csv.reader(f)
header = reader.next()
exception_message = """Your csv header was named incorrectly,
make sure there are no uneccessary commas
or spaces and th... | AndrewJudson/jackknife | script.py | Python | mit | 2,319 |
"""
Swaggy Jenkins
Jenkins API clients generated from Swagger / Open API specification # noqa: E501
The version of the OpenAPI document: 1.1.2-pre.0
Contact: blah@cliffano.com
Generated by: https://openapi-generator.tech
"""
import sys
import unittest
import swaggyjenkins
from swaggyjenkins.mo... | cliffano/swaggy-jenkins | clients/python/generated/test/test_favorite_impllinks.py | Python | mit | 871 |
#!/usr/bin/env python2
import json
import os
from types import *
import unittest
from playlistingscraper.playlistingscraper import PlayListingScraper
class PlayListingScrapwerTest(unittest.TestCase):
def setUp(self):
listing_parser = PlayListingScraper()
self.package_name = "com.google.android.yo... | sikuli/sieveable-tools | Play-Listing-Scraper/tests/playlistingscraper_test.py | Python | mit | 4,104 |
import requests
# config is an instance of ConfigParser
def upload(filename, config):
return __upload(
filename,
config.get('Upload', 'ServerURI'),
config.get('Upload', 'Location'),
config.get('Default', 'CameraName')
)
def __upload(filename, server_uri, location, camera_name):
f = open(filename... | xnnyygn/auto-camera | raspberry-pi/camera-agent/photo_uploader.py | Python | mit | 916 |
#!/usr/bin/python
import os
import signal
import time
import sys
def init():
# open sync file
path = os.path.expanduser("~/.cache/zipfs/sync.pid")
if os.path.exists(path) and os.stat(path).st_size > 0:
f = open(path, "r+")
# read the previous pid
# check if it is running
i... | freester1/zipfs | sync.py | Python | gpl-3.0 | 1,925 |
from toontown.coghq.SpecImports import *
GlobalEntities = {1000: {'type': 'levelMgr',
'name': 'LevelMgr',
'comment': '',
'parentEntId': 0,
'modelFilename': 'phase_10/models/cogHQ/EndVault.bam'},
1001: {'type': 'editMgr',
'name': 'EditMgr',
'parentEntId': 0,
'inse... | ToonTownInfiniteRepo/ToontownInfinite | toontown/cogdominium/CogdoCraneGameSpec.py | Python | mit | 1,302 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django.http.response import HttpResponse, HttpResponseRedirec... | suutari/shoop | shuup/admin/modules/system/views/telemetry.py | Python | agpl-3.0 | 1,503 |
#!/usr/bin/python
"""
Starter code for the validation mini-project.
The first step toward building your POI identifier!
Start by loading/formatting the data
After that, it's not our code anymore--it's yours!
"""
import pickle
import sys
sys.path.append("../tools/")
from feature_format import featur... | yavuzovski/playground | machine learning/Udacity/ud120-projects/validation/validate_poi.py | Python | gpl-3.0 | 1,149 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-compute | google/cloud/compute_v1/services/forwarding_rules/transports/__init__.py | Python | apache-2.0 | 1,111 |
#! env/bin/python
import os
from flask import url_for
from flask_script import Manager, Shell, commands
from flask_migrate import Migrate, MigrateCommand
from app import create_app, db
from app.models import FlaskyConfigs, FlaskyArticles
app = create_app('default')
manager = Manager(app)
migrate = Migrate(app, db)
d... | PassionZale/My | manage.py | Python | mit | 993 |
import errno
import logging
import multiprocessing
import os
import socket
import string
import subprocess
import sys
import time
import unittest
from waitress import server
from waitress.compat import (
httplib,
tobytes
)
from waitress.utilities import cleanup_unix_socket
dn = os.path.dirname
here = dn(__file... | SamuelDSR/YouCompleteMe-Win7-GVIM | third_party/waitress/waitress/tests/test_functional.py | Python | gpl-3.0 | 56,930 |
import pytest
from services.sf_services.set_hima_test import set_hima_test
def test_set_hima():
student_id = 23911699
level_code = "3"
set_hima_test(student_id, level_code)
if __name__ == "__main__":
pytest.main()
| hongbaby/service-automation | services/unittest/sf_service_test.py | Python | mit | 234 |
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import json
import os
import copy
import unittest
from collections import defaultdict
import pytest
from monty.json import MontyDecoder
from pymatgen.analysis.phase_diagram import PhaseDiagram
from pymatgen.entries.computed... | vorwerkc/pymatgen | pymatgen/entries/tests/test_computed_entries.py | Python | mit | 18,404 |
# coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... | prasanna08/oppia | core/tests/build_sources/extensions/models_test.py | Python | apache-2.0 | 20,181 |
# -*- coding: utf-8 -*-
#
#
# TheVirtualBrain-Framework Package. This package holds all Data Management, and
# Web-UI helpful to run brain-simulations. To use it, you also need do download
# TheVirtualBrain-Scientific Package (for simulators). See content of the
# documentation-folder for more details. See also http:/... | stuart-knock/tvb-framework | tvb_test/adapters/uploaders/nifti_importer_test.py | Python | gpl-2.0 | 8,124 |
# Fabfile to:
# - install kismet
# - list kismet interfaces
# - start kismet
# Import Fabric's API module
from fabric.api import *
from fabric.contrib.files import exists
# User ssh config files
env.use_ssh_config = 'True'
# Set host list
env.roledefs = {
'ntfk_via_te-ace-02': {
'hosts': [
... | boisgada/NTFKit | fabric/kismet_fabfile.py | Python | gpl-3.0 | 7,243 |
#!/usr/bin/env python3
from PIL import Image
import os.path
import sys
if __name__ == '__main__':
img = Image.open(sys.argv[1])
img.load()
name = os.path.splitext(os.path.basename(sys.argv[1]))[0]
frames = 0
for i in range(65536):
try:
img.seek(i)
except EOFError:
... | cahirwpz/demoscene | effects/anim/data/gen-anim.py | Python | artistic-2.0 | 1,148 |
from model.group import Group
def test_add_group(app, db, json_groups, check_ui):
group = json_groups
old_groups = db.get_group_list()
app.group.create(group)
#сделаем простую проверку, убедимся, что новый список длинее чем старый на ед-цу
new_groups = db.get_group_list()
... | Lenkora/python_training | test/test_add_group.py | Python | apache-2.0 | 726 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.