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 |
|---|---|---|---|---|---|---|
#
# This file is part of pyasn1 software.
#
# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com>
# License: http://snmplabs.com/pyasn1/license.html
#
import time
from datetime import datetime
from sys import version_info
__all__ = ['strptime']
if version_info[:2] <= (2, 4):
def strptime(text, dateFormat)... | endlessm/chromium-browser | tools/swarming_client/third_party/pyasn1/pyasn1/compat/dateandtime.py | Python | bsd-3-clause | 482 | 0 |
import unittest
import MachineSettingsFromXMLBuilder as MSFXMLB
import MachineSettings as MS
class TestMachineSettingsFromXMLBuilder(unittest.TestCase):
"""
Tests for the class MachineSettingsFromXMLBuilder
.. moduleauthor:: Albert Heinle <albert.heinle@uwaterloo.ca>
"""
def setUp(self):
... | symbolicdata/code | src/sdeval/classes/MachineSettingsFromXMLBuilder_test.py | Python | gpl-3.0 | 3,258 | 0.008287 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2008 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.com/license.html.
#
# This software consists of vo... | zjj/trac_hack | trac/versioncontrol/admin.py | Python | bsd-3-clause | 16,185 | 0.001792 |
from cloudman.cloudman.models import TopLevelAllocationByZone,TopLevelAllocation,TopLevelAllocationAllowedResourceType
from cloudman.cloudman.models import ProjectAllocation,Project,ProjectMetadata,ProjectAllocationMetadata,GroupAllocation
from cloudman.cloudman.models import GroupAllocationMetadata
from cloudman.cloud... | cernops/CloudMan | export/export.py | Python | apache-2.0 | 11,272 | 0.011888 |
# Global configuration information used across all the
# translations of documentation.
#
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as stri... | alchemy-fr/Phraseanet-Docs | config/all.py | Python | gpl-3.0 | 7,172 | 0.007669 |
from direct.directnotify import DirectNotifyGlobal
from toontown.ai.DistributedScavengerHuntTargetAI import DistributedScavengerHuntTargetAI
class DistributedWinterCarolingTargetAI(DistributedScavengerHuntTargetAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedWinterCarolingTargetAI")
| silly-wacky-3-town-toon/SOURCE-COD | toontown/ai/DistributedWinterCarolingTargetAI.py | Python | apache-2.0 | 312 | 0.012821 |
# flake8: noqa
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'SliderItemTitle.is_published'
db.add_column('hero_slider_slideritemtitle', 'i... | bitmazk/django-hero-slider | hero_slider/south_migrations/0002_auto__add_field_slideritemtitle_is_published.py | Python | mit | 8,315 | 0.007937 |
from os import path
s1 = 'one seven three five one six two six six seven'
s2 = 'four zero two nine one eight five nine zero four'
s3 = 'one nine zero seven eight eight zero three two eight'
s4 = 'four nine one two one one eight five five one'
s5 = 'eight six three five four zero two one one two'
s6 = 'two three nine z... | georgesterpu/pyVSR | pyVSR/ouluvs2/scripts/create_labels.py | Python | gpl-3.0 | 1,947 | 0.002054 |
"""
WSGI config for modelbouwdag project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATI... | modelbrouwers/modelbouwdag.nl | src/modelbouwdag/wsgi/production.py | Python | mit | 1,508 | 0.000663 |
"""
Abstract class for Db classes
"""
from abc import ABCMeta, abstractmethod
class AbstractDb(object):
""" AbstractDb """
__metaclass__ = ABCMeta
def __init__(self):
pass
@abstractmethod
def write(self, data):
pass
@abstractmethod
def query(self, condition):
pas... | DrewMeyersCUboulder/UPOD_Bridge | Server/AbstractDb.py | Python | mit | 383 | 0.002611 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import networkx as nx
import copy
from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER, DEAD_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.ofproto import ofproto_v1_3... | Zouyiran/ryu | ryu/app/chapter_2/pre_install_app.py | Python | apache-2.0 | 12,687 | 0.005833 |
from distutils.core import setup
import py2exe
import os
import matplotlib as mpl
# delete all pyc files
for dirpath, dirnames, filenames in os.walk(os.getcwd()):
for each_file in filenames:
if each_file.endswith('.pyc'):
if os.path.exists(os.path.join(dirpath, each_file)):
os.remove(os.path.join(dirpa... | dparks1134/STAMP | createExeWindows.py | Python | gpl-3.0 | 3,184 | 0.039259 |
# -*- coding: utf-8 -*-
'''
Wheel system wrapper for key system
'''
from __future__ import absolute_import
# Import python libs
import os
import hashlib
# Import salt libs
import salt.key
import salt.crypt
__func_alias__ = {
'list_': 'list'
}
def list_(match):
'''
List all the keys under a named status... | stephane-martin/salt-debian-packaging | salt-2016.3.3/salt/wheel/key.py | Python | apache-2.0 | 3,278 | 0.00061 |
# Copyright (c) 2016 Matthew Earl
#
# 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 rights
# to use, copy, modify, merge, publish, distr... | matthewearl/photo-a-day-aligner | pada/landmarks.py | Python | mit | 2,163 | 0.002774 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014 Rodolphe Quiédeville <rodolphe@quiedeville.org>
#
# 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,... | novafloss/django-json-dbindex | json_dbindex/pgcommands.py | Python | bsd-3-clause | 3,263 | 0 |
import os
import matplotlib.pyplot as plt
import numpy as np
from plotting_styles import onecolumn_figure, default_figure
from paths import paper1_figures_path
'''
Make a UV plot of the 1000th HI channel.
'''
uvw = np.load("/mnt/MyRAID/M33/VLA/14B-088/HI/"
"14B-088_HI_LSRK.ms.contsub_channel_1000.uvw.... | e-koch/VLA_Lband | 14B-088/HI/analysis/uv_plots/channel_1000_uvplot.py | Python | mit | 813 | 0 |
# -*- coding: utf-8 -*-
"""
uds.utils.dict
~~~~~~~~~~~~~~
Utility functions to parse string and others.
:copyright: Copyright (c) 2015, National Institute of Information and Communications Technology.All rights reserved.
:license: GPL2, see LICENSE for more details.
"""
import copy
def override_dict(new, old):
... | nict-isp/uds-sdk | uds/utils/dict.py | Python | gpl-2.0 | 789 | 0.001267 |
import pygame
class Slice():
"""docstring for Slice"""
def __init__(self, context):
self.context = context
| FOSSRIT/PyCut | game/objects/slice.py | Python | mpl-2.0 | 124 | 0.008065 |
#!/usr/bin/env python3
from socket import inet_pton, inet_ntop, AF_INET, AF_INET6
import unittest
from framework import VppTestCase, VppTestRunner
from vpp_ip import DpoProto
from vpp_ip_route import VppIpRoute, VppRoutePath, VppMplsLabel, \
VppIpTable, FibPathProto
from vpp_acl import AclRule, VppAcl
from scapy... | FDio/vpp | test/test_abf.py | Python | apache-2.0 | 10,057 | 0 |
# -*- coding: utf-8 -*-
from threading import Thread, Lock
from time import sleep
from .base import SchedulerMixin
class Scheduler(SchedulerMixin, Thread):
"""
Threading scheduler.
"""
def sleep(self, seconds):
if seconds == 0:
return
sleep(seconds)
def return_c... | niwinz/django-greenqueue | greenqueue/scheduler/thread_scheduler.py | Python | bsd-3-clause | 449 | 0.002227 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
""" Log Config
"""
__author__ = 'Zagfai'
__date__ = '2018-06'
SANIC_LOGGING_CONFIG = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'default': {
'format':
'%(levelname)s [%(asctime)s %(name)s:%(lineno)d] %(me... | zagfai/webtul | webtul/log.py | Python | mit | 1,135 | 0 |
# -*- coding: utf-8 -*-
import wx
from outwiker.gui.editorstyleslist import EditorStylesList
from outwiker.pages.wiki.wikiconfig import WikiConfig
from outwiker.gui.preferences.baseprefpanel import BasePrefPanel
class WikiEditorPanel(BasePrefPanel):
def __init__(self, parent, application):
super(type(se... | unreal666/outwiker | src/outwiker/gui/preferences/wikieditorpanel.py | Python | gpl-3.0 | 1,446 | 0 |
"""
WSGI config for api project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` sett... | urfonline/api | config/wsgi.py | Python | mit | 1,914 | 0 |
import unittest
import utils
class WordDictionary:
def __init__(self):
"""
Initialize your data structure here.
"""
self.root = {}
def addWord(self, word: str) -> None:
curr = self.root
for ch in word:
child = curr.get(ch)
if not chil... | chrisxue815/leetcode_python | problems/test_0211.py | Python | unlicense | 1,179 | 0 |
import easygui_qt as easy
import pandas as pd
import numpy as np
import geoplot
from matplotlib import pyplot as plt
import math
from matplotlib.colors import LinearSegmentedColormap
MTH = {'sum': np.sum, 'max': np.max, 'min': np.min, 'mean': np.mean}
class SpatialData:
def __init__(self, result_file=None):
... | oemof/reegis-hp | reegis_hp/de21/results.py | Python | gpl-3.0 | 11,607 | 0.000431 |
# -*- encoding:utf-8 -*-
from __future__ import unicode_literals
MESSAGES = {
"%d min remaining to read": "%d منٹ کا مطالعہ باقی",
"(active)": "(فعال)",
"Also available in:": "ان زبانوں میں بھی دستیاب:",
"Archive": "آرکائیو",
"Categories": "زمرے",
"Comments": "تبصرے",
"LANGUAGE": "اردو",
... | agustinhenze/nikola.debian | nikola/data/themes/base/messages/messages_ur.py | Python | mit | 1,784 | 0 |
from py.log import Producer
from xdist.workermanage import parse_spec_config
from xdist.report import report_collection_diff
class EachScheduling:
"""Implement scheduling of test items on all nodes
If a node gets added after the test run is started then it is
assumed to replace a node which got removed ... | nicoddemus/pytest-xdist | src/xdist/scheduler/each.py | Python | mit | 5,136 | 0 |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Cisco Systems, Inc.
# Copyright 2012 NEC Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use... | sandvine/horizon | openstack_dashboard/api/neutron.py | Python | apache-2.0 | 50,711 | 0.00002 |
import os
gettext = lambda s: s
DATA_DIR = os.path.dirname(os.path.dirname(__file__))
"""
Django settings for flex project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settin... | samastur/flexlayout | flex/settings.py | Python | mit | 5,343 | 0.00131 |
# -*- coding: utf-8 -*-
from plexapi import utils
from plexapi.base import PlexObject
class PlayQueue(PlexObject):
""" Control a PlayQueue.
Attributes:
key (str): This is only added to support playMedia
identifier (str): com.plexapp.plugins.library
initpath (str): Rela... | adamredfern92/PlexDownload | plexapi/playqueue.py | Python | mit | 3,815 | 0.002621 |
#! /usr/bin/env python
from distutils.core import setup
import sys
reload(sys).setdefaultencoding('Utf-8')
setup(
name='django-sphinxdoc',
version='1.0',
author='Stefan Scherfke',
author_email='stefan at sofa-rockers.org',
description='Easily integrate Sphinx documentation into your website.',
... | 30loops/django-sphinxdoc | setup.py | Python | bsd-3-clause | 1,150 | 0 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... | ikargis/horizon_fod | horizon/messages.py | Python | apache-2.0 | 2,969 | 0 |
# Author: Idan Gutman
# Modified by jkaberg, https://github.com/jkaberg for SceneAccess
# URL: https://sickrage.ca
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation... | SiCKRAGETV/SickRage | sickrage/providers/torrent/hdtorrents.py | Python | gpl-3.0 | 6,494 | 0.002156 |
from .tower import (
create_instance,
create_instance_group,
create_organization,
create_job_template,
create_notification_template,
create_survey_spec,
create_workflow_job_template,
)
from .exc import (
NotUnique,
)
__all__ = [
'create_instance',
'create_instance_group',
'... | GoogleCloudPlatform/sap-deployment-automation | third_party/github.com/ansible/awx/awx/main/tests/factories/__init__.py | Python | apache-2.0 | 486 | 0 |
# stdlib
from collections import namedtuple
import socket
import subprocess
import time
import urlparse
# 3p
import requests
# project
from checks import AgentCheck
from config import _is_affirmative
from util import headers, Platform
class NodeNotFound(Exception): pass
ESInstanceConfig = namedtuple(
'ESInsta... | JohnLZeller/dd-agent | checks.d/elastic.py | Python | bsd-3-clause | 23,162 | 0.005008 |
'''
Created on 23.07.2012
@author: vlkv
'''
from sqlalchemy.orm import contains_eager, joinedload_all
from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy.exc import ResourceClosedError
import shutil
import datetime
import logging
import os.path
import reggata.errors as err
import reggata.helpers as hlp
import ... | vlkv/reggata | reggata/data/commands.py | Python | gpl-3.0 | 40,730 | 0.004444 |
"""
Upload a file to a server (or other filesystem)
Usage:
python upload.py FILENAME <FS URL>
example:
python upload.py foo.txt ftp://example.org/uploads/
"""
import os
import sys
from fs import open_fs
_, file_path, fs_url = sys.argv
filename = os.path.basename(file_path)
with open_fs(fs_url) as fs:
... | PyFilesystem/pyfilesystem2 | examples/upload.py | Python | mit | 523 | 0 |
__author__ = 'junz'
import os
import matplotlib.pyplot as plt
import retinotopic_mapping.RetinotopicMapping as rm
from tools import FileTools as ft
trialName = "160211_M214522_Trial1.pkl"
isSave = True
params = {'phaseMapFilterSigma': 1.,
'signMapFilterSigma': 9.,
'signMapThr': 0.3,
'e... | zhuangjun1981/retinotopic_mapping | retinotopic_mapping/examples/signmap_analysis/scripts/script_analysis.py | Python | gpl-3.0 | 1,015 | 0.003941 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ModelerParametersDialog.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
***************... | dakcarto/QGIS | python/plugins/processing/modeler/ModelerParametersDialog.py | Python | gpl-2.0 | 27,476 | 0.001237 |
# Copyright (c) 2010 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable la... | sebrandon1/nova | nova/tests/unit/virt/xenapi/stubs.py | Python | apache-2.0 | 14,212 | 0.000141 |
"""
This module allows you to mock the config file as needed.
A default fixture that simply returns a safe-to-modify copy of
the default value is provided.
This can be overridden by parametrizing over the option you wish to
mock.
e.g.
>>> @pytest.mark.parametrize("extension_initial_dot", (True, False))
... def test_f... | INCF/pybids | bids/conftest.py | Python | mit | 1,063 | 0.003763 |
# Check dependencies
import PIL, PIL.Image, PIL.ImageTk
import aggdraw
import affine
import itertools
def grouper(iterable, n):
args = [iter(iterable)] * n
return itertools.izip_longest(fillvalue=None, *args)
# Main class
class AggRenderer:
"""
This class is used to draw each feature with aggdra... | karimbahgat/PyAgg | __private__/temp_dev/rendererclass3orrevert.py | Python | mit | 12,788 | 0.014154 |
import logging
from functools import wraps
from collections import deque
from threading import Thread
from time import time, sleep
from .base import make_key_func, get_serializer, get_expire
from .compat import PY2, listitems
log = logging.getLogger('cachel')
class OffloadCacheWrapper(object):
def __init__(self... | baverman/cachel | cachel/offload.py | Python | mit | 8,287 | 0.000724 |
%matplotlib inline
import itertools
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import scipy
import scipy.spatial
from scipy import linalg
from sklearn.cluster import KMeans
from sklearn import mixture
from scipy.io import arff
from sklearn import datasets
from sklearn import svm
from s... | kephale/TuftsCOMP135_Spring2016 | Lecture18/notebooks/Lecture18.py | Python | apache-2.0 | 9,270 | 0.01068 |
import os, sys
import datetime
import iris
import iris.unit as unit
import iris.analysis.cartography
import numpy as np
from iris.coord_categorisation import add_categorised_coord
diag = 'avg.5216'
cube_name_explicit='stratiform_rainfall_rate'
cube_name_param='convective_rainfall_rate'
pp_file_path='/projects/casc... | peterwilletts24/Monsoon-Python-Scripts | rain/land_sea_diurnal/rain_mask_save_lat_lon_west_southern_indian_ocean.py | Python | mit | 7,070 | 0.019378 |
import unittest
import os
from os.path import dirname
import sys
import json
from rtree import index
from . import ROOT
from geotweet.mapreduce.utils.lookup import project, SpatialLookup
testdata = os.path.join(dirname(os.path.abspath(__file__)), 'testdata')
def read(geojson):
return json.loads(open(os.path.joi... | meyersj/geotweet | geotweet/tests/unit/mapreduce/utils/lookup_tests.py | Python | mit | 3,949 | 0.003798 |
#
# Hubblemon - Yet another general purpose system monitor
#
# Copyright 2015 NAVER Corp.
#
# 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
#
# U... | naver/hubblemon | redis_mon/redis_view.py | Python | apache-2.0 | 2,771 | 0.024901 |
##############################################################################
# Copyright 2009, Gerhard Weis
# 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 ... | Nexenta/s3-tests | virtualenv/lib/python2.7/site-packages/isodate/tests/test_time.py | Python | mit | 6,554 | 0.001984 |
"""
Tests for Course API views.
"""
from hashlib import md5
from django.core.urlresolvers import reverse
from django.test import RequestFactory
from nose.plugins.attrib import attr
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, SharedModuleStoreTestCase
from ..views import CourseDetailView
f... | miptliot/edx-platform | lms/djangoapps/course_api/tests/test_views.py | Python | agpl-3.0 | 8,978 | 0.002673 |
"""
Asyncore-based implementation of the AMP protocol.
"""
import socket
import threading
import asyncore, asynchat, socket, struct, sys
import defer, ampy
class AMP_Server(asyncore.dispatcher):
def __init__(self, port, bindHost="0.0.0.0"):
self.port = port
self.bindHost = bindHost
asyncor... | spikeekips/ampy | ampy/async.py | Python | mit | 7,935 | 0.004789 |
# -*- coding: utf-8 -*-
# @Author: YangZhou
# @Date: 2017-06-16 20:09:09
# @Last Modified by: YangZhou
# @Last Modified time: 2017-06-27 16:02:34
from aces.tools import mkdir, mv, cd, cp, mkcd, shell_exec,\
exists, write, passthru, toString, pwd, debug, ls, parseyaml
import aces.config as config
from aces.bina... | vanceeasleaf/aces | aces/runners/phonopy.py | Python | gpl-2.0 | 19,132 | 0 |
#! /usr/bin/env python
from genomon_pipeline.stage_task import *
class Markduplicates(Stage_task):
task_name = "markduplicates"
script_template = """
#!/bin/bash
#
# Set SGE
#
#$ -S /bin/bash # set shell in UGE
#$ -cwd # execute at the submitted dir
pwd # print cu... | eigoshimizu/Genomon | scripts/genomon_pipeline/dna_resource/markduplicates.py | Python | gpl-2.0 | 742 | 0.004043 |
import os
print "Tic Tac Toe".center(50,'-')
l = [['_','_','_'],['_','_','_'],['_','_','_']]
def show(l) :
os.system("clear")
for i in range(0,3) :
for j in range(0,3) :
print l[i][j]," ",
print "\n"
def base() :
print "provided numbers for provided positions"
num = 0
for i in range (0,3) :
for j in ... | avinash-n/work-1 | python_program/day_3/tic_tac_toe.py | Python | gpl-3.0 | 2,433 | 0.085902 |
# -*- coding: utf-8 -*-
"""
NOCExec
-----------------------
Library for automation of management and configuration of network devices
"""
import sys
import os
from setuptools import setup
if sys.version_info < (2, 7):
raise Exception("NOCExec requires Python 2.7 or higher.")
# Hard linking doesn't work inside Vir... | velp/nocexec | setup.py | Python | mit | 1,793 | 0.001115 |
from measures.generic.GenericMeasure import GenericMeasure
import measures.generic.Units as Units
class StartedCompositions(GenericMeasure):
"""Total number of started searches"""
def __init__(self, period, simulationTime):
GenericMeasure.__init__(self, r'DEBUG .*? - Peer [0-9]+ started composition search \(.*?... | unaguil/hyperion-ns2 | experiments/measures/graphsearch/StartedCompositions.py | Python | apache-2.0 | 448 | 0.029018 |
import collections
class Mapping(object):
"""
Used to generate mapping based in document field definitions
>>> class Obj(Document):
... name = StringField()
And you can use a Mapping to refresh mappings
(use in cron jobs or call periodically)
obj_mapping = Mapping(Obj)
obj_mappi... | catholabs/esengine | esengine/mapping.py | Python | mit | 4,930 | 0 |
# -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.contrib.sitemaps import Sitemap
from photologue.models import Gallery
class AlbumSitemap(Sitemap):
changefreq = "monthly"
priority = 0.5
def items(self):
return Gallery.objects.filter(is_public=True)
def lastm... | VerticalMediaProjects/cmsplugin-photologue-pro | cmsplugin_photologue_pro/sitemaps.py | Python | bsd-3-clause | 464 | 0 |
from oscar.apps.offer import models
class ChangesOwnerName(models.Benefit):
class Meta:
proxy = True
def apply(self, basket, condition, offer=None):
condition.consume_items(basket, ())
return models.PostOrderAction(
"You will have your name changed to Barry!")
def ap... | makielab/django-oscar | sites/sandbox/apps/offers.py | Python | bsd-3-clause | 584 | 0 |
import uuid
def generate_task_key():
return uuid.uuid4().hex
| concentricsky/badgecheck | openbadges/verifier/actions/utils.py | Python | apache-2.0 | 67 | 0 |
from myhdl import block
from hdmi.cores.primitives import ram16x1d
inst_count = 0
@block
def dram16xn(data_in, address, address_dp, write_enable, clock,
o_data_out, o_data_out_dp, data_width=30):
"""
Implements a Distributed SelectRAM with Dual port 16 x N-bit.
It will be replaced by a ve... | srivatsan-ramesh/HDMI-Source-Sink-Modules | hdmi/cores/primitives/dram16xn.py | Python | mit | 2,112 | 0.00142 |
from xform_instance_parser import parse_xform_instance
class SurveyInstance(object):
def __init__(self, survey_object, **kwargs):
self._survey = survey_object
self.kwargs = kwargs #not sure what might be passed to this
#does the survey object provide a way to get the key dicts?
s... | dorey/pyxform | pyxform/instance.py | Python | bsd-2-clause | 3,121 | 0.00769 |
import unittest
import giraffe as c
import giraffe.exceptions as exc
def make_graph_tst(cls):
class Test(unittest.TestCase):
def test_eq_ne(self):
g = cls()
g2 = cls()
self.assertEqual(g, g2)
self.assertEqual(g2, g)
g.add_vertex(1)
... | Julian/giraffe | giraffe/tests/test_core.py | Python | mit | 13,956 | 0.00172 |
from extraction.core import ExtractionRunner
from extraction.runnables import Extractor, RunnableError, Filter, ExtractorResult
import os
import sys
import extractor.csxextract.extractors.grobid as grobid
import extractor.csxextract.extractors.pdfbox as pdfbox
import extractor.csxextract.extractors.tei as tei
import ex... | SeerLabs/PDFMEF | src/extractor/run_extraction.py | Python | apache-2.0 | 2,199 | 0.003183 |
__all__ = ['FFI', 'VerificationError', 'VerificationMissing', 'CDefError',
'FFIError']
from .api import FFI
from .error import CDefError, FFIError, VerificationError, VerificationMissing
from .error import PkgConfigError
__version__ = "1.14.2"
__version_info__ = (1, 14, 2)
# The verifier module file names... | sserrot/champion_relationships | venv/Lib/site-packages/cffi/__init__.py | Python | mit | 513 | 0 |
from boxbranding import getImageVersion, getImageBuild, getImageDevBuild, getImageType, getImageDistro, getMachineBrand, getMachineName, getMachineBuild
from os import path
from gettext import dgettext
from enigma import eTimer, eDVBDB
import Components.Task
from Components.OnlineUpdateCheck import feedsstatuscheck, ... | BlackHole/enigma2-obh10 | lib/python/Screens/SoftwareUpdate.py | Python | gpl-2.0 | 19,545 | 0.021949 |
# flake8: noqa
from .config import INFER_HOST
from .main import run_app, runserver, serve_static
| samuelcolvin/aiohttp-devtools | aiohttp_devtools/runserver/__init__.py | Python | mit | 97 | 0 |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | napalm-automation/napalm-yang | napalm_yang/models/openconfig/components/component/transceiver/physical_channels/channel/state/__init__.py | Python | apache-2.0 | 34,214 | 0.001257 |
from webob.multidict import MultiDict
from flanker.mime.message.headers import encodedword
from flanker.mime.message.headers.parsing import normalize, parse_stream
from flanker.mime.message.headers.encoding import to_mime
from flanker.mime.message.errors import EncodingError
class MimeHeaders(object):
"""Diction... | EthanBlackburn/flanker | flanker/mime/message/headers/headers.py | Python | apache-2.0 | 4,810 | 0.000208 |
from django.template import Context, loader
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.auth.decorators import login_required
from django.views.decorators import cache
from workflow.ticket import forms
from workflow.ticket import models
from workflow.ticket import tickettree
import pp... | shlomimatichin/workflow | workflow/ticket/views.py | Python | gpl-3.0 | 10,924 | 0.065727 |
"""
Cairo test suite.
"""
import imp
import os
import cairosvg
reference_cairosvg = imp.load_source(
'cairosvg_reference', pathname=os.path.join(
os.path.dirname(__file__), 'cairosvg_reference', 'cairosvg',
'__init__.py'))
cairosvg.features.LOCALE = reference_cairosvg.features.LOCALE = 'en_US'
... | Kozea/CairoSVG | test_non_regression/__init__.py | Python | lgpl-3.0 | 796 | 0 |
# Copyright (c) 2014-2015 Brett Cannon <brett@python.org>
# Copyright (c) 2014-2016 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (c) 2015 Pavel Roskin <proski@gnu.org>
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/master/COPYING
... | arju88nair/projectCulminate | venv/lib/python3.5/site-packages/pylint/checkers/python3.py | Python | apache-2.0 | 38,460 | 0.00169 |
# coding=utf-8
# !/usr/bin/env python
try:
from setuptools import setup
except ImportError:
print('No setuptools installed, use distutils')
from distutils.core import setup
with open('requirements.txt') as f:
required = f.read().splitlines()
setup(
name='hokuyo-python-lib',
packages=[
... | old-paoolo/hokuyo-python-lib | setup.py | Python | mit | 1,228 | 0 |
import utils
class text_file:
lines = []
def gather_lines_from_file( filename ):
with open(filename) as f:
lines = f.readlines()
self.lines = lines
def discard_lines_from_file():
correct_lines = []
comment = False
asterisk = False
data_in_that_... | BielBdeLuna/idTechX_Python_API | text_file.py | Python | gpl-3.0 | 1,232 | 0.016234 |
from coalib.bearlib.abstractions.Linter import linter
from dependency_management.requirements.DistributionRequirement import (
DistributionRequirement)
@linter(executable='chktex',
output_format='regex',
output_regex=r'(?P<severity>Error|Warning) \d+ in .+ line '
r'(?P<line>\d... | IPMITMO/statan | coala-bears/bears/latex/LatexLintBear.py | Python | mit | 886 | 0 |
"""
This is a Pure Python module to hyphenate text.
It is inspired by Ruby's Text::Hyphen, but currently reads standard *.dic files,
that must be installed separately.
In the future it's maybe nice if dictionaries could be distributed together with
this module, in a slightly prepared form, like in Ruby's Text::Hyphe... | brownian/frescobaldi | frescobaldi_app/hyphenator.py | Python | gpl-2.0 | 8,884 | 0.001126 |
import logging
from django.conf import settings
from django.http import HttpResponse
from django.http.request import validate_host
from django.utils.http import is_safe_url
from httplib import HTTPConnection, HTTPSConnection
from urlparse import urlsplit
from geonode.geoserver.helpers import ogc_server_settings
logger... | state-hiu/rogue_geonode | geoshape/views.py | Python | gpl-3.0 | 3,021 | 0.001655 |
# -*- coding: utf-8 -*-
# Copyright(C) 2014 Bezleputh
#
# This file is part of a weboob module.
#
# This weboob module 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 Licen... | vicnet/weboob | modules/regionsjob/__init__.py | Python | lgpl-3.0 | 847 | 0 |
# 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/smaug | karbor/services/protection/client_factory.py | Python | apache-2.0 | 3,806 | 0 |
#!/usr/bin/env python3
# ====================================
# Copyright (c) Microsoft Corporation. All rights reserved.
# ====================================
"""Urllib2 HttpClient."""
import httplib
import socket
import time
import traceback
import urllib2
from httpclient import *
from workerexception import *
P... | MSFTOSSMgmt/WPSDSCLinux | Providers/nxOMSAutomationWorker/automationworker/3.x/worker/urllib2httpclient.py | Python | mit | 9,775 | 0.003581 |
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2005 (ita)
import ansiterm
import os, re, logging, traceback, sys
from Constants import *
zones = ''
verbose = 0
colors_lst = {
'USE' : True,
'BOLD' :'\x1b[01;1m',
'RED' :'\x1b[01;31m',
'GREEN' :'\x1b[32m',
'YELLOW':'\x1b[33m',
'PINK' :'\x1b[35m',
'BLUE' :'... | urisimchoni/samba | third_party/waf/wafadmin/Logs.py | Python | gpl-3.0 | 2,875 | 0.041739 |
# Copyright 2011 Jeff Garzik
#
# RawProxy has the following improvements over python-jsonrpc's ServiceProxy
# class:
#
# - HTTP connections persist for the life of the RawProxy object (if server
# supports HTTP/1.1)
# - sends protocol 'version', per JSON-RPC 1.1
# - sends proper, incrementing 'id'
# - sends Basic HTT... | petertodd/timelock | lib/python-bitcoinlib/bitcoin/rpc.py | Python | gpl-3.0 | 16,944 | 0.002833 |
import inspect
import sys
import types
from copy import deepcopy
import pickle as pypickle
try:
import cPickle as cpickle
except ImportError:
cpickle = None
if sys.version_info < (2, 6):
# cPickle is broken in Python <= 2.5.
# It unsafely and incorrectly uses relative instead of absolute imports,
... | mitsuhiko/celery | celery/serialization.py | Python | bsd-3-clause | 4,714 | 0.000636 |
# -*- test-case-name: xquotient.test.test_workflow -*-
"""
This module contains the core messaging abstractions for Quotient. L{Message},
a transport-agnostic message metadata representation, and L{MailboxSelector}, a
tool for specifying constraints for and iterating sets of messages.
"""
from os import path
import ... | twisted/quotient | xquotient/exmess.py | Python | mit | 95,030 | 0.002041 |
from .base import DerivedType
from categorical import CategoricalComparator
from .categorical_type import CategoricalType
class ExistsType(CategoricalType) :
type = "Exists"
_predicate_functions = []
def __init__(self, definition) :
super(CategoricalType, self ).__init__(definition)
... | tfmorris/dedupe | dedupe/variables/exists.py | Python | mit | 1,117 | 0.016115 |
"""
Given an integer, convert it to a roman numeral.
Input is guaranteed to be within the range from 1 to 3999.
"""
class Solution:
# @return a string
def intToRoman(self, num):
digits = [(1000, 'M'), (900, 'CM'), (500, 'D'), (400, 'CD' ),
(100, 'C'), (90, 'XC'), (50, 'L'), (40, 'XL'... | cyandterry/Python-Study | Ninja/Leetcode/12_Integer_to_Roman.py | Python | mit | 614 | 0.003257 |
# Copyright 2013 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 by applicable law or ... | GirlsCodePy/girlscode-coursebuilder | modules/search/search.py | Python | gpl-3.0 | 20,482 | 0.000244 |
import mUnit
from mUnit import UNIT_NONE, UNIT_SOLDIER, UNIT_BASE, UNIT_WORKER, UNITS, UNIT_RES
from mUnit import NoneUnit
from misc import mTimer
from misc.mLogger import log
from mCamp import Camp
LENGTH, HEIGTH = 20, 20
POPULATION_LIMIT = 20
class mArray(object):
def __init__(self, length, heigth):
self.lengt... | tristeen/RTS-Simulator | rts/mMap.py | Python | mit | 7,527 | 0.031088 |
# Generated by Django 2.2.11 on 2020-03-21 22:45
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('base', '0038_delete_backup'),
('base', '0039_auto_20200321_1338'),
]
operations = [
]
| tomkralidis/geonode | geonode/base/migrations/0040_merge_20200321_2245.py | Python | gpl-3.0 | 263 | 0 |
from proximityGraph import *
| ysig/BioClassSim | source/graph/__init__.py | Python | apache-2.0 | 29 | 0 |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class TiebaItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
pass
class ThreadItem(scrapy.Item):
... | fozzysec/tieba-keyword-spider | tieba/items.py | Python | bsd-3-clause | 730 | 0.00274 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | gibiansky/tensorflow | tensorflow/contrib/rnn/python/ops/rnn_cell.py | Python | apache-2.0 | 52,642 | 0.005813 |
from resumable import split, rebuild
import requests
def get(s):
return s
@rebuild
def example(_):
print('this is a good start')
value = split(requests.get, 'first')('http://ms.mause.me')
print(value.text)
value = split(lambda: 'hello', 'second')()
print('hello', value)
split(print... | Mause/resumable | main.py | Python | mit | 673 | 0 |
# -*- coding: utf-8 -*-
def archy( obj, prefix='', unicode=True):
def chr(s):
chars = {'\u000d' : '\n',
'\u2502' : '|',
'\u2514' : '`',
'\u251c' : '+',
'\u2500' : '-',
'\u252c' : '-'}
if not unicode:
re... | dcdanko/pyarchy | py_archy/py_archy.py | Python | mit | 1,433 | 0.010468 |
"""Standard setup for tests."""
from unittest.mock import Mock, patch
from pytest import fixture
from homeassistant import setup
from homeassistant.components.philips_js.const import DOMAIN
from . import MOCK_CONFIG, MOCK_ENTITY_ID, MOCK_NAME, MOCK_SERIAL_NO, MOCK_SYSTEM
from tests.common import MockConfigEntry, mo... | turbokongen/home-assistant | tests/components/philips_js/conftest.py | Python | apache-2.0 | 1,756 | 0.001708 |
SECRET_KEY = 'fake-key'
INSTALLED_APPS = [
'django.contrib.contenttypes',
'django.contrib.auth',
'django.contrib.sessions',
'tests',
'tests.unit'
]
ROOT_URLCONF = 'tests.integration.urls'
DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3'}}
| marcgibbons/drf_signed_auth | tests/settings.py | Python | bsd-2-clause | 275 | 0 |
import base64
import json
import unittest
from app import app
class AppTest(unittest.TestCase):
def setUp(self):
"""Setup method for spinning up a test instance of app"""
app.config['TESTING'] = True
app.config['WTF_CSRF_ENABLED'] = False
self.app = app.test_client()
self.... | seekheart/coder_api | tests/app_test.py | Python | mit | 5,800 | 0 |
import unittest
import numpy as np
from collections import Counter
from diogenes.utils import remove_cols,cast_list_of_list_to_sa
import utils_for_tests
import unittest
import numpy as np
from numpy.random import rand
import diogenes.read
import diogenes.utils
from diogenes.modify import remove_cols_where
from diog... | jamestwhedbee/diogenes | tests/test_modify.py | Python | mit | 8,979 | 0.012585 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from holmes.search_providers import SearchProvider
from holmes.models.review import Review
from tornado.concurrent import return_future
class NoExternalSearchProvider(SearchProvider):
def __init__(self, config, db, authnz_wrapper=None, io_loop=None):
self.db... | marcelometal/holmes-api | holmes/search_providers/noexternal.py | Python | mit | 2,143 | 0.0014 |
#!/usr/bin/env python
"""Test form submission"""
__email__ = "nicolas.maire@unibas.ch"
__status__ = "Alpha"
from lxml import etree
import urllib2
import uuid
import logging
DEVICE_ID = "8d:77:12:5b:c1:3c"
def submit_data(data, url):
"""Submit an instance to ODKAggregate"""
r = urllib2.Request(url, data=da... | SwissTPH/openhds-sim | submission.py | Python | gpl-2.0 | 13,836 | 0.006577 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/aio/_configuration.py | Python | mit | 3,400 | 0.004706 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.