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 |
|---|---|---|---|---|---|---|
from __future__ import unicode_literals
from django.forms import MediaDefiningClass, Media
from django.forms.utils import flatatt
from django.utils.text import slugify
from django.utils.safestring import mark_safe
from django.utils.six import text_type
from django.utils.six import with_metaclass
from wagtail.utils.c... | WQuanfeng/wagtail | wagtail/wagtailadmin/menu.py | Python | bsd-3-clause | 4,777 | 0.002303 |
from django.db import models
class ThingItem(object):
def __init__(self, value, display):
self.value = value
self.display = display
def __iter__(self):
return (x for x in [self.value, self.display])
def __len__(self):
return 2
class Things(object):
def __iter__(se... | atruberg/django-custom | tests/model_validation/models.py | Python | bsd-3-clause | 614 | 0 |
#!/usr/bin/python
#
# $Id: LISP-Sonar.py 18 2014-10-06 13:23:37Z ggx $
#
# -------------------------------Important Marks-------------------------------
# Surprisingly, we found that when manually executing the current Python script,
# the point symbol in file path is recognized,but not recognized when called via NEPI... | hansomesong/First_LISP_measurement | LISP-Sonar.py | Python | gpl-2.0 | 9,113 | 0.006145 |
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import os
import warnings
from pymatgen.core.structure import Structure
from pymatgen.core.units import Ha_to_eV, bohr_to_ang
from pymatgen.io.abinit.abiobjects import *
from pymatgen.util.testing import PymatgenTest
class ... | vorwerkc/pymatgen | pymatgen/io/abinit/tests/test_abiobjects.py | Python | mit | 7,463 | 0.000804 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Point of Sale',
'version': '1.0.1',
'category': 'Point Of Sale',
'sequence': 20,
'summary': 'Touchscreen Interface for Shops',
'description': """
Quick and Easy sale process
===========... | chienlieu2017/it_management | odoo/addons/point_of_sale/__manifest__.py | Python | gpl-3.0 | 2,501 | 0.0012 |
# -*- coding: utf-8 -*-
#
import datetime
import hashlib
import json
import logging
import random
import string
import time
import urllib.request
import xml.etree.ElementTree as ET
from LostAndFound.settings import WECHAT_TOKEN, WECHAT_APPID, WECHAT_SECRET
from django.http import Http404, HttpResponse
from django.temp... | zzz14/LOST-FOUND | wechat/wrapper.py | Python | gpl-3.0 | 10,069 | 0.002582 |
from yowsup.layers import YowLayer, YowLayerEvent, YowProtocolLayer
from .protocolentities import *
class YowIbProtocolLayer(YowProtocolLayer):
def __init__(self):
handleMap = {
"ib": (self.recvIb, self.sendIb),
"iq": (None, self.sendIb)
}
super(YowIbProtocolLayer, s... | felix-dumit/campusbot | yowsup2/yowsup/layers/protocol_ib/layer.py | Python | mit | 861 | 0.002323 |
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Bar',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False,... | nesdis/djongo | tests/django_tests/tests/v22/tests/admin_scripts/app_waiting_migration/migrations/0001_initial.py | Python | agpl-3.0 | 434 | 0.002304 |
import datetime
import release
def test_release():
rel = release.Release("mysql-3.23.22-beta", "1234-05-06")
print(vars(rel))
assert vars(rel) == {
"raw_label": "mysql-3.23.22-beta",
"raw_date": "1234-05-06",
"majormin": "3.23",
"pre": "mysql-",
"post": ".22-beta",... | johntellsall/shotglass | dec/test_release.py | Python | mit | 380 | 0 |
# -*- coding: utf-8 -*-
class Solution(object):
''' https://leetcode.com/problems/count-primes/
'''
def countPrimes(self, n):
if n <= 2:
return 0
is_prime = [True] * n
ret = 0
for i in range(2, n):
if not is_prime[i]:
continue
... | lycheng/leetcode | others/count_primes.py | Python | mit | 488 | 0 |
#=======================================================================
# RegIncrSC.py
#=======================================================================
from pymtl import *
class RegIncrSC( SystemCModel ):
sclinetrace = True
def __init__( s ):
s.in_ = InPort ( Bits(32) )
s.out = OutPort( Bi... | cornell-brg/pymtl | pymtl/tools/integration/systemc_tests/sequential/RegIncrSC.py | Python | bsd-3-clause | 446 | 0.049327 |
import time, os
from autotest.client import test, os_dep, utils
from autotest.client.shared import error
class btreplay(test.test):
version = 1
# http://brick.kernel.dk/snaps/blktrace-git-latest.tar.gz
def setup(self, tarball = 'blktrace-git-latest.tar.gz'):
tarball = utils.unmap_url(self.bindir,... | nacc/autotest | client/tests/btreplay/btreplay.py | Python | gpl-2.0 | 4,454 | 0.003368 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Tests various schema replication scenarios
#
# Copyright (C) Kamen Mazdrashki <kamenim@samba.org> 2011
#
# 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 Fou... | lidan-fnst/samba | source4/torture/drs/python/replica_sync.py | Python | gpl-3.0 | 36,840 | 0.004642 |
# Module 'ntpath' -- common operations on WinNT/Win95 pathnames
"""Common pathname manipulations, WindowsNT/95 version.
Instead of importing this module directly, import os and refer to this
module as os.path.
"""
import os
import sys
import stat
import genericpath
import warnings
from genericpath impor... | ktan2020/legacy-automation | win/Lib/ntpath.py | Python | mit | 18,605 | 0.002634 |
#!/usr/bin/python
import urllib
print dir(urllib)
help(urllib.urlopen)
| richardcardona/learnpython-exercises | dirhelp.py | Python | apache-2.0 | 75 | 0.013333 |
#!/usr/bin/python
#
# Copyright (c) 2017 Zim Kalinowski, <zikalino@microsoft.com>
# Copyright (c) 2019 Matti Ranta, (@techknowlogick)
#
# 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
AN... | ilpianista/ansible | test/support/integration/plugins/modules/azure_rm_mariadbdatabase_info.py | Python | gpl-3.0 | 6,304 | 0.001904 |
#
# Copyright (C) 2013 Uninett AS
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 3 as published by
# the Free Software Foundation.
#
# This program is distributed in the hope... | hmpf/nav | python/nav/web/messages/urls.py | Python | gpl-3.0 | 1,573 | 0.000636 |
#!/usr/bin/env python
""" cdecl.py - parse c declarations
(c) 2002, 2003, 2004, 2005 Simon Burton <simon@arrowtheory.com>
Released under GNU LGPL license.
version 0.xx
"""
import string
class Node(list):
" A node in a parse tree "
def __init__(self,*items,**kw):
list.__init__( self, items )
... | jpflori/mpir | yasm/tools/python-yasm/pyxelator/node.py | Python | gpl-3.0 | 8,966 | 0.019295 |
import json, logging, os, re, subprocess, shlex
from tools import get_category_by_status
log = logging.getLogger()
meta_files = ['Disassembly', 'Stacktrace', 'Registers',
'SegvAnalysis', 'ProcMaps', "BootLog" , "CoreDump",
"BootDmesg", "syslog", "UbiquityDebug.gz", "Casper.gz",
"UbiquityPar... | jfoote/vulture | vlib/analyzers/reproducibility.py | Python | mit | 2,072 | 0.005309 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from ..config import BaseAnsibleContainerConfig
from ..utils.visibility import getLogger
logger = getLogger(__name__)
class K8sBaseConfig(BaseAnsibleContainerConfig):
@property
def image_namespace(self):
namespace = self.project_name
... | chouseknecht/ansible-container | container/k8s/base_config.py | Python | lgpl-3.0 | 932 | 0.001073 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from . import NeuralLayer
from deepy.utils import build_activation, FLOATX
import numpy as np
import theano
import theano.tensor as T
from collections import OrderedDict
OUTPUT_TYPES = ["sequence", "one"]
INPUT_TYPES = ["sequence", "one"]
class RNN(NeuralLayer):
"""
... | rldotai/deepy | deepy/layers/recurrent.py | Python | mit | 6,446 | 0.003258 |
"""
Utility Mixins for unit tests
"""
import json
import sys
from django.conf import settings
from django.urls import clear_url_caches, resolve
from django.test import TestCase
from mock import patch
from util.db import CommitOnSuccessManager, OuterAtomic
class UrlResetMixin(object):
"""Mixin to reset urls.py ... | philanthropy-u/edx-platform | common/djangoapps/util/testing.py | Python | agpl-3.0 | 6,042 | 0.001159 |
#! /usr/bin/env python2
import rift
rift.init("main.so")
print(rift.call(lib.main, rift.c_int))
| Yayg/rift | tests/Acceptance_Tests/main.py | Python | mit | 97 | 0 |
# -*- coding: utf-8 -*-
# --------------------------------------------------
# Задача 1
# --------------------------------------------------
"""
Напишите функцию-генератор, которая будет принимать
последовательность, где каждый элемент кортеж с двумя
значениями (длинна катетов треугольника) и возвращать
длинну гипотен... | greggy/pylessons | exam12.py | Python | lgpl-2.1 | 2,149 | 0.005573 |
from __future__ import annotations
import contextlib
import os
from typing import Generator
from typing import Sequence
from pre_commit.envcontext import envcontext
from pre_commit.envcontext import PatchesT
from pre_commit.envcontext import Var
from pre_commit.hook import Hook
from pre_commit.languages import helper... | pre-commit/pre-commit | pre_commit/languages/coursier.py | Python | mit | 2,157 | 0 |
import time
import threading
import logging
import serial
import io
import sim900
import sys
if __name__ == "__main__":
#this is a bad file for recording the diode temps and voltages
#eventually it will be merged with recording the resistance bridges
#and actually use the sim900 file functions
#cre... | ColumbiaCMB/kid_readout | kid_readout/equipment/record_all_old.py | Python | bsd-2-clause | 2,287 | 0.006996 |
import virtool.subtractions.files
from sqlalchemy import select
from virtool.subtractions.models import SubtractionFile
async def test_create_subtraction_files(snapshot, tmp_path, pg, pg_session):
test_dir = tmp_path / "subtractions" / "foo"
test_dir.mkdir(parents=True)
test_dir.joinpath("subtraction.fa.g... | igboyes/virtool | tests/subtractions/test_files.py | Python | mit | 775 | 0 |
import _plotly_utils.basevalidators
class ViolinmodeValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(self, plotly_name="violinmode", parent_name="layout", **kwargs):
super(ViolinmodeValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name... | plotly/python-api | packages/python/plotly/plotly/validators/layout/_violinmode.py | Python | mit | 516 | 0.001938 |
# Configuration file for ipython-qtconsole.
c = get_config()
#------------------------------------------------------------------------------
# IPythonQtConsoleApp configuration
#------------------------------------------------------------------------------
# IPythonQtConsoleApp will inherit config from: BaseIPythonA... | dwwkelly/configs | srv/salt/laptop/config/ipython/profile_default/ipython_qtconsole_config.py | Python | gpl-2.0 | 23,719 | 0.003289 |
import logging
import socket
from functools import wraps
from django.conf import settings
from django.http import (
Http404,
HttpResponse,
HttpResponseForbidden,
HttpResponseRedirect
)
from django.shortcuts import render
from django.utils.http import is_safe_url
from django.views.decorators.cache impor... | DESHRAJ/fjord | fjord/base/views.py | Python | bsd-3-clause | 6,831 | 0 |
# Copyright 2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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.
#
... | trdean/grEME | gr-video-sdl/python/video_sdl/__init__.py | Python | gpl-3.0 | 1,138 | 0.004394 |
#!/usr/bin/env python
#encoding:utf-8
import os
import sys
import requests
import MySQLdb
from bs4 import BeautifulSoup
from bs4 import SoupStrainer
if len(sys.argv) != 4:
print 'Invalid parameters!'
exit(1)
print '=' * 60
print 'start:', sys.argv
aim_category_id = int(sys.argv[1])
start_point = (int(sys.ar... | JayvicWen/Crawler | 3che/crawler.py | Python | mit | 4,816 | 0.004156 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "huntnet.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| srohatgi/cloud | huntnet/manage.py | Python | apache-2.0 | 250 | 0 |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
from ggrc import db
from ggrc.models.mixins import CustomAttributable, BusinessObject, Timeboxed
from ggrc.models.object_document import Documentable
from ggrc.models.object_person import Personable
from ggr... | edofic/ggrc-core | src/ggrc_risks/models/threat.py | Python | apache-2.0 | 847 | 0.004723 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('member', '0007_auto_20150501_2124'),
]
operations = [
migrations.AddField(
model_name='member',
name... | mozillazg/chendian-plus | chendian/member/migrations/0008_auto_20150502_1013.py | Python | mit | 697 | 0.002869 |
"""
I came up with this the first try. So, that's why this is posted in duplicate.
"""
import sys
try:
columns = int(input("How many columns? "))
rows = int(input("How many rows? "))
tall = int(input("How tall should the boxes be? "))
wide = int(input("How wide should the boxes be? "))
except Excepti... | MattD830/Python-INFO1-CE9990 | graphpaper2.py | Python | gpl-3.0 | 968 | 0.007231 |
def extractTranslasiSanusiMe(item):
'''
Parser for 'translasi.sanusi.me'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loiterous', '... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractTranslasiSanusiMe.py | Python | bsd-3-clause | 550 | 0.034545 |
# -*- coding: UTF-8 -*-
# CCcam Info by AliAbdul
from base64 import encodestring
from os import listdir, remove, rename, system, path
from enigma import eListboxPythonMultiContent, eTimer, gFont, loadPNG, RT_HALIGN_RIGHT, getDesktop
from Components.ActionMap import ActionMap, NumberActionMap
from Components.config im... | kingvuplus/PKT-gui2 | lib/python/Screens/CCcamInfo.py | Python | gpl-2.0 | 51,455 | 0.030609 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2016-11-28 13:41
# flake8: noqa
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import normandy.recipes.validators
class Migration(mi... | Osmose/normandy | recipe-server/normandy/recipes/migrations/0034_recipe_revisions.py | Python | mpl-2.0 | 3,780 | 0.002646 |
"""
Creates a list of studies currently being used for synthesis.
"""
import re
#from stephen_desktop_conf import *
from microbes import studytreelist as microbelist
from plants import studytreelist as plantslist
from metazoa import studytreelist as metalist
from fungi import studytreelist as fungilist
studytreelis... | OpenTreeOfLife/gcmdr | collect_study_ids.py | Python | bsd-2-clause | 537 | 0.007449 |
# Copyright (c) 2010-2011 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 ... | Intel-bigdata/swift | test/unit/common/test_client.py | Python | apache-2.0 | 15,155 | 0.000264 |
#!/usr/bin/python
# *****************************************************************************
#
# Copyright (c) 2016, EPAM SYSTEMS INC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#... | epam/DLab | infrastructure-provisioning/src/general/scripts/os/jupyter_dataengine_create_configs.py | Python | apache-2.0 | 7,919 | 0.003283 |
#!/usr/bin/env python
from nose.tools import ok_
from nose.tools import eq_
import networkx as nx
from networkx.algorithms.approximation import min_weighted_dominating_set
from networkx.algorithms.approximation import min_edge_dominating_set
class TestMinWeightDominatingSet:
def test_min_weighted_dominating_set(... | LumPenPacK/NetworkExtractionFromImages | win_build/nefi2_win_amd64_msvc_2015/site-packages/networkx/algorithms/approximation/tests/test_dominating_set.py | Python | bsd-2-clause | 2,410 | 0 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test RPCs related to blockchainstate.
Test the following RPCs:
- gettxoutsetinfo
- getdifficul... | kevcooper/bitcoin | test/functional/blockchain.py | Python | mit | 5,880 | 0.00068 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | NewpTone/stacklab-cinder | cinder/tests/fake_flags.py | Python | apache-2.0 | 1,721 | 0 |
# -*- coding: utf-8 -*-
"""Define the base module for server test."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import sys
from influxdb.tests import using_pypy
from influxdb.tests.server_tests.influxdb_instanc... | BenHewins/influxdb-python | influxdb/tests/server_tests/base.py | Python | mit | 2,621 | 0 |
#!/usr/bin/env python
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
#
# mockredis
#
# This module helps start and stop redis instances for unit-testing
# redis must be pre-installed for this to work
#
import os
import signal
import subprocess
import logging
import socket
import time
import red... | facetothefate/contrail-controller | src/analytics/test/utils/mockredis/mockredis/mockredis.py | Python | apache-2.0 | 5,634 | 0.002662 |
import web
from gothonweb import map
urls = (
'/game', 'GameEngine',
'/', 'Index',
)
app = web.application(urls, globals())
#little hack so that debug mode works with sessions
if web.config.get('_session') is None:
store = web.session.DiskStore('sessions')
session = web.session.Session(app, store,
... | githubfun/lphw | gothonweb/bin/gothon_app.py | Python | mit | 1,131 | 0.005305 |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Provides a web interface for dumping graph data as JSON.
This is meant to be used with /load_from_prod in order to easily grab
data for a graph to a loca... | benschmaus/catapult | dashboard/dashboard/dump_graph_json.py | Python | bsd-3-clause | 6,621 | 0.005437 |
# Copyright 2016 Casey Jaymes
# This file is part of PySCAP.
#
# PySCAP 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.
#
# PySCAP is ... | cjaymes/pyscap | src/scap/model/oval_5/sc/unix/EntityItemEncryptMethodType.py | Python | gpl-3.0 | 1,167 | 0.001714 |
from setuptools import setup, find_packages
setup(
name='zeit.content.gallery',
version='2.9.2.dev0',
author='gocept, Zeit Online',
author_email='zon-backend@zeit.de',
url='http://www.zeit.de/',
description="vivi Content-Type Portraitbox",
packages=find_packages('src'),
package_dir={''... | ZeitOnline/zeit.content.gallery | setup.py | Python | bsd-3-clause | 1,113 | 0 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014, 2015, 2016 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
... | ioanpocol/superdesk-ntb | server/ntb/scanpix/scanpix_datalayer.py | Python | agpl-3.0 | 13,055 | 0.001762 |
"""Code for CLI base"""
import logging
import pathlib
import click
import coloredlogs
import yaml
from flask.cli import FlaskGroup, with_appcontext
# General, logging
from scout import __version__
from scout.commands.convert import convert
from scout.commands.delete import delete
from scout.commands.download import d... | Clinical-Genomics/scout | scout/commands/base.py | Python | bsd-3-clause | 4,404 | 0.001589 |
from distutils.core import setup
setup(
name="kafka-python",
version="0.1-alpha",
author="David Arthur",
author_email="mumrah@gmail.com",
url="https://github.com/mumrah/kafka-python",
packages=["kafka"],
license="Copyright 2012, David Arthur under Apache License, v2.0",
description="Pur... | enoex/kafka-python | setup.py | Python | apache-2.0 | 404 | 0 |
import logging
import signal
import socket
import configparser
import importlib.machinery
import serial
import copy
import zmq
class Dispatcher(object):
""" Superclass for all Dispatchers.
This is the part of the simulator that handles the connections.
"""
def __init__(self, dispatcher_type, dispatche... | InTraffic/TSTK | TSTK/dispatcher.py | Python | gpl-3.0 | 20,467 | 0.004886 |
import os
path = os.path.dirname(os.path.realpath(__file__))
sbmlFilePath = os.path.join(path, 'BIOMD0000000045.xml')
with open(sbmlFilePath,'r') as f:
sbmlString = f.read()
def module_exists(module_name):
try:
__import__(module_name)
except ImportError:
return False
else:
ret... | biomodels/BIOMD0000000045 | BIOMD0000000045/model.py | Python | cc0-1.0 | 427 | 0.009368 |
#-*- coding:utf-8 -*-
'''
显示命令的输出结果。
'''
import threading
from gi.repository import Gtk, Gdk, GObject, GLib, GtkSource, Pango
from VcEventPipe import *
class ViewLog:
'''
显示日志。
1,来了新命令,是否更新当前的日志。
2,命令来了新的日志,并显示后,是否滚动。
'''
# 设定一个栏目的枚举常量。
(
COLUMN_TAG_LINE_NO, # 行号
COLUMN_TAG... | luo2chun1lei2/AgileEditor | vc/src/ViewLog.py | Python | gpl-2.0 | 6,715 | 0.010425 |
from vkapp.bot.models import Blogger, News, AdminReview, Publication
from .usersDAO import get_or_create_blogger
from datetime import datetime, timedelta, time
def new_news(link, media, uid, pic):
blogger = get_or_create_blogger(uid)
news = News(link=link, blogger=blogger, media=media, pic=pic)
news.save(... | ParuninPavel/lenta4_hack | vkapp/bot/dao/newsDAO.py | Python | mit | 1,222 | 0.005728 |
from modes import *
# mode_traffic
field_rate_down = 'rate_down'
field_bw_down = 'bw_down'
field_rate_up = 'rate_up'
field_bw_up = 'bw_up'
# mode_temp
field_cpum = 'cpum'
field_cpub = 'cpub'
field_sw = 'sw'
field_hdd = 'hdd'
# mode_fan_speed
field_fan_speed = 'fan_speed'
# mode_xdsl
field_snr_down = 'snr_down'
fiel... | chteuchteu/Freebox-OS-munin | fields.py | Python | gpl-2.0 | 4,648 | 0.000215 |
#!/usr/bin/
"""
"""
from __future__ import print_function
from __future__ import division
import networkx as nx
import sys
from networkx.algorithms import bipartite
from operator import itemgetter
import matplotlib.pyplot as plt
import argparse
import pickle as cp
import math
import numpy as np
from numpy import percen... | Rinoahu/debias | lib/debias.py | Python | gpl-3.0 | 49,496 | 0.022204 |
import argparse
from models import Service
from models import Base
import helpers
import traceback
import sys
import os
import importlib
import shutil
@helpers.handle_dbsession()
def prepare_service_db(sqlsession, name, desc, models, uses_blueprint):
s = sqlsession.query(Service).filter_by(name=name).first()
... | Yatekii/backdoor | register_service.py | Python | agpl-3.0 | 4,477 | 0.00134 |
import sys
def suite(n,s):
p = -1
fin = ''
c = 0
for i in range(0,n+1):
if i == n:
if s[i-1]==p:
fin = fin+str(c)+str(p)
else:
fin = fin+str(c)+str(p)
p = s[i]
c = 1
break
... | Hugoo/Prologin | 2008 - Machine/suite.py | Python | mit | 678 | 0.00885 |
from django import forms
class PutForm(forms.Form):
body = forms.CharField(widget=forms.Textarea())
tube = forms.CharField(initial='default')
priority = forms.IntegerField(initial=2147483648)
delay = forms.IntegerField(initial=0)
ttr = forms.IntegerField(initial=120)
| andreisavu/django-jack | jack/beanstalk/forms.py | Python | apache-2.0 | 291 | 0.006873 |
#!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Lic... | knoguchi/druid | docs/_bin/get-milestone-prs.py | Python | apache-2.0 | 3,551 | 0.005069 |
# ActivitySim
# See full license in LICENSE.txt.
import sys
import os
import logging
import yaml
import numpy as np
import pandas as pd
from activitysim.abm.models.util import tour_frequency as tf
from activitysim.core.util import reindex
from activitysim.abm.models.util import canonical_ids as cid
logger = loggin... | synthicity/activitysim | activitysim/examples/example_estimation/scripts/infer.py | Python | agpl-3.0 | 28,331 | 0.003565 |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... | samuell/luigi | examples/foo.py | Python | apache-2.0 | 1,501 | 0.000666 |
from __future__ import absolute_import
from scrapy.spiders import Spider
from scrapy.selector import Selector
from scrapy import Request
import sys
from Schoogle.items import O_Item
from sys import getsizeof
from datetime import datetime
import time
import re
mport string
def reduce(text):
return "".join([c for c in... | dwt2c/Schoogle | Schoogle/Schoogle/spiders/O_Spider.py | Python | gpl-2.0 | 3,037 | 0.029964 |
import math
curr = 0
goal = 1000000
potential_nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
output_num = []
if __name__ == '__main__':
for i in xrange(10, 0, -1):
print (curr, i, "outer loop")
for j in xrange(i + 1):
print (curr, j, "inner loop")
temp = math.factorial(i - 1) * j +... | kylebegovich/ProjectEuler | Python/Solved/Page1/Problem24.py | Python | gpl-3.0 | 663 | 0.006033 |
import collections
import difflib
import inspect
import logging
import os.path
import warnings
import os
import importlib
import cherrypy
import yaml
from yaml import load
try:
from yaml import CLoader as Loader
except ImportError:
from yaml import Loader
json = None
for pkg in ['ujson', 'yajl', 'simplejson'... | open-craft-guild/blueberrypy | src/blueberrypy/config.py | Python | bsd-3-clause | 18,173 | 0.002091 |
import argparse
import sys
import os
from annotated_set import loadData
from data_structures import CanonicalDerivation
from canonical_parser import CanonicalParser
from derivation_tree import DerivationTree
from conversion.ghkm2tib import ghkm2tib
#from lib.amr.dag import Dag
class ExtractorCanSem:
def __init_... | GullyAPCBurns/bolinas | extractor_cansem/extractor_cansem.py | Python | mit | 3,342 | 0.012567 |
#!/usr/bin/env python
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
from calibre.gui2.complete2 import LineEdit
from calibre.gui2.widgets import ... | insomnia-lab/calibre | src/calibre/gui2/widgets2.py | Python | gpl-3.0 | 1,547 | 0.003232 |
import re
import traceback
from urllib.parse import quote
from requests.utils import dict_from_cookiejar
from sickchill import logger
from sickchill.helper.common import convert_size, try_int
from sickchill.oldbeard import tvcache
from sickchill.oldbeard.bs4_parser import BS4Parser
from sickchill.providers.torrent.To... | h3llrais3r/SickRage | sickchill/oldbeard/providers/pretome.py | Python | gpl-3.0 | 5,958 | 0.003021 |
"""Undocumented Module"""
__all__ = ['Transitions']
from panda3d.core import *
from direct.gui.DirectGui import *
from direct.interval.LerpInterval import LerpColorScaleInterval, LerpColorInterval, LerpScaleInterval, LerpPosInterval
from direct.interval.MetaInterval import Sequence, Parallel
from direct.interval.Func... | hj3938/panda3d | direct/src/showbase/Transitions.py | Python | bsd-3-clause | 17,107 | 0.009002 |
"""
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 use this ... | sekikn/ambari | ambari-common/src/main/python/ambari_commons/repo_manager/generic_manager.py | Python | apache-2.0 | 7,285 | 0.009746 |
# -*- coding: utf-8 -*-
'''
Rupture
version 1.4.0
build 5
'''
from bs4 import BeautifulSoup
import datetime
import requests
import socket
import pickle
import time
import ssl
from .utils import six
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.poolmanager import PoolManager
cl... | shinznatkid/rupture | rupture/rupture.py | Python | mit | 6,405 | 0.002186 |
from django.conf.urls.defaults import *
from django_de.apps.authors.models import Author
urlpatterns = patterns('django.views.generic.list_detail',
(r'^$', 'object_list',
dict(
queryset = Author.objects.order_by('name', 'slug'),
template_object_name = 'author',
allow_emp... | django-de/django-de-v2 | django_de/apps/authors/urls.py | Python | bsd-3-clause | 348 | 0.017241 |
from seleniumbase import BaseCase
class GitHubTests(BaseCase):
def test_github(self):
# Selenium can trigger GitHub's anti-automation system:
# "You have triggered an abuse detection mechanism."
# "Please wait a few minutes before you try again."
# To avoid this automation blocker,... | seleniumbase/SeleniumBase | examples/github_test.py | Python | mit | 1,290 | 0 |
from spacewiki.app import create_app
from spacewiki import model
from spacewiki.test import create_test_app
import unittest
class UiTestCase(unittest.TestCase):
def setUp(self):
self._app = create_test_app()
with self._app.app_context():
model.syncdb()
self.app = self._app.test_... | spacewiki/spacewiki | spacewiki/test/ui_test.py | Python | agpl-3.0 | 718 | 0.001393 |
#######################################################################
# This file is part of Pyblosxom.
#
# Copyright (C) 2010-2011 by the Pyblosxom team. See AUTHORS.
#
# Pyblosxom is distributed under the MIT license. See the file
# LICENSE for distribution details.
###############################################... | maru-sama/pyblosxom | Pyblosxom/tests/test_tags.py | Python | mit | 2,822 | 0.003898 |
"""
This page is in the table of contents.
Winding is a script to set the winding profile for the skeinforge chain.
The displayed craft sequence is the sequence in which the tools craft the model and export the output.
On the winding dialog, clicking the 'Add Profile' button will duplicate the selected profile and gi... | AlexeyKruglov/Skeinforge-fabmetheus | skeinforge_application/skeinforge_plugins/profile_plugins/winding.py | Python | agpl-3.0 | 2,079 | 0.011544 |
# coding: utf-8
"""
Qc API
Qc API # noqa: E501
The version of the OpenAPI document: 3.0.0
Contact: cloudsupport@telestream.net
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from telestream_cloud_qc.configuration import Configuration
class... | Telestream/telestream-cloud-python-sdk | telestream_cloud_qc_sdk/telestream_cloud_qc/models/header_byte_count_test.py | Python | mit | 4,912 | 0 |
# -*- coding: utf-8 -*-
# This coding header is significant for tests, as the debug view is parsing
# files to search for such a header to decode the source file content
from __future__ import absolute_import, unicode_literals
import inspect
import os
import sys
from django.conf import settings
from django.core impor... | blaze33/django | tests/regressiontests/views/tests/debug.py | Python | bsd-3-clause | 22,564 | 0.001197 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/gugu/w/calibre/src/calibre/gui2/dialogs/quickview.ui'
#
# Created: Thu Jul 19 23:32:31 2012
# by: PyQt4 UI code generator 4.9.1
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_f... | Eksmo/calibre | src/calibre/gui2/dialogs/quickview_ui.py | Python | gpl-3.0 | 3,673 | 0.003539 |
# -*- coding: utf-8 -*-
import ast
import base64
import csv
import glob
import itertools
import logging
import operator
import datetime
import hashlib
import os
import re
import simplejson
import time
import urllib
import urllib2
import urlparse
import xmlrpclib
import zlib
from xml.etree import ElementTree
from cStri... | gdgellatly/OCB1 | addons/web/controllers/main.py | Python | agpl-3.0 | 69,619 | 0.003433 |
"""Test that arguments passed to a script Menu.main(loop=True) execute
properly."""
##==============================================================#
## SECTION: Imports #
##==============================================================#
from testlib import *
##===========... | jeffrimko/Qprompt | tests/script_test_1.py | Python | mit | 3,045 | 0.004598 |
from io import StringIO
import csv
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from django.core.files.base import ContentFile
from django.test import TestCase
from django.urls import reverse
from django.utils.timezone import now
from register.forms impo... | SmartElect/SmartElect | register/tests/test_views.py | Python | apache-2.0 | 21,018 | 0.001523 |
PREDEFINED_FONT_MAPS = {
(
(193, 0), (193, 1462), (297, 104), (297, 1358), (930, 104),
(930, 1358), (1034, 0), (1034, 1462),
)
: {'char' : '�', 'name' : 'glyph00000'},
(
(115, 276), (115, 804), (287, 518), (291, 653), (292, 325),
(305, 805), (376, 1116), (396, -20), (462, 977), (477, 125),... | fake-name/ReadableWebProxy | WebMirror/processor/fonts/FontTables.py | Python | bsd-3-clause | 18,234 | 0.033074 |
"""Two different implementations of merge sort. First one is the standard sort
that creates the result to new list on each level. Second one is an in-place
sort that uses two alternating buffers and offsets to limit memory usage
to O(2n).
"""
def sort(lst):
"""Standard merge sort.
Args:
lst: List to ... | niemmi/algolib | algolib/sort/merge_sort.py | Python | bsd-3-clause | 2,137 | 0 |
#!/usr/bin/env python
from distutils.core import setup
setup(name='Ajax Select',
version='1.0',
description='Django-jQuery jQuery-powered auto-complete fields for ForeignKey and ManyToMany fields',
author='Crucial Felix',
author_email='crucialfelix@gmail.com',
url='http://code.google.com... | Ksynko/django-crm | sample_project/external_apps/ajax_select/setup.py | Python | bsd-3-clause | 387 | 0.005168 |
# -*- coding: utf-8 -*-
# ===========================================================================
# eXe
# Copyright 2004-2006, University of Auckland
# Copyright 2006-2008 eXe Project, http://eXeLearning.org/
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU G... | RichDijk/eXe | exe/engine/package.py | Python | gpl-2.0 | 77,805 | 0.004679 |
"""Defines the URL routes for the Team API."""
from django.conf import settings
from django.conf.urls import patterns, url
from .views import (
MembershipDetailView,
MembershipListView,
TeamsDetailView,
TeamsListView,
TopicDetailView,
TopicListView
)
TEAM_ID_PATTERN = r'(?P<team_id>[a-z\d_-]+... | miptliot/edx-platform | lms/djangoapps/teams/api_urls.py | Python | agpl-3.0 | 1,464 | 0 |
import unittest
from pytba import VERSION
from pytba import api as client
class TestApiMethods(unittest.TestCase):
def setUp(self):
client.set_api_key("WesJordan", "PyTBA-Unit-Test", VERSION)
def test__tba_get(self):
# Query with proper key should succeed
team = client.tba_get('team/f... | Ninjakow/TrueSkill | lib/pytba/test/api_test.py | Python | gpl-3.0 | 1,080 | 0.001852 |
input = """
a(1).
a(2) | a(3).
ok1 :- #max{V:a(V)} = 3.
b(3).
b(1) | b(2).
ok2 :- #max{V:b(V)} = 3.
"""
output = """
a(1).
a(2) | a(3).
ok1 :- #max{V:a(V)} = 3.
b(3).
b(1) | b(2).
ok2 :- #max{V:b(V)} = 3.
"""
| veltri/DLV2 | tests/parser/aggregates.max.propagation.7.test.py | Python | apache-2.0 | 213 | 0 |
'''
we all know the classic "guessing game" with higher or lower prompts. lets do a role reversal; you create a program that will guess numbers between 1-100, and respond appropriately based on whether users say that the number is too high or too low. Try to make a program that can guess your number based on user input... | DayGitH/Python-Challenges | DailyProgrammer/20120209C.py | Python | mit | 1,271 | 0.004721 |
import sht21
with sht21.SHT21(1) as sht21:
print "temp: %s"%sht21.read_temperature()
print "humi: %s"%sht21.read_humidity()
| BollMose/daynote | test_sht.py | Python | apache-2.0 | 132 | 0.015152 |
import os
import sys
from src import impl as rlcs
import utils as ut
import analysis as anls
import matplotlib.pyplot as plt
import logging
import pickle as pkl
import time
config = ut.loadConfig('config')
sylbSimFolder=config['sylbSimFolder']
transFolder=config['transFolder']
lblDir=config['lblDir']
onsDir=config['o... | swapnilgt/percPatternDiscovery | rlcs/preAnalysisRun.py | Python | agpl-3.0 | 1,024 | 0.06543 |
# 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 u... | tqchen/tvm | python/tvm/tir/buffer.py | Python | apache-2.0 | 9,009 | 0.001332 |
#-*- coding: utf-8 -*-
'''
Created on 23 mar 2014
@author: mariusz
@author: tomasz
'''
import unittest
from selearea import get_ast, get_workareas
class seleareaTest(unittest.TestCase):
def get_fc_pages(self):
urls = {
"http://fc.put.poznan.pl",
"http://fc.put.poznan.pl/re... | perfidia/selearea | tests/seleareaTest.py | Python | mit | 2,350 | 0.00383 |
"""
Copyright (c) 2011, 2012, Regents of the University of California
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this l... | SoftwareDefinedBuildings/smap | python/smap/smapconf.py | Python | bsd-2-clause | 3,347 | 0.008664 |
# -*- coding: utf-8 -*-
'''
Created on 17/2/16.
@author: love
'''
import paho.mqtt.client as mqtt
import json
import ssl
def on_connect(client, userdata, flags, rc):
print("Connected with result code %d"%rc)
client.publish("Login/HD_Login/1", json.dumps({"userName": user, "passWord": "Hello,anyone!"}),qos=0,re... | liangdas/mqantserver | client/mqtt_chat_client.py | Python | apache-2.0 | 2,416 | 0.021183 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.