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 |
|---|---|---|---|---|---|---|
# pylint: disable=missing-docstring
from smtplib import SMTPException
from unittest import mock
import pytest
import ddt
from django.db import IntegrityError
from django.test import TestCase
from openedx.core.djangoapps.api_admin.models import ApiAccessConfig, ApiAccessRequest
from openedx.core.djangoapps.api_admin... | edx/edx-platform | openedx/core/djangoapps/api_admin/tests/test_models.py | Python | agpl-3.0 | 6,287 | 0.003022 |
# -*- coding: utf-8 -*-
# Copyright 2013 Mirantis, 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 requi... | huntxu/fuel-web | nailgun/nailgun/rpc/__init__.py | Python | apache-2.0 | 2,731 | 0.000366 |
# Copyright 2014, 2015 SAP SE.
#
# 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,
#... | ralhei/PyHDB | tests/test_cursor.py | Python | apache-2.0 | 9,174 | 0.000545 |
"""
Intersects ... faster. Suports GenomicInterval datatype and multiple
chromosomes.
Copyright: James Taylor james@jamestaylor.org
This code is part of the bx-python package
license: bsd licensed
https://bitbucket.org/james_taylor/bx-python/src/ebf9a4b352d3267303657afd57bd184f379eaf28/lib/bx/intervals/operations/qui... | smartkiwi/interval_calculator | interval_calculator/bx/quicksect.py | Python | mit | 6,110 | 0.016858 |
"""
The managers for the custom Player object and permissions.
"""
import datetime
from functools import update_wrapper
from django.contrib.auth.models import User
from src.typeclasses.managers import returns_typeclass_list, returns_typeclass, TypedObjectManager
from src.utils import logger
__all__ = ("PlayerManager",... | TaliesinSkye/evennia | src/players/manager.py | Python | bsd-3-clause | 6,119 | 0.001307 |
# This file is autogenerated. Do not edit it manually.
# If you want change the content of this file, edit
#
# spec/fixtures/responses/whois.nic.asia/status_available
#
# and regenerate the tests with the following script
#
# $ scripts/generate_tests.py
#
from nose.tools import *
from dateutil.parser import parse... | huyphan/pyyawhois | test/record/parser/test_response_whois_nic_asia_status_available.py | Python | mit | 2,079 | 0.002886 |
import os
import nose
import django
NAME = os.path.basename(os.path.dirname(__file__))
ROOT = os.path.abspath(os.path.dirname(__file__))
os.environ['DJANGO_SETTINGS_MODULE'] = 'fake_settings'
os.environ['PYTHONPATH'] = os.pathsep.join([ROOT,
os.path.join(ROOT, 'examples')]... | jbalogh/jingo | run_tests.py | Python | bsd-3-clause | 522 | 0 |
# -*- coding: utf-8 -*-
###########################################################################
# Module Writen to OpenERP, Open Source Management Solution
#
# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com
# All Rights Reserved.
# info@vauxoo.com
#####################################################... | cgstudiomap/cgstudiomap | main/parts/product-attribute/product_customer_code/product.py | Python | agpl-3.0 | 3,314 | 0 |
#!/usr/bin/python
import sys
sys.path.insert(0, '/usr/local/lib/python2.7/site-packages/')
import mraa
import time
from twython import Twython
# Authentication - Obtain Authorization URL
APP_KEY = 'lXZFwVtC8CGPKs4LOuv2m7WGS'
APP_SECRET = 'AoToSyNNyhzg2EhN38Edx6bQ59wPSLH8ztLZNZkWt1us7IzKUl'
OAUTH_TOKEN = '2892359329-f... | HelloTechie/tweeting_turkey | turkey_tweet.py | Python | mit | 1,243 | 0.00885 |
"""
main.py
The central entry point of the auacm app.
"""
import requests, sys, textwrap
import auacm
import auacm.utils as utils
from auacm.exceptions import ConnectionError, ProblemNotFoundError, UnauthorizedException, InvalidSubmission, CompetitionNotFoundError
def main(args):
"""
Entry point for the auac... | BrandonLMorris/auacm-cli | src/auacm/main.py | Python | mit | 2,810 | 0.001068 |
p<caret>
pass | hurricup/intellij-community | python/testData/codeInsight/liveTemplates/context/general.py | Python | apache-2.0 | 13 | 0.230769 |
from setuptools import setup
from controlhost import version
setup(name='controlhost',
version=version,
url='https://github.com/tamasgal/controlhost/',
description='A set of classes and tools wich uses the ControlHost protocol.',
author='Tamas Gal',
author_email='himself@tamasgal.com',
... | tamasgal/controlhost | setup.py | Python | mit | 751 | 0.003995 |
# -*- coding: utf-8 -*-
import inlineplz.linters.jsonlint as jsonlint
def test_jsonlint():
input = [
("21.json", "21.json: line 1, col 25, found: ',' - expected: ':'."),
(
"25.json",
"25.json: line 1, col 1, found: 'INVALID' - expected: 'STRING', 'NUMBER', 'NULL', 'TRUE', ... | guykisel/inline-plz | tests/parsers/test_jsonlint.py | Python | isc | 753 | 0.003984 |
#!/usr/bin/env python
#
# Copyright 2013 cloudysunny14.
#
# 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... | cloudysunny14/CloudySwitch | cloudyswitch/app/topology_util.py | Python | apache-2.0 | 2,860 | 0.003846 |
import bson
import bson.errors
import superdesk
from .update_topics import UpdateTopicsScript
from .update_places import UpdatePlacesScript
RESOURCES = ('events', 'planning', 'archive', 'published', 'archived')
SCRIPTS = [
("topics", UpdateTopicsScript()),
("places", UpdatePlacesScript()),
]
def get_id(i... | superdesk/superdesk-ntb | server/ntb/commands/update_items.py | Python | agpl-3.0 | 2,412 | 0.001244 |
#!/usr/bin/env python
#
# Copyright 2010 Communications Engineering Lab, KIT
#
# This 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.
#
# This softwar... | robertwatsonbath/gr-specest-3.7 | python/specest_mtm.py | Python | gpl-3.0 | 4,472 | 0.006485 |
# -*- coding:utf-8 -*-
import scrapy
from report_crawler.spiders.__Global_function import get_localtime
from report_crawler.spiders.__Global_variable import now_time, end_time
class HNU001_Spider(scrapy.Spider):
name = 'HNU001'
start_urls = ['http://csee.hnu.edu.cn/Front/TZXX_List?LMXX_BH=20130728174138ec48068e-48b... | AnselCmy/ARPS | report_crawler/report_crawler/spiders/spiders_001/_H/HNU001.py | Python | mit | 1,423 | 0.020334 |
from .. import NogginConstants
from . import PBConstants
from . import Formations
def sReady(team, workingPlay):
workingPlay.setStrategy(PBConstants.S_READY)
Formations.fReady(team, workingPlay)
def sNoFieldPlayers(team, workingPlay):
workingPlay.setStrategy(PBConstants.S_NO_FIELD_PLAYERS)
Formations.... | northern-bites/nao-man | noggin/playbook/Strategies.py | Python | gpl-3.0 | 4,793 | 0.005216 |
#!/usr/bin/env python
"""
The SNMP module performs snmp-related
enumeration tasks.
@author: Gabor Seljan (gabor<at>seljan.hu)
@version: 1.0
"""
import sys
from ..config import Config
from ..process_manager import ProcessManager
from ..generic_service import GenericService
class SnmpEnumeration(GenericService, Proces... | sgabe/Enumerator | enumerator/lib/services/snmp.py | Python | mit | 2,455 | 0.002037 |
import pygame
pygame.mixer.init()
sound_object = pygame.mixer.Sound("sound/beep1.ogg")
sound_object.set_volume(1)
| sontung/pick_a_number | sound/click_sound.py | Python | mit | 116 | 0 |
"""Support for MySensors sensors."""
from homeassistant.components import mysensors
from homeassistant.components.sensor import DOMAIN
from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT
SENSORS = {
'V_TEMP': [None, 'mdi:thermometer'],
'V_HUM': ['%', 'mdi:water-percent'],
'V_DIMMER': ['%', 'mdi:p... | HydrelioxGitHub/home-assistant | homeassistant/components/mysensors/sensor.py | Python | apache-2.0 | 2,939 | 0 |
from functools import partial
from django.contrib.admin.sites import AdminSite
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse
from django.test import TestCase
from mock import patch
from opendebates.admin import SubmissionAdmin
from opendebates.models import Submission
from ... | caktus/django-opendebates | opendebates/tests/test_admin.py | Python | apache-2.0 | 4,608 | 0.001085 |
from typing import Any, Dict, Optional
from flask import g, render_template, url_for
from flask_babel import format_number, lazy_gettext as _
from flask_wtf import FlaskForm
from wtforms import (
BooleanField, IntegerField, SelectMultipleField, StringField, SubmitField,
widgets)
from wtforms.validators import ... | craws/OpenAtlas-Python | openatlas/views/model.py | Python | gpl-2.0 | 9,096 | 0 |
# ReadSensorsOwfs.py
###########################################################
# Class handles loading of thermometer sensor information #
# from the interface exposed by the owfs fuse #
# module. #
##########################################################... | tuanchien/tascc | modules/ReadSensorsOwfs.py | Python | gpl-2.0 | 796 | 0.016332 |
# -*- coding: utf-8 -*-
"""SQLite parser plugin for Mozilla Firefox history database files."""
from dfdatetime import posix_time as dfdatetime_posix_time
from plaso.containers import events
from plaso.containers import time_events
from plaso.lib import definitions
from plaso.parsers import sqlite
from plaso.parsers.s... | joachimmetz/plaso | plaso/parsers/sqlite_plugins/firefox_history.py | Python | apache-2.0 | 19,252 | 0.003324 |
"""
Editor Module
This module defines the Editor class. This module runs
the game's level editor.
"""
import sys, os
import tkinter as tk
from tkinter.filedialog import askopenfilename, asksaveasfilename
from .. import asset
from ..config import START_LEVEL, LEVEL_PATH
from .brick import BrickFrame
from .entry impo... | Oisota/Breakout | breakout/editor/editor.py | Python | gpl-3.0 | 3,858 | 0.005962 |
''' Data model and factory implementations that are backed by Amazon Web Service's DynamoDB2 NoSQL database '''
from boto.dynamodb2.table import Table
from time import strftime, strptime
from smcity.misc.errors import CreateError, ReadError
from smcity.misc.logger import Logger
from smcity.models.data import Data, Da... | ChaseSnapshot/smcity | smcity/models/aws/aws_data.py | Python | unlicense | 6,158 | 0.006983 |
import os, sys, py
from rpython.tool.udir import udir
from rpython.rlib.jit import JitDriver, unroll_parameters, set_param
from rpython.rlib.jit import PARAMETERS, dont_look_inside
from rpython.rlib.jit import promote, _get_virtualizable_token
from rpython.rlib import jit_hooks, rposix, rgc
from rpython.rlib.objectmode... | oblique-labs/pyVM | rpython/jit/backend/llsupport/test/ztranslation_test.py | Python | mit | 11,930 | 0.004946 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# rdiffweb, A web interface to rdiff-backup repositories
# Copyright (C) 2014 rdiffweb contributors
#
# 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, ei... | sbellver/rdiffweb | rdiffweb/page_prefs.py | Python | gpl-3.0 | 5,423 | 0 |
from argparse import ArgumentParser
VERSION = "2.0.0"
def parse_args():
"""Parse args with argparse
:returns: args
"""
parser = ArgumentParser(description=f"Pymage Downloader {VERSION} - Download pics from different sites")
build_site_subparsers(parser)
parser.add_argument('--destination', ... | CharlieCorner/pymage_downloader | argparsers.py | Python | apache-2.0 | 5,447 | 0.00257 |
#!/usr/bin/env python
import sys
import gzip
import paddle.v2 as paddle
### Parameters
word_vector_dim = 620
latent_chain_dim = 1000
beam_size = 5
max_length = 50
def seq2seq_net(source_dict_dim, target_dict_dim, generating=False):
'''
Define the network structure of NMT, including encoder and decoder.
... | zhaopu7/models | nmt_without_attention/nmt_without_attention.py | Python | apache-2.0 | 8,713 | 0.000574 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# =============================================================================
# PAQUETE: instalador
# ARCHIVO: instalador/config.py
# COPYRIGHT:
# (C) 2012 William Abrahan Cabrera Reyes <william@linux.es>
# (C) 2012 Erick Manuel Birbe Salazar <erickcion@gmai... | willicab/instalador | instalador/clases/particiones.py | Python | gpl-2.0 | 15,469 | 0.001685 |
# script to validate h5gate schema files using json schema
import os.path
import sys
# import json
import jsonschema
import ast
def load_schema(file_name):
""" Load Python file that contains JSON formatted as a Python dictionary.
Files in this format are used to store the schema because, unlike pure JSON,
... | NeurodataWithoutBorders/api-python | nwb/check_schema.py | Python | bsd-3-clause | 2,669 | 0.010116 |
KEYIDS = {
"KEY_RESERVED": 0,
"KEY_ESC": 1,
"KEY_1": 2,
"KEY_2": 3,
"KEY_3": 4,
"KEY_4": 5,
"KEY_5": 6,
"KEY_6": 7,
"KEY_7": 8,
"KEY_8": 9,
"KEY_9": 10,
"KEY_0": 11,
"KEY_MINUS": 12,
"KEY_EQUAL": 13,
"KEY_BACKSPACE": 14,
"KEY_TAB": 15,
"KEY_Q": 16,
"KEY_W": 17,
"KEY_E": 18,
"KEY_R": 19,
"KEY_T": 20,
"KEY_Y": 21,
"KEY_U... | openhdf/enigma2-wetek | keyids.py | Python | gpl-2.0 | 5,381 | 0.057053 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
class ExampleConfig(AppConfig):
name = 'example'
| vaibhav-singh/django-travis-setup | django_travis_setup/example/apps.py | Python | mit | 154 | 0 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | DaanHoogland/cloudstack | systemvm/debian/opt/cloud/bin/cs_forwardingrules.py | Python | apache-2.0 | 3,239 | 0.000617 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2012 Dag Wieers <dag@wieers.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = r'''
---
module: debug
short_... | Fale/ansible | lib/ansible/modules/debug.py | Python | gpl-3.0 | 2,420 | 0.003719 |
# Copyright (c) 2016 Claudiu Popa <pcmanticore@gmail.com>
# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
# For details: https://github.com/PyCQA/astroid/blob/master/COPYING.LESSER
import sys
import textwrap
import six
import astroid
PY33 = sys.version_info >= (3, 3)
PY36 = s... | arju88nair/projectCulminate | venv/lib/python3.5/site-packages/astroid/brain/brain_subprocess.py | Python | apache-2.0 | 3,314 | 0.001509 |
## @package last_n_window_collector
# Module caffe2.python.layers.last_n_window_collector
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import core, schema
from caffe2.python.layers.layers import M... | ryfeus/lambda-packs | pytorch/source/caffe2/python/layers/last_n_window_collector.py | Python | mit | 2,543 | 0.000393 |
# Copyright 2018 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 ... | deepmind/pysc2 | pysc2/lib/buffs.py | Python | apache-2.0 | 2,114 | 0.022706 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | asimshankar/tensorflow | tensorflow/python/data/experimental/benchmarks/rejection_resample_benchmark.py | Python | apache-2.0 | 2,449 | 0.004492 |
class NodeVisitor:
def visit(self, node, *args):
try:
return getattr(self, 'visit_' + node.__class__.__name__)(node, *args)
except AttributeError:
pass
for child in node.iter_child_nodes():
self.visit(child, *args)
| nnabeyang/MY_jinja2 | MY_jinja2/visitor.py | Python | bsd-3-clause | 247 | 0.016194 |
# created based on
# https://python-packaging.readthedocs.io/en/latest/minimal.html
# But instead of python setup.py register sdist upload,
# use https://pypi.org/p/twine/
#
from setuptools import setup
import sys
import os
import re
sys.path.append("src")
def read(fname):
try:
return open(os.path.join... | KlausPopp/Moddy | setup.py | Python | lgpl-3.0 | 1,397 | 0 |
__author__ = "Sunil Kumar (kumar.sunil.p@gmail.com)"
__copyright__ = "Copyright 2014, Washington University in St. Louis"
__credits__ = ["Sunil Kumar", "Steve Pieper", "Dan Marcus"]
__license__ = "XNAT Software License Agreement " + \
"(see: http://xnat.org/about/license.php)"
__version__ = "2.1.1"
__main... | MokaCreativeLLC/XNATSlicer | XNATSlicer/XnatSlicerLib/ui/FolderMaker.py | Python | bsd-3-clause | 18,465 | 0.006986 |
from bs4 import BeautifulSoup
from models.course import Course
import requests
default_postdata = {
'CAMPUS': '0',
'TERMYEAR': '201709',
'CORE_CODE': 'AR%',
'subj_code': '',
'CRSE_NUMBER': '',
'crn': '',
'open_only': 'on',
'BTN_PRESSED': 'FIND class sections',
}
url = 'https://banweb.b... | amhokies/Timetable-Stalker | course_search.py | Python | mit | 2,048 | 0.000488 |
"""
Initialization of utils.
Couple handy-dandy functions:
"""
from __future__ import absolute_import
from . import basics
from . import blender
from . import math | marklescroart/bvp | bvp/utils/__init__.py | Python | bsd-2-clause | 165 | 0.012121 |
from mpi4py import MPI
from utils.mpi_helper import finalize
from utils.mpi_helper import init
init()
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size()
print "process [", rank, "] - running"
if rank == 0:
data = {'name': "PROCESS-" + str(rank), 'msg': "Hello"}
req = comm.isend(data, dest=... | balolam/university-mpi-python | practical_task_1/task2.py | Python | apache-2.0 | 516 | 0.001938 |
"""
==========================================================================
Illustration of prior and posterior Gaussian process for different kernels
==========================================================================
This example illustrates the prior and posterior of a
:class:`~sklearn.gaussian_process.Ga... | huzq/scikit-learn | examples/gaussian_process/plot_gpr_prior_posterior.py | Python | bsd-3-clause | 8,547 | 0.001989 |
import tempfile
import numpy as np
import h5py
from ..database import db
from ..xfm import Transform
from .braindata import _hdf_write
from .views import normalize as _vnorm
from .views import Dataview, Volume, _from_hdf_data
class Dataset(object):
"""
Wrapper for multiple data objects. This often does not n... | gallantlab/pycortex | cortex/dataset/dataset.py | Python | bsd-2-clause | 8,008 | 0.003746 |
import os
import sys
import numpy as np
from giss.ncutil import copy_nc
import netCDF4
import argparse
from modele.constants import SHI,LHM,RHOI,RHOS,UI_ICEBIN,UI_NOTHING
parser = argparse.ArgumentParser(description='Convert GIC file for old snow/firn model to one for Stieglitz.')
parser.add_argument('igic',
help... | citibeth/twoway | stieglitz/gic2stieglitz.py | Python | gpl-3.0 | 1,293 | 0.010054 |
# -*- coding: utf-8 -*-
###############################################################################
# wannabetabs by dgelessus
###############################################################################
import editor
import os
import ui
def full_path(path):
# Return absolute path with expanded ~ and symli... | dgelessus/pythonista-scripts | wannabetabs.py | Python | mit | 2,450 | 0.006531 |
import logging
from event_consumer.conf import settings
from event_consumer.errors import PermanentFailure
from event_consumer.handlers import message_handler
_logger = logging.getLogger(__name__)
class IntegrationTestHandlers(object):
"""
Basic message handlers that log or raise known exceptions to allow
... | depop/celery-message-consumer | event_consumer/test_utils/handlers.py | Python | apache-2.0 | 1,527 | 0 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | szha/mxnet | tests/python/gpu/test_kvstore_gpu.py | Python | apache-2.0 | 6,074 | 0.003787 |
import io
from pytest import fixture
class _FakeOutputFile(io.StringIO):
def close(self):
self.contents = self.getvalue()
super().close()
@fixture
def fake_output_file():
return _FakeOutputFile()
type_example_values = {
"none": (None,),
"callable": (lambda: None,),
"bool": (T... | nre/Doxhooks | tests/unit_tests/conftest.py | Python | mit | 1,575 | 0 |
"""
Jump Search
Find an element in a sorted array.
"""
import math
def jump_search(arr,target):
"""
Worst-case Complexity: O(√n) (root(n))
All items in list must be sorted like binary search
Find block that contains target value and search it linearly in that block
It returns a first target valu... | keon/algorithms | algorithms/search/jump_search.py | Python | mit | 1,064 | 0.00565 |
"""
Generic remote sensing based ET potential using radiation
"""
def solarday(latitude, doy, tsw ):
"""
Average Solar Diurnal Radiation after Bastiaanssen (1995)
tsw = 0.7 generally clear-sky Single-way transmissivity of the atmosphere [0.0-1.0]
solarday(latitude, doy, tsw )
"""
PI=3.1415927
ds = 1.0 + 0.01672 ... | YannChemin/wxGIPE | RS_functions/evapo_pot_rs.py | Python | unlicense | 2,337 | 0.035944 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
author: sanja7s
---------------
plot the distribution
"""
import os
import datetime as dt
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from collections import defaultdict
from matplotlib import colors
from pylab import MaxN... | sanja7s/EEDC | src/timelines/node_plug_timeline.py | Python | apache-2.0 | 10,157 | 0.033278 |
from pathlib import Path
class MarkdownParser():
def __init__(self, text):
self.text = text
self.lines = text.split('\n')
def title(self):
return self.lines[0].split(' ')[1]
def header(self, name, level, include_header=False):
start = False
end = False
co... | AnthonyCalandra/modern-cpp-features | auto-generate-readme.py | Python | mit | 2,305 | 0.000868 |
# -*- coding: utf-8 -*-
from emojibot.utils.response import Response
def test_constructor():
response = Response()
assert isinstance(response, Response)
| gramhagen/emojibot | tests/utils/test_response.py | Python | mit | 164 | 0 |
import sys
import os
import pkg_resources
VERSION = 0.5
script_path = os.path.dirname(sys.argv[0])
def resource_path(relative_path):
base_path = getattr(sys, '_MEIPASS', script_path)
full_path = os.path.join(base_path, relative_path)
if os.path.isfile(full_path):
return full_path
else:
... | JiapengLi/pqcom | pqcom/util.py | Python | mit | 387 | 0.002584 |
from secret import GOOGLE_API_KEY
from datetime import datetime
from util.arguments import Arguments
from discord.ext import commands
from shlex import split
from util.choices import enum
from collections import namedtuple
import util
import re
import urllib
import discord
class Portables:
def __init__(self, bot... | duke605/RunePy | commands/portables.py | Python | mit | 4,554 | 0.002855 |
import datetime
from string import Template
import robocompdsl.dsl_parsers.parsing_utils as p_utils
from robocompdsl.templates.templateCPP.plugins.base.functions import function_utils as utils
from robocompdsl.templates.common.templatedict import TemplateDict
AGM_INNERMODEL_ASSOCIATION_STR = """\
innerModel = std::ma... | robocomp/robocomp | tools/cli/robocompdsl/robocompdsl/templates/templateCPP/plugins/agm/functions/src/specificworker_cpp.py | Python | gpl-3.0 | 3,615 | 0.018534 |
class Config:
def __init__(self):
self.basename = 'raw_data_N2'
self.directory = '~/orchard/data'
self.topics = ['/multi_tracker/2/tracked_objects']
| florisvb/multi_tracker | examples/demo/demo_2/src/raw_data_bag_config.py | Python | mit | 177 | 0 |
import dateparser
from datetime import date
class Citation:
FIELDS = {
'type': str,
'url': str,
'title': str,
'date': date,
'accessdate': date,
'year': int,
'authors': list,
'editors': list,
'publisher': str,
'work': str,
'web... | zhaofengli/refill | backend/refill/models/citation.py | Python | bsd-2-clause | 5,016 | 0.001595 |
from django.shortcuts import render
def about(request):
return render(request, "about.html", {})
def location(request):
return render(request, "location.html", {})
def failure(request):
return render(request, "failure.html", {})
| apul1421/table-client-side-app-retake | src/ecommerce2/views.py | Python | gpl-3.0 | 237 | 0.016878 |
#
# 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
# ... | rh-s/heat | heat/engine/scheduler.py | Python | apache-2.0 | 18,011 | 0.000056 |
from multiupload.fields import MultiUploadMetaField, MultiUploadMetaInput
from django import forms
from dal import autocomplete
from . import models
# Django 2 fix (https://github.com/Chive/django-multiupload/issues/31)
class PatchedMultiUploadMetaInput(MultiUploadMetaInput):
def render(self, name, value, attrs=... | WebArchivCZ/Seeder | Seeder/harvests/forms.py | Python | mit | 3,363 | 0.000297 |
# Copyright 2017 The UAI-SDK 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 applicable... | ucloud/uai-sdk | uaitrain_tool/caffe/caffe_tool.py | Python | apache-2.0 | 3,505 | 0.003138 |
from django.contrib import admin
from nonprofit.mailroom.models import Slot
class SlotAdmin(admin.ModelAdmin):
list_display = ('description','forward_to','enabled')
admin.site.register(Slot, SlotAdmin) | sunlightlabs/django-nonprofit | nonprofit/mailroom/admin.py | Python | bsd-3-clause | 207 | 0.024155 |
"""
Managing Gateway Groups and interactions with multiple channels.
(c) 2008-2014, Holger Krekel and others
"""
import sys, atexit
from execnet import XSpec
from execnet import gateway_io, gateway_bootstrap
from execnet.gateway_base import reraise, trace, get_execmodel
from threading import Lock
NO_ENDMARKER_WANTE... | LaoQi/icode | mypylib/remoto/lib/vendor/execnet/multi.py | Python | gpl-2.0 | 10,046 | 0.001294 |
import inspect
import functools
class DependencyNode:
def __init__(self, cls, cached):
self.cls = cls
self.deps = self.get_deps(cls)
self.cached = cached
def get_deps(self, cls):
try:
return inspect.getargspec(cls.__init__).args[1:]
except Attr... | sbergot/invok | invok/DependencyNode.py | Python | bsd-3-clause | 552 | 0.001812 |
#! /usr/bin/env python
'''
Recursively looks for EPD
Writes to STDOUT and STDERR the found library and the found include directory. In this way,
this script can be executed within CMAKE and the Python Libraries and Includes can be set to the STDOUT and STDERR streams
Checks for a minimum version of Python, default 2.... | LAIRLAB/libpyarr | find_epd.py | Python | bsd-3-clause | 2,436 | 0.007389 |
#!/usr/bin/env python
"""
You can precisely specify dashes with an on/off ink rect sequence in
points.
"""
from pylab import *
dashes = [5,2,10,5] # 5 points on, 2 off, 3 on, 1 off
l, = plot(arange(20), '--')
l.set_dashes(dashes)
savefig('dash_control')
show()
| sniemi/SamPy | sandbox/src1/examples/dash_control.py | Python | bsd-2-clause | 264 | 0.015152 |
# -*- coding: ISO-8859-15 -*-
from core.Uusipuu import UusipuuModule
import random, time
class Module(UusipuuModule):
def startup(self):
if 'memo' not in self.config:
self.config['memo'] = {}
def privmsg(self, user, target, msg):
if target != self.channel:
return
... | desaster/uusipuu | modules/memo.py | Python | bsd-2-clause | 3,945 | 0.001267 |
#!/usr/bin/env python
# =========================================================================
#
# Copyright NumFOCUS
#
# 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:/... | richardbeare/SimpleITK | Examples/SliceBySliceDecorator/SliceBySliceDecorator.py | Python | apache-2.0 | 2,991 | 0.002675 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
__author__ = "Bharat Medasani"
__copyright__ = "Copyright 2013, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "bkmedasani@lbl.gov"
__date__ = "Aug 2, 2013"
import os... | gmatteo/pymatgen | pymatgen/io/tests/test_zeopp.py | Python | mit | 11,239 | 0.000623 |
import numpy as np
import pandas as pd
from sklearn.linear_model import LinearRegression
import matplotlib.pyplot as plt
num_arsa=120
np.random.seed(40)
x = np.random.randint(low=200,high=2000,size=num_arsa)
np.random.seed(40)
y = x*100.0+np.random.randint(low=10000,high=100000,size=num_arsa)
print(x)
print(y)
... | zinderud/ysa | sklearn/3.py | Python | apache-2.0 | 655 | 0.044615 |
#!/usr/bin/env python
"""An example of generating a test database with a large number of semi-randomized responses.
This is useful, for example, for reproducing issues that only occur with large caches.
"""
import logging
from datetime import datetime, timedelta
from os import urandom
from os.path import getsize
from r... | reclosedev/requests-cache | examples/generate_test_db.py | Python | bsd-2-clause | 4,628 | 0.002377 |
# Copyright (c) 2012 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functionality ... | tiagormk/gem5-hmp | configs/common/Caches.py | Python | bsd-3-clause | 3,250 | 0.001231 |
import unittest
import ctypes as ct
import ast
import sys
from ctree.transformations import PyBasicConversions
from ctree.transforms import DeclarationFiller
from ctree.c.nodes import *
class TestAssigns(unittest.TestCase):
def mini_transform(self, node):
"""
This method acts as a simulation of... | ucb-sejits/ctree | test/test_lambda.py | Python | bsd-2-clause | 2,548 | 0.009812 |
#!/usr/bin/env python
#
# Appcelerator Titanium Plugin Packager
#
#
import os, sys, glob, string
import zipfile
cwd = os.path.dirname(__file__)
required_plugin_keys = ['version','pluginid','description','copyright','license','minsdk']
plugin_defaults = {
'description':'My plugin',
'author': 'Your Name',
'license' :... | appcelerator/titanium_mobile_tooling | templates/plugin/build.py | Python | apache-2.0 | 2,990 | 0.049498 |
# --------------------------------------------------------------------------------------------
# Copyright (c) jehama. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------------------------------------------------------... | jehama/OSINThadoop | FieldModifiers/edit_heartbleed_timestamp.py | Python | mit | 4,926 | 0.005075 |
# Generated by Django 3.2.4 on 2021-06-05 15:46
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('django_pagarme', '0004_pagarme_item_config_available_until'),
('memberkit', '0001_initial'),
]
operations = ... | pythonprobr/pythonpro-website | pythonpro/memberkit/migrations/0002_create_relationship_with_payment_config_item.py | Python | agpl-3.0 | 1,292 | 0.004644 |
import ast
from os.path import expanduser
from stevedore import extension
from common import common_functions
from common import fm_logger
from dbmodule.objects import app as app_db
from dbmodule.objects import environment as env_db
from server.server_plugins.gcloud import gcloud_helper
home_dir = expanduser("~")
A... | cloud-ark/cloudark | server/gcloud_handler.py | Python | apache-2.0 | 4,809 | 0.001248 |
from django import template
from django.template.defaultfilters import stringfilter
import locale
register = template.Library()
#-----------\
# FILTERS |
#-----------/
@register.filter
@stringfilter
def num_format(value, places = 2, min_places = 2):
return format(value, '.', int(places), 3, ',', int(min_places))... | fxdemolisher/frano | frano/templatetags/frano_filters.py | Python | mit | 2,315 | 0.015119 |
#!/usr/bin/env python
import copy
from cStringIO import StringIO
from fnmatch import fnmatch
import gzip
import hashlib
import mimetypes
import os
import boto
from boto.s3.key import Key
from boto.s3.connection import OrdinaryCallingFormat
import app_config
GZIP_FILE_TYPES = ['.html', '.js', '.json', '.css', '.xml'... | stlpublicradio/ferguson-project | fabfile/flat.py | Python | mit | 3,519 | 0.002558 |
"""
This is a typical script to reconstruct one frame of a movie using a mosaic
of other frames with the Python package Pompei. It generates this picture of
general Maximus in Gladiator using 1100+ frames of the movie.
http://i.imgur.com/Eoglcof.jpg
This script goes in five steps:
1. Extract one frame every 5 second... | Zulko/pompei | examples/typical_script.py | Python | mit | 4,324 | 0.006475 |
# -*- coding: utf-8 -*-
#
# 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
#... | r39132/airflow | tests/test_utils.py | Python | apache-2.0 | 3,597 | 0.001112 |
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
name: auto
author:
- Matt Davis (@nitzmahone)
version_added: "... | maxamillion/ansible | lib/ansible/plugins/inventory/auto.py | Python | gpl-3.0 | 2,372 | 0.005481 |
"""Since cyme works as a contained Django APP, this is the default settings
file used when cyme is used outside of a Django project context."""
from __future__ import absolute_import
import os
import djcelery
djcelery.setup_loader()
DEBUG = True
# Broker settings.
BROKER_HOST = 'amqp://127.0.0.1:5672//'
BROKER_POOL... | celery/cyme | cyme/settings.py | Python | bsd-3-clause | 1,738 | 0 |
"""Support for MySensors binary sensors."""
from homeassistant.components import mysensors
from homeassistant.components.binary_sensor import (
DEVICE_CLASSES, DOMAIN, BinarySensorDevice)
from homeassistant.const import STATE_ON
SENSORS = {
'S_DOOR': 'door',
'S_MOTION': 'motion',
'S_SMOKE': 'smoke',
... | jnewland/home-assistant | homeassistant/components/mysensors/binary_sensor.py | Python | apache-2.0 | 1,398 | 0 |
# Copyright (c) 2006-2013 Regents of the University of Minnesota.
# For licensing terms, see the file LICENSE.
import traceback
import conf
import g
from grax.access_level import Access_Level
from gwis.exception.gwis_nothing_found import GWIS_Nothing_Found
from item import item_base
from item import item_user_access... | lbouma/Cyclopath | pyserver/item/item_user_watching.py | Python | apache-2.0 | 18,252 | 0.014464 |
#
# bootloader_main_gui.py: gui bootloader configuration dialog
#
# Copyright (C) 2001, 2002 Red Hat, Inc. All rights reserved.
#
# 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... | Rogentos/legacy-anaconda | iw/bootloader_main_gui.py | Python | gpl-2.0 | 8,647 | 0.004048 |
from __future__ import absolute_import
import os.path
import sys
from datetime import datetime
from prospector import tools, blender, postfilter
from prospector.config import ProspectorConfig, configuration as cfg
from prospector.finder import find_python
from prospector.formatters import FORMATTERS
from prospector.m... | pahaz/prospector | prospector/run.py | Python | gpl-2.0 | 4,952 | 0.000808 |
# Copyright (c) 2003-2005 Maxim Sobolev. All rights reserved.
# Copyright (c) 2006-2007 Sippy Software, Inc. All rights reserved.
#
# This file is part of SIPPY, a free RFC3261 SIP stack and B2BUA.
#
# SIPPY is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License a... | samrussell/sippy | sippy/ESipHeaderIgnore.py | Python | gpl-2.0 | 1,217 | 0 |
# -*- coding: utf-8 -*-
# ########################## Copyrights and license ############################
# #
# Copyright 2012 Steve English <steve.english@navetas.com> #
# Copyright 2012 Vincent Jacques <vincent@vincent-ja... | b0ttl3z/SickRage | lib/github/Organization.py | Python | gpl-3.0 | 29,379 | 0.00337 |
import os
import subprocess
import sys
from io import BytesIO
from translate.storage import factory, mo, test_base
class TestMOUnit(test_base.TestTranslationUnit):
UnitClass = mo.mounit
def test_context(self):
unit = self.UnitClass("Message")
unit.setcontext('context')
assert unit.ge... | diorcety/translate | translate/storage/test_mo.py | Python | gpl-2.0 | 4,281 | 0.003504 |
import calendar
import collections
try:
from collections.abc import Iterable
except:
from collections import Iterable
from time import strptime
from six import string_types
from lxml import etree
from itertools import chain
def remove_namespace(tree):
"""
Strip namespace from parsed XML
"""
fo... | titipata/pubmed_parser | pubmed_parser/utils.py | Python | mit | 4,118 | 0.001943 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
ensure.py
Author: yupbank
Email: yupbank@gmail.com
Created on
2013-09-30
'''
import sh
import os
import sys
def ubuntu_install(package):
return os.popen('sudo apt-get install %s -y'%package)
OP_F = {
"Linux": ubuntu_install
}
OP_PACKAGE = {
... | yupbank/onekeyvpn | ensure.py | Python | bsd-3-clause | 690 | 0.015942 |
from collections import OrderedDict
from django.http import HttpResponse
import simplejson
class JSONMixin(object):
"""This class was designed to be inherited and used to return JSON objects from an Ordered Dictionary
"""
## Ordered Dictionary used to create serialized JSON object
# return_rderedDict(... | vecnet/vnetsource | datawarehouse/mixins.py | Python | mpl-2.0 | 1,115 | 0.007175 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.