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 |
|---|---|---|---|---|---|---|
"""
mbed SDK
Copyright (c) 2011-2016 ARM Limited
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... | svastm/mbed | tools/export/codered.py | Python | apache-2.0 | 1,779 | 0.001124 |
#!/usr/bin/python
#
# Copyright 2015 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 b... | coxmediagroup/googleads-python-lib | examples/adwords/v201506/advanced_operations/add_click_to_download_ad.py | Python | apache-2.0 | 3,318 | 0.006329 |
""" Launcher functionality for the Google Compute Engine (GCE)
"""
import json
import logging
import os
from dcos_launch import onprem, util
from dcos_launch.platforms import gcp
from dcos_test_utils.helpers import Host
from googleapiclient.errors import HttpError
log = logging.getLogger(__name__)
def get_credentia... | dcos/dcos-launch | dcos_launch/gcp.py | Python | apache-2.0 | 4,208 | 0.002852 |
# Copyright (c) 2010-2013 OpenStack, 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 ... | Khushbu27/Tutorial | swift/obj/mem_server.py | Python | apache-2.0 | 4,314 | 0 |
#!/usr/bin/env python
# Copyright (c) 2008-14 Qtrac Ltd. All rights reserved.
# This program or module 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
# version 3 of the Lic... | manashmndl/LearningPyQt | pyqt/chap05/numberformatdlg2.py | Python | mit | 4,502 | 0.002221 |
"""Test loading historical builds and jobs."""
from __future__ import absolute_import, unicode_literals
from travis_log_fetch.config import _get_travispy
from travis_log_fetch._target import Target
from travis_log_fetch.get import (
get_travis_repo,
get_historical_builds,
get_historical_build,
get_his... | jayvdb/travis_log_fetch | tests/test_historical.py | Python | mit | 5,569 | 0 |
# ale_python_interface.py
# Author: Ben Goodrich
# This directly implements a python version of the arcade learning
# environment interface.
from ctypes import *
import numpy as np
from numpy.ctypeslib import as_ctypes
import os
ale_lib = cdll.LoadLibrary(os.path.join(os.path.dirname(__file__),
... | CyCraig/AtariRL | ale_python_interface/ale_python_interface.py | Python | gpl-2.0 | 10,369 | 0.001929 |
# Bu kod calismayacak, mantigi anlamak icin yazildi.
from gittigidiyor.applicationservice import *
from gittigidiyor.auth import *
if __name__ == "__main__":
# HTTP Basic authentication credentials.. It blows up for the wrong credentials..
auth = Auth("testuser", "testpassword", None, None)
api = Applicati... | Annelutfen/gittigidiyor-python | examples/applicationservice.py | Python | mit | 526 | 0.003802 |
from django.db.models.expressions import F, Func
from rest_framework import serializers
from .models import PdfStorage
class PdfStorageListSerializer(serializers.ModelSerializer):
author = serializers.SerializerMethodField("full_name")
class Meta:
model = PdfStorage
fields = [
"... | auto-mat/klub | apps/pdf_storage/serializers.py | Python | gpl-3.0 | 1,144 | 0.000874 |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, Bruno Cauet
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the r... | shamangeorge/beets | test/test_thumbnails.py | Python | mit | 11,414 | 0.000088 |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from flask import request
from indico.modules.admin.views import... | mic4ael/indico | indico/modules/users/views.py | Python | mit | 1,654 | 0.000605 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-06-02 07:44
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('distances', '0010_auto_20170519_1604'),
]
operations = [
migr... | tkettu/rokego | distances/migrations/0011_auto_20170602_1044.py | Python | mit | 513 | 0.001949 |
import re
import shutil
import time
import os
import os.path
from pyquery.pyquery import PyQuery
import requests
import requests.utils
from WhatManager2.settings import MEDIA_ROOT
from bibliotik import manage_bibliotik
from bibliotik.models import BibliotikTorrent, BibliotikFulltext
from bibliotik.settings import BIB... | MADindustries/WhatManager2 | bibliotik/utils.py | Python | mit | 7,895 | 0.002027 |
# Copyright (C) 2007, 2009, 2010 Canonical Ltd
#
# 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 dis... | stewartsmith/bzr | bzrlib/tests/commands/test_cat.py | Python | gpl-2.0 | 1,932 | 0.000518 |
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
import os
all_modifs={}
def fixdir(dir):
global all_modifs
for k in all_modifs:
for v in all_modifs[k]:
modif(os.path.join(dir,'waflib'),k,v)
def modif(dir,name,fun):
... | automatthias/aubio | waflib/fixpy2.py | Python | gpl-3.0 | 1,110 | 0.067568 |
import time
from torba.server import util
def sessions_lines(data):
"""A generator returning lines for a list of sessions.
data is the return value of rpc_sessions()."""
fmt = ('{:<6} {:<5} {:>17} {:>5} {:>5} {:>5} '
'{:>7} {:>7} {:>7} {:>7} {:>7} {:>9} {:>21}')
yield fmt.format('ID', 'Fl... | lbryio/lbry | torba/torba/server/text.py | Python | mit | 3,433 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vispy: gallery 30
# -----------------------------------------------------------------------------
# Copyright (c) 2015, California Institute of Technology.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# ----------------------------------------... | stargaser/spscviz | spscinspector.py | Python | bsd-3-clause | 15,570 | 0.008157 |
# --- BEGIN COPYRIGHT BLOCK ---
# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
# See LICENSE for details.
# --- END COPYRIGHT BLOCK ---
from lib389.plugins import Plugin, Plugins
import argparse
from lib389.cli_base import (
_generic_list,
_generic... | Ilias95/lib389 | lib389/cli_conf/plugin.py | Python | gpl-3.0 | 4,136 | 0.005561 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import logg... | petrjasek/superdesk-server | superdesk/io/commands/update_ingest.py | Python | agpl-3.0 | 9,268 | 0.002266 |
"""
Contains a function to generate and upload a LaTeX-rendered math image.
"""
import subprocess
import sys
import typing
def uploadLatex(math: typing.List[str], slackAPI: object, channel: object, users: list) -> str:
"""
Generates a LaTeX math image from the LaTeX source contained in `math`, and posts it to the
a... | ocket8888/slackbot | slackbot/modules/math/math.py | Python | gpl-3.0 | 1,975 | 0.022785 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('ngw', '0009_config_eventdefaultperms'),
]
operations = [
migrations.DeleteModel(
name='ChoiceContactField',
),
... | nirgal/ngw | core/migrations/0010_auto_drop_proxy_models.py | Python | bsd-2-clause | 1,407 | 0 |
from temboo.Library.Google.Drive.Changes.Get import Get, GetInputSet, GetResultSet, GetChoreographyExecution
from temboo.Library.Google.Drive.Changes.List import List, ListInputSet, ListResultSet, ListChoreographyExecution
| jordanemedlock/psychtruths | temboo/core/Library/Google/Drive/Changes/__init__.py | Python | apache-2.0 | 223 | 0.008969 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2016 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2016 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2016 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2016 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program is free software: you can r... | xdevelsistemas/taiga-back-community | taiga/projects/issues/apps.py | Python | agpl-3.0 | 3,000 | 0.001668 |
from biokbase.workspace.client import Workspace
import requests
import json
import sys
from time import time
from fix_workspace_info import fix_all_workspace_info
from pprint import pprint
kb_port = 9999
mini_ws_url = f"http://localhost:{kb_port}/services/ws"
mini_auth_url = f"http://localhost:{kb_port}/services/auth/... | pranjan77/narrative | src/scripts/test_data_uploader/populate_mini_ws.py | Python | mit | 6,648 | 0.002106 |
from pythonforandroid.toolchain import Bootstrap, current_directory, info, info_main, shprint
from pythonforandroid.util import ensure_dir
from os.path import join
import sh
class WebViewBootstrap(Bootstrap):
name = 'webview'
recipe_depends = list(
set(Bootstrap.recipe_depends).union({'genericndkbuil... | germn/python-for-android | pythonforandroid/bootstraps/webview/__init__.py | Python | mit | 1,982 | 0.001514 |
from uber.tests import *
@pytest.fixture
def attendee_id():
with Session() as session:
return session.query(Attendee).filter_by(first_name='Regular', last_name='Attendee').one().id
@pytest.fixture(autouse=True)
def mock_apply(monkeypatch):
monkeypatch.setattr(Attendee, 'apply', Mock())
return Atte... | Anthrocon-Reg/ubersystem | uber/tests/models/test_getter.py | Python | gpl-3.0 | 1,761 | 0.004543 |
#-- GAUDI jobOptions generated on Fri Jul 17 16:39:48 2015
#-- Contains event types :
#-- 11104124 - 106 files - 1087377 events - 233.68 GBytes
#-- Extra information about the data processing phases:
#-- Processing Pass Step-124620
#-- StepId : 124620
#-- StepName : Digi13 with G4 dE/dx
#-- ApplicationN... | Williams224/davinci-scripts | ksteta3pi/Consideredbkg/MC_12_11104124_MagUp.py | Python | mit | 12,177 | 0.02825 |
#### 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 = Mission()
result.template = "object/mission/base/shared_base_mission.iff"
result.attribute_template_id = -1
resu... | anhstudios/swganh | data/scripts/templates/object/mission/base/shared_base_mission.py | Python | mit | 435 | 0.048276 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# vim: expandtab:tabstop=4:shiftwidth=4
''' modify_yaml ansible module '''
import yaml
DOCUMENTATION = '''
---
module: modify_yaml
short_description: Modify yaml key value pairs
author: Andrew Butcher
requirements: [ ]
'''
EXAMPLES = '''
- modify_yaml:
dest: /etc/origin/... | rhdedgar/openshift-tools | openshift/installer/vendored/openshift-ansible-3.4.12-1/library/modify_yaml.py | Python | apache-2.0 | 3,141 | 0.000955 |
"""
desispec.fiberflat
==================
Utility functions to compute a fiber flat correction and apply it
We try to keep all the (fits) io separated.
"""
from __future__ import absolute_import, division
import numpy as np
from desispec.io import read_frame
from desispec.io import write_fiberflat
from desispec.fibe... | gdhungana/desispec | py/desispec/scripts/fiberflat.py | Python | bsd-3-clause | 2,238 | 0.011171 |
class Solution(object):
def isSelfCrossing(self, x):
"""
:type x: List[int]
:rtype: bool
"""
inf = float('inf')
n = len(x)
if n < 3:
return False
ruld = [0, 0, 0, 0] # right, up, left, down
next_max = inf
current = [-x[1], ... | wufangjie/leetcode | 335. Self Crossing.py | Python | gpl-3.0 | 1,217 | 0.012325 |
PROJECT_PATH = __path__[0]
TIEMPO_REGISTRY = {}
REDIS_GROUP_NAMESPACE = 'tiempogroup'
RECENT_KEY = 'tiempo:recent_tasks'
RESULT_PREFIX = 'tiempo:task_result'
__version__ = "1.2.3"
| hangarunderground/tiempo | tiempo/__init__.py | Python | gpl-2.0 | 183 | 0 |
# Copyright (c) 2012 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.
"""Generic presubmit checks that can be reused by other presubmit checks."""
import os as _os
_HERE = _os.path.dirname(_os.path.abspath(__file__))
###... | Phonebooth/depot_tools | presubmit_canned_checks.py | Python | bsd-3-clause | 40,994 | 0.011538 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# encfs.py
#
# Copyright 2013 Antergos
#
# 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 opti... | prescott66/Cnchi | src/encfs.py | Python | gpl-3.0 | 3,865 | 0.001035 |
import jmri.jmrit.jython.Jynstrument as Jynstrument
import jmri.jmrit.catalog.NamedIcon as NamedIcon
import jmri.jmrit.symbolicprog.tabbedframe.PaneOpsProgAction as PaneOpsProgAction
import javax.swing.JButton as JButton
class DecoderPro(Jynstrument):
def getExpectedContextClassName(self):
return "javax.s... | ctag/cpe453 | JMRI/jython/Jynstruments/Launchers/DecoderPro.jyn/DecoderPro.py | Python | gpl-2.0 | 744 | 0.021505 |
"""Application base, containing global templates."""
default_app_config = 'pontoon.base.apps.BaseConfig'
MOZILLA_REPOS = (
'ssh://hg.mozilla.org/users/m_owca.info/firefox-aurora/',
'ssh://hg.mozilla.org/users/m_owca.info/firefox-for-android-aurora/',
'ssh://hg.mozilla.org/users/m_owca.info/thunderbird-aur... | vivekanand1101/pontoon | pontoon/base/__init__.py | Python | bsd-3-clause | 561 | 0 |
from Estructura import espaceado
class Arbol_Sintactico_Abstracto:
def __init__(self,alcance,hijos):
self.hijos = hijos
self.alcance = alcance
self.cont = 1
def imprimir(self,tabulacion):
if (len(self.hijos) > 1):
print tabulacion + "SECUENCIA"
for hijo in self.hijos:
hijo.nivel = 1
hijo.imprimir... | danmt/NEO | Codigo_Fuente/etapa4/Instrucciones/Arbol_Sintactico_Abstracto.py | Python | gpl-3.0 | 428 | 0.044393 |
import glob
from subprocess import call
test_failures = {}
test_successes = {}
files = [file for file in glob.glob('../**/build.gradle', recursive=True)]
for f in files:
if f.startswith('../test'):
continue
# clean all projects in the platform before executing build
print("Cleaning all projects f... | IBMStreams/streamsx.health | test/test-builds.py | Python | apache-2.0 | 792 | 0.001263 |
# -*- coding: utf-8 -*-
"""
pygments.filters
~~~~~~~~~~~~~~~~
Module containing filter lookup functions and default
filters.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.token import String, Comment, Ke... | JulienMcJay/eclock | windows/Python27/Lib/site-packages/pygments/filters/__init__.py | Python | gpl-2.0 | 11,486 | 0.000871 |
class BasePlugin(object):
"""
Extend this/copy its structure to create plugins. Your plugin
class must be `Plugin` to be loaded. Can include commands (command_*),
admin commands (admin_). Additionally, yaib will look functions for
many of the connection events.
Any commands with a docstr... | collingreen/yaib | plugins/baseplugin.py | Python | mit | 5,580 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-11-01 22:55
from __future__ import unicode_literals
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [
('contentcuration', '0038_contentnode_author'),
]
operations = [
... | DXCanas/content-curation | contentcuration/contentcuration/migrations/0039_auto_20161101_1555.py | Python | mit | 1,022 | 0.001957 |
# Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pub... | bdang2012/taiga-back-casting | taiga/base/api/urlpatterns.py | Python | agpl-3.0 | 3,316 | 0.000302 |
#!/usr/local/bin/python
import sys
import urllib
import urllib2
import json
import datetime
YAHOO_URL = 'http://query.yahooapis.com/v1/public/yql?env=http%3A%2F%2Fdatatables.org%2Falltables.env&format=json&diagnostics=true&q='
def getJSON(fileName):
f = open(fileName)
jsonData = json.load(f)
f.close()
... | hassaanm/business-articles | downloadReturns.py | Python | apache-2.0 | 3,618 | 0.004422 |
#!/usr/bin/env python
# coding=utf-8
import json
import sys
data = {
'g1': {
'hosts': [
'172.17.0.2'
]
}
}
with open('w.log', 'w') as f:
f.write(str(sys.argv))
print json.dumps(data)
| tao12345666333/Talk-Is-Cheap | ansible/group.py | Python | mit | 227 | 0 |
import random
import Image
import ImageFont
import ImageDraw
import ImageFilter
import hashlib
from random_words import RandomWords
def gen_captcha(text, fnt, fnt_sz, file_name, fmt='JPEG'):
"""Generate a captcha image"""
# randomly select the foreground color
fgcolor = random.randint(0,0xffff00)
# make the backg... | gutosurrex/feed2twister | flask_app/captcha.py | Python | gpl-3.0 | 1,492 | 0.032842 |
"""
accounts.test_views
===================
Tests the REST API calls.
Add more specific social registration tests
"""
import responses
from django.core.urlresolvers import reverse
from django.core import mail
from django.contrib.sites.models import Site
from django.contrib.auth import get_user_model
... | JTarball/docker-django-polymer | docker/app/app/backend/apps/accounts/test_views.py | Python | gpl-2.0 | 42,275 | 0.005417 |
import web
import base
import local
def orNone(a, b):
if a is None:
return b
return a
class Field(object):
def __init__(self, name, description, primary=False, validator=None):
self.name = name
self.primary = primary
self.description = description
if validator == ... | mateoqac/unqTip | language/vgbs/web/forms.py | Python | gpl-3.0 | 6,865 | 0.004661 |
# -*- coding: utf-8 -*-
# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php
# Copyright 2014, Hartmut Goebel <h.goebel@goebel-consult.de>
"""
Test cases for L{backends.ampache_storage}
"""
from lxml import etree
from twisted.trial import unittest
from coherence.backends import ampache... | unintended/Cohen | tests/backends/test_ampache_storage.py | Python | mit | 4,553 | 0.001098 |
from pygame import K_UP, K_DOWN, K_LEFT, K_RIGHT
from Caracter import Caracter
class CommandHandler(object):
#0 1 2 3 4 5 6 7 8 9 10 11 12 13
_automata_transitions= [[11,11,0, 4, 0, 0, 11,11,0, 11,0, 11,13,0],#up
[9, 2, 0, 0, 0, 0, 9, 9, 0, 0, 0, 1... | r0qs/chubby | Fonte/Command.py | Python | gpl-3.0 | 1,775 | 0.023662 |
"""
CRISPR_db_parser
Madeleine Bonsma
March 7, 2015
Updated May 3, 2016
This script takes a list of spacers downloaded from the CRISPRdb
website and splits them into individual files, one file per organism.
Result files are saved in "data/spacers".
"""
import linecache
import os
# CRISPR db parser
# MB Mar 07 2015
... | goyalsid/phageParser | parserscripts/crispr_db_parser.py | Python | mit | 3,791 | 0.000528 |
# 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
# d... | rahulunair/nova | nova/db/sqlalchemy/api_migrations/migrate_repo/versions/059_add_consumer_generation.py | Python | apache-2.0 | 1,178 | 0.000849 |
from Screen import Screen
from Screens.DefaultWizard import DefaultWizard
from ServiceScan import ServiceScan
from Components.config import config, ConfigSubsection, ConfigSelection, \
ConfigYesNo, ConfigInteger, getConfigListEntry, ConfigSlider, ConfigEnableDisable
from Components.ActionMap import NumberActionMap, Ac... | libo/Enigma2 | lib/python/Screens/ScanSetup.py | Python | gpl-2.0 | 45,681 | 0.032924 |
# 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
# d... | nikesh-mahalka/nova | nova/tests/unit/virt/libvirt/fake_os_brick_connector.py | Python | apache-2.0 | 1,443 | 0 |
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | tseaver/google-cloud-python | asset/google/cloud/asset_v1p2beta1/gapic/transports/asset_service_grpc_transport.py | Python | apache-2.0 | 7,923 | 0.001262 |
"""Tests for certbot_nginx._internal.http_01"""
import unittest
import josepy as jose
try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from acme import challenges
from certbot import achallenges
from certbot.tests import acme_util
from certbot.tests import util ... | letsencrypt/letsencrypt | certbot-nginx/tests/http_01_test.py | Python | apache-2.0 | 10,269 | 0.003019 |
def grade(tid, answer):
if answer.find("'twas_sum_EZ_programming,_am_I_rite?") != -1:
return { "correct": True, "message": "Nice job!" }
return { "correct": False, "message": "If you're confused, read some tutorials :)" } | EasyCTF/easyctf-2015 | api/problems/programming/addition/addition_grader.py | Python | mit | 225 | 0.04 |
####################################################################################################
# Copyright (C) 2016 by Ingo Keller, Katrin Lohan #
# <brutusthetschiepel@gmail.com> #
# ... | BrutusTT/pyJD | pyJD/EZModule.py | Python | agpl-3.0 | 8,093 | 0.011121 |
from sys import argv
script, user_name = argv
# Decalare text or prompt to be seen by the user
# for all request for inout
prompt = '> '
print "Hi %s, I'm the %s script." % (user_name, script)
print "I'd like to ask you a few questions."
print "Do you like me %s?" % user_name
# The 'prompt = >' is seen by user as the... | udoyen/pythonlearning | 1-35/ex14.py | Python | mit | 808 | 0 |
# ******************************************************************************
# Copyright 2017-2018 Intel Corporation
#
# 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.apa... | NervanaSystems/neon | neon/data/text.py | Python | apache-2.0 | 22,858 | 0.001181 |
# Playlist.py
#
# reads all available playlists, adjusts song paths, removes not copied songs,
# writes resulting playlist to destination
import mlsSong as sng
import config
import glob
import os
import sys
import codecs
def Playlist():
# get a list of all playlists
playlists = glob.glob(config.SOURCE_PL... | RalpH-himself/MusicLibrarySyncForMSC | mlsPlaylist.py | Python | gpl-3.0 | 3,927 | 0.003056 |
# -*- coding: utf-8 -*-
"""
celery.utils.mail
~~~~~~~~~~~~~~~~~
How task error emails are formatted and sent.
"""
from __future__ import absolute_import
import sys
import smtplib
import socket
import traceback
import warnings
from email.mime.text import MIMEText
from .functional import maybe_list
from ... | mozilla/firefox-flicks | vendor-local/lib/python/celery/utils/mail.py | Python | bsd-3-clause | 5,402 | 0 |
from unidown.tools import unlink_dir_rec
class TestDeleteDirRec:
def test_non_existence(self, tmp_path):
no_folder = tmp_path.joinpath("./donotexist/")
assert not no_folder.exists()
unlink_dir_rec(no_folder)
assert not no_folder.exists()
def test_recursive(self, tmp_path):
... | IceflowRE/MR-eBook-Downloader | tests/tools_test.py | Python | gpl-3.0 | 762 | 0 |
"""Validators class."""
# -*- coding: utf-8 -*-
from wtforms import ValidationError
class UniqueValidator(object):
"""Validador para chequear variables unicas."""
def __init__(self, model, field, message=None):
self.model = model
self.field = field
if not message:
message ... | janol77/flask-app | app/libs/validators.py | Python | gpl-3.0 | 775 | 0 |
#
# 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... | nathanielvarona/airflow | tests/providers/amazon/aws/hooks/test_s3.py | Python | apache-2.0 | 25,423 | 0.002085 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-10-02 21:26
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("order", "0004_auto_20160111_1108"),
("wellsfargo", ... | thelabnyc/django-oscar-wfrs | src/wellsfargo/migrations/0008_fraudscreenresult.py | Python | isc | 1,998 | 0.001502 |
#-*- coding: utf-8 -*-
import os, re
from traceback import format_exc as fme
from exprParser import Parser, ParserContext
class Shell:
echo = False
echoStrs = {
'on': True,
'off': False,
'true': True,
'false': False,
}
commands = {}
history = []
values = []
ops = []
def processEchoCommand(self, args):
... | qinggeng/tools | MatrixSkatch/shell.py | Python | unlicense | 2,810 | 0.041637 |
#####################################################################
# u1.py
#
# (c) Copyright 2021, Benjamin Parzella. All rights reserved.
#
# This library 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 Foundat... | bparzella/secsgem | secsgem/secs/variables/u1.py | Python | lgpl-2.1 | 1,183 | 0 |
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django... | ansp-2015/arquea | menuextension/models.py | Python | mpl-2.0 | 652 | 0.001534 |
# $Id: icmp.py,v 1.1.1.1 2005/10/29 18:20:48 provos Exp $
from dpkt import Packet, in_cksum as _icmp_cksum
import ip
# Types (icmp_type) and codes (icmp_code) -
# http://www.iana.org/assignments/icmp-parameters
ICMP_CODE_NONE = 0 # for types without codes
ICMP_ECHOREPLY = 0 # echo reply
ICMP_UNREACH = 3 # dest u... | Banjong1990/honey | dpkt/dpkt/icmp.py | Python | gpl-2.0 | 4,112 | 0.034776 |
import sys
ROBOT_LISTENER_API_VERSION = 2
def start_keyword(name, attrs):
sys.stdout.write('start keyword %s\n' % name)
sys.stderr.write('start keyword %s\n' % name)
def end_keyword(name, attrs):
sys.stdout.write('end keyword %s\n' % name)
sys.stderr.write('end keyword %s\n' % name)
| dkentw/robotframework | atest/robot/standard_libraries/builtin/listener_printing_start_end_kw.py | Python | apache-2.0 | 306 | 0 |
from elasticsearch import TransportError
import olympia.core.logger
from olympia.amo.utils import render
log = olympia.core.logger.getLogger('z.es')
class ElasticsearchExceptionMiddleware(object):
def process_exception(self, request, exception):
if issubclass(exception.__class__, TransportError):
... | lavish205/olympia | src/olympia/search/middleware.py | Python | bsd-3-clause | 434 | 0 |
class Egg(object):
def __init__(self, xpos, ypos, t, s):
self.x = xpos # x-coordinate
self.y = ypos # y-coordinate
self.tilt = t # Left and right angle offset
self.angle = 0 # Used to define the tilt
self.scalar = s / 100.0 # Height of the egg
def wobble(self):
... | kantel/processingpy | sketches/modes/PythonMode/examples/Basics/Objects/CompositeObjects/egg.py | Python | mit | 858 | 0.001166 |
import numpy as np
def CG(A, X, B, maxiter=20, tolerance=1.0e-10, verbose=False):
"""Solve X*A=B using conjugate gradient method.
``X`` and ``B`` are ``ndarrays```of shape ``(m, nx, ny, nz)``
coresponding to matrices of size ``m*n`` (``n=nx*ny*nz``) and
``A`` is a callable representing an ``n*n`` matr... | qsnake/gpaw | gpaw/utilities/cg.py | Python | gpl-3.0 | 1,346 | 0.003715 |
"""
Grade API v1 URL specification
"""
from django.conf.urls import url, patterns
import views
urlpatterns = patterns(
'',
url(r'^grades/courses/$', views.CourseGradeList.as_view()),
url(r'^grades/courses/(?P<org>[A-Za-z0-9_.-]+)[+](?P<name>[A-Za-z0-9_.-]+)[+](?P<run>[A-Za-z0-9_.-]+)/$', views.CourseGrade... | jaygoswami2303/course_dashboard_api | v2/GradeAPI/urls.py | Python | mit | 492 | 0.006098 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for Requests."""
from __future__ import division
import json
import os
import pickle
import unittest
import requests
import pytest
from requests.adapters import HTTPAdapter
from requests.auth import HTTPDigestAuth
from requests.compat import (
Morsel, cookie... | iilab/ltfhc-next | system/python-requests/test_requests.py | Python | apache-2.0 | 40,903 | 0.001076 |
from __future__ import print_function
import os
import threading
import re
import pint
ureg = pint.UnitRegistry()
MM = ureg.millimeter
METER = ureg.meter
SEC = ureg.second
DEG = ureg.degree
RAD = ureg.radian
DRAW_LOCK = threading.RLock()
DEBOUNCE = 1
HEAD = NAME_HEAD = 'HEAD'
TORSO = NAME_TORSO = 'TORSO'
NAME_PA... | chrisspen/homebot | src/ros/src/ros_homebot_python/src/ros_homebot_python/constants.py | Python | mit | 14,480 | 0.003384 |
import hashlib
import json
import logging
import os
import subprocess
import sys
import time
from collections import defaultdict
from shutil import copy
from shutil import copyfile
from shutil import copystat
from shutil import copytree
from tempfile import mkdtemp
import boto3
import botocore
import yaml
import sys
... | nficano/python-lambda | aws_lambda/aws_lambda.py | Python | isc | 26,779 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2008 Zuza Software Foundation
#
# This file is part of translate.
#
# translate 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 t... | bluemini/kuma | vendor/packages/translate/storage/xml_name.py | Python | mpl-2.0 | 2,748 | 0.000364 |
# Django settings for temp project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {'ENGINE': 'django.db.backends.sqlite3'}
}
# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://do... | imposeren/django-messages-extends | test_settings.py | Python | mit | 4,967 | 0.000604 |
# -*- coding: utf-8 -*-
"""
Plugins related to folders and paths
"""
from hyde.plugin import Plugin
from hyde.fs import Folder
class FlattenerPlugin(Plugin):
"""
The plugin class for flattening nested folders.
"""
def __init__(self, site):
super(FlattenerPlugin, self).__init__(site)
def b... | stiell/hyde | hyde/ext/plugins/folders.py | Python | mit | 1,263 | 0.002375 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-06-25 15:19
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('shipping', '0005_auto_20170616_1351'),
('teamstore'... | jonathanmeier5/teamstore | saleor/teamstore/migrations/0004_teamstore_shipping_method.py | Python | bsd-3-clause | 672 | 0.001488 |
"""
A sub-package for efficiently dealing with polynomials.
Within the documentation for this sub-package, a "finite power series,"
i.e., a polynomial (also referred to simply as a "series") is represented
by a 1-D numpy array of the polynomial's coefficients, ordered from lowest
order term to highest. For example, a... | teoliphant/numpy-refactor | numpy/polynomial/__init__.py | Python | bsd-3-clause | 951 | 0 |
''' This is the library for getting DotA2 insight information.
Problem:
there was no way to get dota internal data about heroes, their abilities...
in suitable for further work form.
Solution:
this library allows you to get access to all the data in the in-game files.
But information about single her... | gasabr/AtoD | atod/__init__.py | Python | mit | 806 | 0.001241 |
from django.conf import settings
from django.conf.urls import url
from plans.views import CreateOrderView, OrderListView, InvoiceDetailView, AccountActivationView, \
OrderPaymentReturnView, CurrentPlanView, UpgradePlanView, OrderView, BillingInfoRedirectView, \
BillingInfoCreateView, BillingInfoUpdateView, Bil... | cypreess/django-plans | plans/urls.py | Python | mit | 2,070 | 0.006763 |
""" Tests for foe.command.interpret._setup_readline """
from foe.command.interpret import _get_input
def test_no_config():
assert not _get_input()
| robobrobro/foe | test/command/interpret/test_get_input.py | Python | mit | 153 | 0.006536 |
"""
Provide functionality to TTS.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/tts/
"""
import asyncio
import ctypes
import functools as ft
import hashlib
import logging
import mimetypes
import os
import re
import io
from aiohttp import web
import vo... | JshWright/home-assistant | homeassistant/components/tts/__init__.py | Python | apache-2.0 | 16,893 | 0 |
from __future__ import print_function
import itertools,cmath,re
from .helpers import SkipThisVertex,extractAntiSymmetricIndices
from .converter import py2cpp
from .lorentzparser import parse_lorentz
import string,re
def compare(a,b) :
num=abs(a-b)
den=abs(a+b)
if(den == 0. and 1e-10) :
return True
... | hep-mirrors/herwig | Models/Feynrules/python/ufo2peg/check_lorentz.py | Python | gpl-3.0 | 38,432 | 0.032863 |
'''
Copyright (C) 2012 mentalsmash.org <contact@mentalsmash.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
Thi... | mentalsmash/geek-map | mentalsmash/__init__.py | Python | gpl-2.0 | 775 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Custom managers for the Division model.
"""
from __future__ import unicode_literals
from calaccess_processed.managers import BulkLoadSQLManager
class OCDAssemblyDivisionManager(BulkLoadSQLManager):
"""
Custom manager for state assembly OCD Divisions.
"""
... | california-civic-data-coalition/django-calaccess-processed-data | calaccess_processed_elections/managers/opencivicdata/core/divisions.py | Python | mit | 1,449 | 0 |
"""
OpenStreetMap to Land Use/Land Cover Maps
"""
def osm_to_sqdb(osmXml, osmSQLITE):
"""
Convert OSM file to SQLITE DB
"""
from gasp.toshp.gdal import ogr_btw_driver
return ogr_btw_driver(osmXml, osmSQLITE, supportForSpatialLite=True)
def osm_project(osmSQLITE, srs_epsg):
"""
R... | JoaquimPatriarca/senpy-for-gis | gasp/osm2lulc/grs.py | Python | gpl-3.0 | 17,992 | 0.008393 |
# -*- coding: utf-8 -*-
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('entries', '0005_resultsmode_json'),
]
operations = [
migrations.AlterField(
model_name='resultsmode',
name='json',
field=models.... | mjtamlyn/archery-scoring | entries/migrations/0006_auto_20150612_2307.py | Python | bsd-3-clause | 372 | 0 |
# Copyright 2017 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... | mixturemodel-flow/tensorflow | tensorflow/contrib/boosted_trees/python/utils/losses_test.py | Python | apache-2.0 | 3,957 | 0.006823 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import pytest
from ... | pgroudas/pants | tests/python/pants_test/tasks/test_list_goals.py | Python | apache-2.0 | 4,088 | 0.009295 |
import json
import argparse
import os
from listener.config import MIN_TIME, MAX_TIME, PRESSURE_AVERAGE_AMOUNT
from listener.replayer import Replayer
from listener.utilities import convert_time, average
from listener.calculate import (calculate_temp_NTC, calculate_press,
calculate_height,... | dkkline/CanSat14-15 | unused_code/generate_static_json_data.py | Python | mit | 1,797 | 0 |
## Automatically adapted for numpy.oldnumeric Apr 14, 2008 by -c
from builtins import range
def writeMeshMatlabFormat(mesh,meshFileBase):
"""
build array data structures for matlab finite element mesh representation
and write to a file to view and play with in matlatb
in matlab can then print mesh wi... | erdc/proteus | scripts/ppmatlab.py | Python | mit | 3,523 | 0.023843 |
import sys
import vtk
from vtk.test import Testing
class TestGhostPoints(Testing.vtkTest):
def testLinear(self):
pts = vtk.vtkPoints()
pts.SetNumberOfPoints(4)
pts.InsertPoint(0, (0, 0, 0))
pts.InsertPoint(1, (1, 0, 0))
pts.InsertPoint(2, (0.5, 1, 0))
pts.... | hlzz/dotfiles | graphics/VTK-7.0.0/Filters/Geometry/Testing/Python/TestGhostPoints.py | Python | bsd-3-clause | 2,835 | 0.000705 |
# encoding: utf-8
# module gi._gobject._gobject
# from /usr/lib/python2.7/dist-packages/gi/_gobject/_gobject.so
# by generator 1.130
# no doc
# no imports
# Variables with simple values
G_MAXDOUBLE = 1.7976931348623157e+308
G_MAXFLOAT = 3.4028234663852886e+38
G_MAXINT = 2147483647
G_MAXINT16 = 32767
G_MAXINT32 = 2147... | akiokio/centralfitestoque | src/.pycharm_helpers/python_stubs/-1807332816/gi/_gobject/_gobject.py | Python | bsd-2-clause | 21,406 | 0.010511 |
"""Gaussian processes regression."""
# Authors: Jan Hendrik Metzen <jhm@informatik.uni-bremen.de>
# Modified by: Pete Green <p.l.green@liverpool.ac.uk>
# License: BSD 3 clause
import warnings
from operator import itemgetter
import numpy as np
from scipy.linalg import cholesky, cho_solve
import scipy.optimize
from .... | kevin-intel/scikit-learn | sklearn/gaussian_process/_gpr.py | Python | bsd-3-clause | 22,428 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2014, Brian Coca <briancoca+ansible@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = r'''
---
module... | azaghal/ansible | lib/ansible/modules/debconf.py | Python | gpl-3.0 | 5,533 | 0.002169 |
"""
Tests for Discussion API views
"""
from datetime import datetime
import json
from urlparse import urlparse
import ddt
import httpretty
import mock
from pytz import UTC
from django.core.urlresolvers import reverse
from rest_framework.test import APIClient
from common.test.utils import disable_signal
from discuss... | adoosii/edx-platform | lms/djangoapps/discussion_api/tests/test_views.py | Python | agpl-3.0 | 38,334 | 0.001513 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.