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 |
|---|---|---|---|---|---|---|
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | jkyeung/XlsxWriter | xlsxwriter/test/comparison/test_table19.py | Python | bsd-2-clause | 1,269 | 0 |
# Django
from django.db import models
# Third-party apps
import jsonfield # http://pypi.python.org/pypi/django-jsonfield/
from lxml import etree # http://lxml.de/
# Internal
from .log import default_logger as logger
from .utils.introspection import ModelFactory
from .utils.serializers import deserialize_f... | YAmikep/django-xmlmapping | xmlmapping/models.py | Python | bsd-3-clause | 8,995 | 0.002779 |
"""Usage: dbutils.py [-dfh]
Options:
-d --dropall Deletes all collections in the database. Use this very wisely.
-f --force Forces all questions to 'yes'
-h --help show this
"""
import sys
from docopt import docopt
from laserpony import app
from laserpony.util import db
##UTILITY FUNCTIONS
... | JackRamey/LaserPony | dbutils.py | Python | mit | 1,980 | 0.007071 |
from GUIComponent import GUIComponent
from VariableText import VariableText
from os import statvfs
from enigma import eLabel
# TODO: Harddisk.py has similiar functions, but only similiar.
# fix this to use same code
class DiskInfo(VariableText, GUIComponent):
FREE = 0
USED = 1
SIZE = 2
def __init__(self, path, t... | bally12345/enigma2 | lib/python/Components/DiskInfo.py | Python | gpl-2.0 | 1,054 | 0.032258 |
'''
Copy right (c) zhouyuding1990@gmail.com
'''
import unittest
from chapter22_elementary import Vertex
from chapter22_elementary import breath_first_search_input_adjacency_list
def printX(x):
print x
class MyTestCase(unittest.TestCase):
def test_something(self):
self.assertEqual(True, False)
... | YudingZhou/Yo-Fatty | ITA/graphic/chapter22_elementary_test.py | Python | gpl-2.0 | 1,375 | 0 |
# -*- coding: utf-8 -*-
# Copyright(C) 2013 Laurent Bachelier
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at ... | sputnick-dev/weboob | modules/citelis/module.py | Python | agpl-3.0 | 2,036 | 0 |
class Solution(object):
def reverseBits(self, n):
"""
:type n: int
:rtype: int
"""
ret = 0
for i in range(32):
ret += (n%2) * 2**(31-i)
n /= 2
return ret | xingjian-f/Leetcode-solution | 190. Reverse Bits.py | Python | mit | 231 | 0.030303 |
import time
from datetime import datetime
def format_ts_from_float(ts):
return int(ts) * 1000000000
def format_ts_from_date(ts):
return format_ts_from_float(time.mktime(ts.timetuple()))
def format_ts_from_str(ts, pattern='%Y-%m-%d %H:%M:%S'):
return format_ts_from_date(datetime.strptime(ts, pattern))
... | rdo-infra/ci-config | ci-scripts/infra-setup/roles/rrcockpit/files/telegraf_py3/influxdb_utils.py | Python | apache-2.0 | 487 | 0 |
# vim: ts=4:sw=4:expandtab
# BleachBit
# Copyright (C) 2014 Andrew Ziem
# http://bleachbit.sourceforge.net
#
# 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 3 of the License, or
... | maximilianofaccone/puppy-siberian | usr/share/bleachbit/CleanerML.py | Python | gpl-3.0 | 8,532 | 0.00082 |
from extractors import XPathExtractor
from parser import Parser
from rules import ConstRule, Map, MapRule, SubPathRule, UrlRule, XPathRule
def is_list(obj):
return isinstance(obj, (list, tuple))
def is_str(obj):
return isinstance(obj, (str, unicode))
def parse_xpath_rule(line):
l = len(line)
if l == 2:
# Basi... | n6g7/scrapy-itemagic | itemagic/magic.py | Python | mit | 1,649 | 0.032141 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# workspace.py
#
# Copyright (c) 2014
# Author: Claudio Driussi <claudio.driussi@gmail.com>
#
from sqlalchemy.ext.declarative import declarative_base
from .db import *
class WorkSpace(object):
"""Encapsulate an whole SQLAlchemy orm from an DynaQ db definitio... | claudiodriussi/DynaQ | dynaq/workspace.py | Python | lgpl-3.0 | 5,345 | 0.002058 |
import json
from moto.core.responses import BaseResponse
from moto.core.utils import amzn_request_id
from .models import transcribe_backends
class TranscribeResponse(BaseResponse):
@property
def transcribe_backend(self):
return transcribe_backends[self.region]
@property
def request_params(se... | spulec/moto | moto/transcribe/responses.py | Python | apache-2.0 | 7,998 | 0.0005 |
# -*- coding: utf-8 -*-
#
# (c) Copyright 2003-2007 Hewlett-Packard Development Company, L.P.
#
# 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 opt... | Alberto-Beralix/Beralix | i386-squashfs-root/usr/share/hplip/base/mdns.py | Python | gpl-3.0 | 10,078 | 0.003671 |
def say_hello():
print 'Hello'
if __name__ == '__main__':
say_hello()
| MagicForest/Python | src/training/Core2/Chapter14ExecutionEnvironment/hello.py | Python | apache-2.0 | 88 | 0.022727 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from config.template_middleware import TemplateResponse
from gaecookie.decorator import no_csrf
from gaepermission.decorator import login_not_required
@login_not_required
@no_csrf
def index():
return TemplateResponse()
def insertStu... | SamaraCardoso27/eMakeup | backend/appengine/routes/home.py | Python | mit | 492 | 0.010163 |
import functools
import registration.views
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.conf import settings
import forms
def register(request):
'''Registration page for SSL auth without CA'''
next = request.GET.get(REDIRECT_FIELD_NAME, settings.LOGIN_REDIRECT_URL)
return registration.... | adieu/authentic2 | authentic2/auth2_auth/auth2_ssl/views.py | Python | agpl-3.0 | 462 | 0.008658 |
# -*- coding: utf-8 -*-
'''Twisted logging to Python loggin bridge.'''
'''
Kontalk Pyserver
Copyright (C) 2011 Kontalk Devteam <devteam@kontalk.org>
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 Foundat... | cgvarela/pyserverlib | kontalklib/logging.py | Python | gpl-3.0 | 1,793 | 0.003904 |
import unittest
import pickle
import pickletools
import copyreg
from test.support import TestFailed, TESTFN, run_with_locale
from pickle import bytes_types
# Tests that try a number of pickle protocols should have a
# for proto in protocols:
# kind of outer loop.
protocols = range(pickle.HIGHEST_PROTOCOL + 1)
... | mancoast/CPythonPyc_test | fail/301_pickletester.py | Python | gpl-3.0 | 35,665 | 0.001514 |
from django.views.generic import TemplateView
# All todos view
class Home( TemplateView ):
# Set the view template
template_name = 'index.html' | pombredanne/todomvc-django | todo/views.py | Python | mit | 148 | 0.033784 |
# -*- coding: utf-8 -*-
# Copyright 2015 Antiun Ingeniería S.L. - Antonio Espinosa
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': "Manage model export profiles",
'category': 'Personalization',
'version': '10.0.1.0.0',
'depends': [
'web',
],
'data': [
... | ovnicraft/server-tools | base_export_manager/__manifest__.py | Python | agpl-3.0 | 808 | 0 |
from __future__ import print_function
import numpy as np
h, l, c = np.loadtxt('data.csv', delimiter=',', usecols=(4, 5, 6), unpack=True)
N = 5
h = h[-N:]
l = l[-N:]
print("len(h)", len(h), "len(l)", len(l))
print("Close", c)
previousclose = c[-N -1: -1]
print("len(previousclose)", len(previousclose))
print("Previou... | moonbury/notebooks | github/Numpy/Chapter3/atr.py | Python | gpl-3.0 | 599 | 0.008347 |
# 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 under the... | levythu/swift | swift/common/storage_policy.py | Python | apache-2.0 | 33,131 | 0 |
#!/usr/bin/env python3
###
# (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# 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 t... | xod442/sample_scripts | get-xapi.py | Python | gpl-2.0 | 3,401 | 0.000588 |
import os
# Application constants
APP_NAME = 'job_offers'
INSTALL_DIR = os.path.dirname(os.path.abspath(__file__))
LOG_FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
LOG_NAME = os.path.join(INSTALL_DIR, 'job_offers.log')
# Testing fixtures
JOB_OFFER_FIXTURES = os.path.join(INSTALL_DIR, "fixtures/job_... | jvazquez/organization | organization/job_offers/constants.py | Python | unlicense | 334 | 0 |
from django import forms
from open-ehr.labs.models import PatientInfo
from open-ehr.registration.forms import *
from open-ehr.report_manager.models import *
from django.forms.widgets import CheckboxSelectMultiple
class PatientInfoForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
self.created_by = ... | saketkc/open-ehr-django | open-ehr-django-src/labs/forms.py | Python | lgpl-3.0 | 4,518 | 0.019478 |
#!/usr/bin/python
#
# Copyright: NFG, Paul Stevens <paul@nfg.nl>, 2005
# License: GPL
#
# $Id: autoreplier.py,v 1.4 2004/12/01 10:15:58 paul Exp $
#
# Reimplementation of the famous vacation tool for dbmail
#
#
import os,sys,string,email,getopt,shelve,time,re,smtplib
from dbmail.lib import DbmailAutoreply
def usag... | moveone/dbmail | python/bin/autoreplier.py | Python | gpl-2.0 | 3,784 | 0.026163 |
from typing import Dict
import random
from . import HardwareAdapter, POWER
from hedgehog.protocol.messages import io
class SimulatedHardwareAdapter(HardwareAdapter):
def __init__(self, *args, simulate_sensors=False, **kwargs):
super().__init__(*args, **kwargs)
self.simulate_sensors = simulate_se... | PRIArobotics/HedgehogServer | hedgehog/server/hardware/simulated.py | Python | agpl-3.0 | 2,565 | 0.00039 |
"""
WSGI config for django_shopfront project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJ... | rapilabs/django-shopfront | backend/django_shopfront/wsgi.py | Python | mit | 410 | 0 |
#
# Martin Kolman <mkolman@redhat.com>
#
# Copyright 2016 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# General Public License v.2. This program is distributed in the hope that it
# will be use... | M4rtinK/anaconda | tests/unit_tests/pyanaconda_tests/test_installation_tasks.py | Python | gpl-2.0 | 15,098 | 0.000795 |
# Copyright (c) 2012-2022, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
#
# *** Do not modify - this file is autogenerated ***
from . import AWSObject, AWSProperty, PropsDictType, Tags
from .validators import boolean
class DataResource(AWSProperty):
"""
`DataResour... | cloudtools/troposphere | troposphere/cloudtrail.py | Python | bsd-2-clause | 2,138 | 0.001871 |
"""
components/tools/OmeroPy/scripts/omero/import_scripts/Populate_Plate_Roi.py
Uses the omero.util.populate_roi functionality to parse all the
measurement files attached to a plate, and generate server-side
rois.
params:
Plate_ID: id of the plate which should be parsed.
Copyright 2009 Glencoe Software, Inc. All... | joshmoore/openmicroscopy | components/tools/OmeroPy/scripts/omero/import_scripts/Populate_ROI.py | Python | gpl-2.0 | 1,244 | 0.012862 |
#coding=utf-8
"""
parser.py
This contains the main Parser class that can be instantiated to create rules.
"""
from .rules import RuleMap
from .compat import basestring
class Parser(object):
"""
Parser exposes a couple methods for reading in strings.
Currently only parse_file is working.
... | erinxocon/Text-Parsing-Function-Dispatcher | tpfd/parser.py | Python | mit | 2,830 | 0.00424 |
from config import config, ConfigSlider, ConfigSubsection, ConfigYesNo, ConfigText, ConfigInteger
from SystemInfo import SystemInfo
from fcntl import ioctl
import os
import struct
# asm-generic/ioctl.h
IOC_NRBITS = 8L
IOC_TYPEBITS = 8L
IOC_SIZEBITS = 13L
IOC_DIRBITS = 3L
IOC_NRSHIFT = 0L
IOC_TYPESHIFT = IOC_NRSHIFT+I... | ACJTeam/enigma2 | lib/python/Components/InputDevice.py | Python | gpl-2.0 | 8,051 | 0.026581 |
# Copyright 2015 Isotoma 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 writing... | yaybu/touchdown | touchdown/aws/route53/alias_target.py | Python | apache-2.0 | 689 | 0 |
# Copyright (C) 2011 Lars Wirzenius
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed i... | perryl/morph | cliapp/__init__.py | Python | gpl-2.0 | 1,188 | 0 |
import argparse
import logging
from typing import List, Optional
from redis import StrictRedis
from minique.compat import sentry_sdk
from minique.work.worker import Worker
def get_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser()
parser.add_argument("-u", "--redis-url", required=True)
... | valohai/minique | minique/cli.py | Python | mit | 1,399 | 0.000715 |
from __future__ import print_function, unicode_literals
import os
import shutil
import zipfile
import datetime
import tempfile
import subprocess
from copy import deepcopy
import pytest
import numpy as np
from numpy.testing import assert_almost_equal
from sklearn.dummy import DummyClassifier
from destimator import De... | rainforestapp/destimator | destimator/tests/test.py | Python | mit | 7,733 | 0.001681 |
#! /usr/bin/env python
import requests
import sys
import urllib
from requests.auth import HTTPBasicAuth
if len(sys.argv) != 5:
print "usage: verify-topo-links onos-node cluster-id first-index last-index"
sys.exit(1)
node = sys.argv[1]
cluster = sys.argv[2]
first = int(sys.argv[3])
last = int(sys.argv[4])
f... | planoAccess/clonedONOS | tools/test/scenarios/bin/verify-topo-devices.py | Python | apache-2.0 | 1,143 | 0.002625 |
#############################
##
## The Squire module
##
## (C) Christopher Woods
##
import Sire.MM
import Sire.System
from Sire.Squire._Squire import *
| michellab/Sire | wrapper/Squire/__init__.py | Python | gpl-2.0 | 155 | 0.012903 |
"""
Телефонен указател
Задачата е да се напишат функции, които работят като телефонен указател.
Телефонният указател трябва да се съхранява във файл.
Телефоните се представят като речник с две полете:
- `name` - име на човек
- `phone` - телефоне номер
Например:
{
'name': 'Ivan',
'phone': '... | YAtOff/python0-reloaded | projects/hard/phonebook/phonebook.py | Python | mit | 5,283 | 0.000934 |
from cStringIO import StringIO
from twisted.internet.defer import fail, succeed
from twisted.web.error import Error
from juju.errors import FileNotFound, ProviderError, ProviderInteractionError
from juju.lib.testing import TestCase
from juju.providers.orchestra import MachineProvider
from .test_digestauth import Get... | anbangr/trusted-juju | juju/providers/orchestra/tests/test_files.py | Python | agpl-3.0 | 6,631 | 0 |
#!/usr/bin/python -u
from __future__ import absolute_import
from __future__ import print_function
#
# droiddemo.py, Copyright 2010-2013, The Beanstalks Project ehf.
# http://beanstalks-project.net/
#
# This is a proof-of-concept PageKite enabled HTTP server for Android.
# It has bee... | pagekite/PyPagekite | droiddemo.py | Python | agpl-3.0 | 4,921 | 0.009348 |
import py
try:
from pypy.rpython.test.test_llinterp import interpret
except ImportError:
py.test.skip('Needs PyPy to be on the PYTHONPATH')
from rply import ParserGenerator, Token
from rply.errors import ParserGeneratorWarning
from .base import BaseTests
from .utils import FakeLexer, BoxInt, ParserState
cl... | solanolabs/rply | tests/test_ztranslation.py | Python | bsd-3-clause | 2,200 | 0.000455 |
# -*- coding: utf-8 -*-
"""
Enchants
- CurrencyTypes.dbc
"""
from .. import *
class Currency(Model):
pass
class CurrencyTooltip(Tooltip):
def tooltip(self):
self.append("name", self.obj.getName())
self.append("description", self.obj.getDescription(), color=YELLOW)
return self.flush()
Currency.Tooltip = C... | jleclanche/pywow | game/currencies/__init__.py | Python | cc0-1.0 | 702 | 0.029915 |
import unittest
from unittest2 import skip
from numpy import alltrue, arange
from enable.compiled_path import CompiledPath
# Chaco imports
from chaco.api import (ArrayDataSource, ColormappedScatterPlot, DataRange1D,
LinearMapper, PlotGraphicsContext, jet)
class TestColormappedScatterplot(unit... | tommy-u/chaco | chaco/tests/test_colormapped_scatterplot.py | Python | bsd-3-clause | 2,802 | 0 |
# Copyright 2017 by Notmail Bot contributors. All rights reserved.
#
# This file is part of Notmail Bot.
#
# Notmail Bot 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 Lice... | ManuelLR/Notmail_Bot | repository/repository.py | Python | gpl-3.0 | 4,697 | 0.00149 |
#! usr/bin/python
from __future__ import print_function, division, absolute_import
from os import remove
from os.path import join, abspath
from sys import stdout, exit
from time import time
import multiprocessing as mp
from argparse import ArgumentParser
import logging
import numpy as np
from disvis import DisVis, PD... | haddocking/disvis | disvis/main.py | Python | apache-2.0 | 23,344 | 0.004112 |
# -*- coding: utf-8 -*-
'''
Copyright 2015 by Tobias Houska
This file is part of Statistical Parameter Estimation Tool (SPOTPY).
:author: Tobias Houska
This class holds the example code from the getting_started web-documention.
'''
from __future__ import print_function, division, absolute_import, unicode_literals
# G... | thouska/spotpy | spotpy/examples/getting_started.py | Python | mit | 1,975 | 0.013671 |
#!/usr/bin/env python
#
# Copyright 2013 Tim O'Shea
#
# This file is part of PyBOMBS
#
# PyBOMBS 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, or (at your option)
# any later version.
#
# P... | scalable-networks/ext | pybombs/app_store.py | Python | gpl-2.0 | 5,226 | 0.020666 |
from .fetch import FetchParser
from .json_ld import JsonLdParser
from .lom import LomParser
from .lrmi import LrmiParser
from .nsdl_dc import NsdlDcParser
__all__ = [
'FetchParser',
'JsonLdParser',
'LomParser',
'LrmiParser',
'NsdlDcParser',
]
| navnorth/LR-Data | src/payload_schema/__init__.py | Python | apache-2.0 | 265 | 0 |
# coding=utf-8
import json
import re
import responses
import pytest
import mapbox
def test_geocoder_default_name():
"""Default name is set"""
geocoder = mapbox.Geocoder()
assert geocoder.name == 'mapbox.places'
def test_geocoder_name():
"""Named dataset name is set"""
geocoder = mapbox.Geocode... | ravik/mapbox-baseSDK | tests/test_geocoder.py | Python | mit | 12,916 | 0.004026 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Projet : Editeur, Compilateur et Micro-Ordinateur pour
un langage assembleur.
Nom du fichier : 04-02-CPU.py
Identification : 04-02-CPU
Titre : CPU
Auteurs : Francis Emond, Malek Khattech,
... | MarcAndreJean/PCONC | Modules/04-02-CPU.py | Python | mit | 15,906 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-07 02:11
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('inventory', '0001_initial'),
]
operations = [
migrations.AlterField(
... | kkoci/orthosie | inventory/migrations/0002_auto_20151206_2111.py | Python | gpl-3.0 | 438 | 0 |
# Copyright (c) 2012 The Khronos Group Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publ... | KhronosGroup/COLLADA-CTS | StandardDataSets/collada/library_visual_scenes/visual_scene/node/_reference/_reference_node_translate_xyz_cube/_reference_node_translate_xyz_cube.py | Python | mit | 3,826 | 0.007057 |
"""
This package contains tests for the Multichain community in Tribler.
"""
| MaxVanDeursen/tribler | Tribler/Test/Community/Multichain/__init__.py | Python | lgpl-3.0 | 77 | 0 |
#!/usr/bin/env python3
# -*- coding: utf8 -*-
import tweepy
consumer_key = ""
consumer_secret = ""
access_token = ""
access_token_secret = ""
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
def tdata():
userid = st... | zhangyubaka/tweepy_favbot | bot.py | Python | mit | 923 | 0.006501 |
# -*- 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-datacatalog | samples/generated_samples/datacatalog_v1_generated_data_catalog_modify_entry_overview_sync.py | Python | apache-2.0 | 1,496 | 0.000668 |
from django.http import HttpResponseBadRequest, HttpResponse
"""
Build custom decorators for your views if you find that you are repeating
the same checks in multiple views.
"""
def ajax_required(f):
def wrap(request, *args, **kwargs):
if not request.is_ajax():
#return HttpResponse("hi")
... | hiteshgarg14/Django-Social-Website | bookmarks/common/decorators.py | Python | mit | 478 | 0.004184 |
# Copyright 2012 Hewlett-Packard Development Company, L.P.
#
# 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... | gforcada/jenkins-job-builder | jenkins_jobs/sphinx/yaml.py | Python | apache-2.0 | 4,991 | 0 |
#!/usr/bin/env python
# Copyright 2021 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.
# This is generated, do not edit. Update BuildConfigGenerator.groovy and
# 3ppFetch.template instead.
from __future__ import print_fun... | nwjs/chromium.src | third_party/android_deps/libs/com_google_firebase_firebase_messaging/3pp/fetch.py | Python | bsd-3-clause | 1,389 | 0.00072 |
import pwny
def setup():
pwny.target.assume(pwny.Target(arch=pwny.Target.Arch.x86))
| sigma-random/pwnypack | tests/__init__.py | Python | mit | 90 | 0 |
class Class(object):
pass
def func():
return 3.14
CONSTANT = 42
| retoo/pystructure | tests/python/typeinference/import_star_definitions.py | Python | lgpl-2.1 | 74 | 0.027027 |
#!/usr/bin/env python3
from heapq import heapify, heappop, heappush
with open('NUOC.INP') as f:
m, n = map(int, f.readline().split())
height = [[int(i) for i in line.split()] for line in f]
queue = ([(h, 0, i) for i, h in enumerate(height[0])]
+ [(h, m - 1, i) for i, h in enumerate(height[-1])]
... | McSinyx/hsg | others/other/nuoc.py | Python | gpl-3.0 | 941 | 0.002125 |
import requests
from tel_types import User, Message, Update, UserProfilePhotos
import time
base_url = 'https://api.telegram.org/bot'
class Telegram:
def __init__(self, token):
self.call_url = base_url + token + '/'
self.token = token
self.req_timeout = 5
self.text_limit = 4096
self.last_error = ''
self.... | srijanrodo/telegram-bots-python-api | telegram.py | Python | gpl-2.0 | 8,175 | 0.050765 |
from indivo.models import Record, Demographics
from base import *
class TestRecord(TestModel):
model_fields = ['label', 'demographics', 'owner', 'external_id']
model_class = Record
def _setupargs(self, label, demographics=None, owner=None, external_id=None, extid_principal_key=None):
self.label = ... | sayan801/indivo_server | indivo/tests/data/record.py | Python | gpl-3.0 | 1,535 | 0.013029 |
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import json
import os
from sheetsite.site_queue import app
import smtplib
@app.task
def notify_one(email, subject, page, text):
print("send [%s] / %s / %s" % (email, subject, page))
server_ssl = smtplib.SMTP_SSL("smtp.gmail.... | paulfitz/sheetsite | sheetsite/tasks/notify.py | Python | mit | 2,767 | 0.001084 |
############################ Copyrights and license ############################
# #
# Copyright 2020 Raju Subramanian <coder@mahesh.net> #
# ... | ahmad88me/PyGithub | github/GithubApp.py | Python | lgpl-3.0 | 6,426 | 0.004669 |
#
# Proximate - Peer-to-peer social networking
#
# Copyright (c) 2008-2011 Nokia Corporation
#
# All rights reserved.
#
# This software is licensed under The Clear BSD license.
# See the LICENSE file for more details.
#
from gobject import timeout_add_seconds, source_remove
from random import random, randrange
from tim... | proximate/proximate | messageboard.py | Python | bsd-3-clause | 15,997 | 0.002688 |
# 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... | openstack/python-muranoclient | muranoclient/tests/unit/osc/v1/fakes.py | Python | apache-2.0 | 823 | 0 |
def forenkling(a,b):
while b!=0:
gammel_b=b
b=a%b
a=gammel_b
#print(a,b)
return a
print(forenkling(30,20))
print(forenkling(10,2))
def gcd(a,b):
a=forenkling(a,b)
return a
def reduce_fraction(a,b):
divisor=forenkling(a,b)
a=int(a/diviso... | TorleifHensvold/ITGK3 | Oving5/torleif/07_Forenkling_av_brøker.py | Python | mit | 706 | 0.04416 |
# -*- coding: utf-8 -*-
"""The application's model objects"""
from zope.sqlalchemy import ZopeTransactionExtension
from sqlalchemy.orm import scoped_session, sessionmaker
#from sqlalchemy import MetaData
from sqlalchemy.ext.declarative import declarative_base
# Global session manager: DBSession() returns the Thread-l... | LamCiuLoeng/vat | vatsystem/model/__init__.py | Python | mit | 2,266 | 0.004854 |
# -*- coding:utf-8 -*-
"""
Description:
Issue Transaction
Usage:
from AntShares.Core.IssueTransaction import IssueTransaction
"""
from AntShares.Core.AssetType import AssetType
from AntShares.Helper import *
from AntShares.Core.Transaction import Transaction
from AntShares.Core.TransactionType import Transactio... | AntSharesSDK/antshares-python | sdk/AntShares/Core/IssueTransaction.py | Python | apache-2.0 | 922 | 0 |
import sys
import logging
import profile
import pstats
try:
import cStringIO as StringIO
StringIO # pyflakes
except ImportError:
import StringIO
from instrumenting import utils
class BaseProfilingHandler(utils.InstrumentingHandler):
"""
Python logging handler which profiles code.
It can al... | rpatterson/instrumenting | src/instrumenting/profilehandler.py | Python | gpl-2.0 | 4,513 | 0.000886 |
print("hello world!")
| Pyroseza/Random | test.py | Python | mit | 23 | 0.043478 |
import ConfigParser
import os.path
import ast
DEFAULT_CONF_FILE = '/etc/unbound/unbound_ec2.conf'
DEFAULT_AWS_REGION = 'us-west-1'
DEFAULT_ZONE = 'zone.tld'
DEFAULT_REVERSE_ZONE = '127.in-addr.arpa'
DEFAULT_TTL = '300'
DEFAULT_CACHE_TTL = '30'
DEFAULT_SERVER_TYPE = 'caching'
DEFAULT_LOOKUP_TYPE = 'cache'
DEFAULT_LOOKU... | unibet/unbound-ec2 | unbound_ec2/config.py | Python | isc | 3,425 | 0.00438 |
"""
Module to set up run time parameters for Clawpack.
The values set in the function setrun are then written out to data files
that will be read in by the Fortran code.
"""
import os
from pyclaw import data
#------------------------------
def setrun(claw_pkg='classic'):
#------------------------------
... | clawpack/clawpack-4.x | doc/sphinx/example-acoustics-2d/1drad/setrun.py | Python | bsd-3-clause | 5,754 | 0.012165 |
#!/usr/bin/env python
# Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. ... | golden1232004/webrtc_new | tools/python_charts/webrtc/main.py | Python | gpl-3.0 | 6,301 | 0.011903 |
import sys
from os.path import dirname
import drain.step, drain.serialize
from drain.drake import is_target_filename, is_step_filename
if len(sys.argv) == 1:
raise ValueError('Need at least one argument')
args = sys.argv[1:]
drain.PATH = dirname(dirname(dirname(args[0])))
if is_target_filename(args[0]):
ou... | potash/drain | bin/run_step.py | Python | mit | 692 | 0.001445 |
#! /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,sys
from waflib.Tools import ccroot,ar,gcc
from waflib.Configure import conf
@conf
def find_icc(conf):
if sys.platform=='cygwin':
conf.fatal('The Intel ... | bit-trade-one/SoundModuleAP | lib-src/lv2/sratom/waflib/Tools/icc.py | Python | gpl-2.0 | 890 | 0.057303 |
#Java/SQL stuff
from java.lang import *
#Grinder stuff
from net.grinder.script.Grinder import grinder
from net.grinder.script import Test
#misc
import time
import sys
#project specific
from framework import TSdata_w, TSdata_h, importstrs
#import relevant t_DATABASENAME depending on settings in grinder.properties
in... | sagark/tsdb-perf-test | tests/insertlongstream.py | Python | bsd-2-clause | 1,776 | 0.013514 |
class YamlFileNames(object):
rules = 'rules.yaml'
parsers = 'parsers.yaml'
default_log_types = 'log_types.yaml'
unix_log_types = 'unix_log_types.yaml'
windows_log_types = 'windows_log_types.yaml'
settings = 'settings.yaml'
| epawlowska/whylog | whylog/config/consts.py | Python | bsd-3-clause | 247 | 0 |
import codecs
from setuptools import setup
VERSION = '0.2.0'
def read_long_description():
long_desc = []
with codecs.open('README.rst', 'r', 'utf8') as longdesc:
long_desc.append(longdesc.read())
with codecs.open('HISTORY.rst', 'r', 'utf8') as history:
long_desc.append(history.read())
... | scardine/image_size | setup.py | Python | mit | 776 | 0.001289 |
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""ChromeOS image pusher (from cbuildbot to signer).
This pushes files from the archive bucket to the signer bucket and marks
artifacts for signing (... | bpsinc-native/src_third_party_chromite | scripts/pushimage.py | Python | bsd-3-clause | 18,246 | 0.006577 |
# WARPnet Client<->Server Architecture
# WARPnet Parameter Definitions
#
# Author: Siddharth Gupta
import struct, time
from warpnet_common_params import *
from warpnet_client_definitions import *
from twisted.internet import reactor
import binascii
# Struct IDs
STRUCTID_CONTROL = 0x13
STRUCTID_CONTROL_ACK = 0x14
STR... | shailcoolboy/Warp-Trinity | ResearchApps/Measurement/examples/TxPower_vs_BER/warpnet_experiment_structs.py | Python | bsd-2-clause | 5,510 | 0.023775 |
from django import forms
from django.contrib.auth import get_user_model
from django.contrib.auth.forms import ReadOnlyPasswordHashField
from django.utils.translation import ugettext_lazy as _
User = get_user_model()
class AdminUserCreationForm(forms.ModelForm):
password1 = forms.CharField(label='Password', widg... | kasper190/SPAforum | accounts/forms.py | Python | mit | 2,436 | 0.002053 |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Lic... | amenonsen/ansible | lib/ansible/modules/network/fortios/fortios_system_email_server.py | Python | gpl-3.0 | 12,462 | 0.001284 |
import json
from functools import reduce
from typing import Optional
from asyncpg import Connection
from qllr.common import DATETIME_FORMAT, clean_name, convert_timestamp_to_tuple
from qllr.db import cache
from qllr.exceptions import MatchNotFound, PlayerNotFound
from qllr.settings import MOVING_AVG_COUNT
async def... | em92/quakelive-local-ratings | qllr/blueprints/player/methods.py | Python | agpl-3.0 | 6,371 | 0.000942 |
# -*- coding: utf-8 -*-
"""
logbook.notifiers
~~~~~~~~~~~~~~~~~
System notify handlers for OSX and Linux.
:copyright: (c) 2010 by Armin Ronacher, Christopher Grebs.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
import base64
from time import time
from logbook.base import N... | pombredanne/logbook | logbook/notifiers.py | Python | bsd-3-clause | 11,853 | 0.000169 |
#!/usr/bin/env python
# encoding: utf-8
"""
release_push.py
Created by Jonathan Burke on 2013-12-30.
Copyright (c) 2015 University of Washington. All rights reserved.
"""
#See README-maintainers.html for more information
from release_vars import *
from release_utils import *
from sanity_checks import *
import urll... | SoftwareEngineeringToolDemos/ICSE-2011-Checker-Framework | release/release_push.py | Python | gpl-2.0 | 24,373 | 0.020843 |
from django.test import SimpleTestCase
from corehq.apps.export.const import USERNAME_TRANSFORM
from corehq.apps.export.models import (
DocRow,
RowNumberColumn,
PathNode,
ExportRow,
ScalarItem,
ExportColumn,
TableConfiguration,
)
class TableConfigurationTest(SimpleTestCase):
def test_... | qedsoftware/commcare-hq | corehq/apps/export/tests/test_table_configuration.py | Python | bsd-3-clause | 10,403 | 0.000481 |
# -*- coding: utf-8 -*-
#
# gPodder - A media aggregator and podcast client
# Copyright (c) 2005-2014 Thomas Perl and the gPodder Team
#
# gPodder 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... | somini/gpodder | src/gpodder/query.py | Python | gpl-3.0 | 5,258 | 0.001331 |
from greenlet import greenlet
import os
from sandbox import Sandbox, SandboxConfig
from redux.internal.exceptions import RobotDeathException
import traceback
# this is just for testing
LOADER_CODE_TEST = """
import time
while True:
try:
print 'running... %s' % str(rc)
time.sleep(1)
print 'd... | trun/redux | redux/internal/scheduler.py | Python | mit | 5,911 | 0.00203 |
# coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from datetime import datetime
from azure.core import credentials
import pytest
import six
import time
from azure.containerregistry import (
Repositor... | Azure/azure-sdk-for-python | sdk/containerregistry/azure-containerregistry/tests/test_container_registry_client.py | Python | mit | 23,434 | 0.004139 |
from django.conf.urls import patterns, include, url
from django.contrib.sitemaps import Sitemap
from django.views.generic import TemplateView
from django.contrib import admin
from {{ project_name }}.views import HomePageView, ContactPageView, RobotPageView, HumanPageView
from {{ project_name }}.sitemap import BlogSitem... | vandorjw/django-template-project | project/project_name/urls.py | Python | mit | 1,221 | 0.005733 |
#!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, Yujin Robot
# 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 r... | CARMinesDouai/MultiRobotExplorationPackages | inria_demo/scripts/autodock_client.py | Python | mit | 3,861 | 0.019684 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2015 Therp BV <http://therp.nl>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of th... | cgstudiomap/cgstudiomap | main/parts/web/web_widget_x2many_2d_matrix/__openerp__.py | Python | agpl-3.0 | 1,516 | 0 |
# Code in this file is copied and adapted from
# https://github.com/openai/evolution-strategies-starter.
import gym
import numpy as np
import tree
import ray
import ray.experimental.tf_utils
from ray.rllib.agents.es.es_tf_policy import make_session
from ray.rllib.models import ModelCatalog
from ray.rllib.policy.polic... | richardliaw/ray | rllib/agents/ars/ars_tf_policy.py | Python | apache-2.0 | 4,456 | 0 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
import os
import waterdemand
basepath = waterdemand.__path__[0]
path = os.path.join(basepath, "docs", "latex")
cwd = os.getcwd()
os.chdir(path)
modules = ["userguide"]
for module ... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/waterdemand/docs/latex/build_docs.py | Python | gpl-2.0 | 1,657 | 0.007846 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Ref: http://doc.qt.io/qt-5/modelview.html#2-1-a-read-only-table
import sys
from PyQt5.QtCore import Qt, QAbstractTableModel, QVariant
from PyQt5.QtWidgets import QApplication, QTableView, QVBoxLayout, QWidget
class MyModel(QAbstractTableModel):
def __init__(self... | jeremiedecock/snippets | python/pyqt/pyqt5/widget_QTableView_share_selection_in_two_views.py | Python | mit | 1,608 | 0.003109 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-07 20:55
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('questio... | MauricioDinki/hatefull | hatefull/apps/answers/migrations/0001_initial.py | Python | bsd-3-clause | 1,380 | 0.003623 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.