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 django.shortcuts import render_to_response
from django.template import RequestContext
import json
# Create your views here.
import importlib
from django.http import HttpResponse
from django_markup.markup import formatter
def build_doc(request):
try:
from project.settings import API_OBJECT_LOCATION
... | matheuscas/django-tastypie-simple-api-doc | tastypie_api_doc/views.py | Python | mit | 1,877 | 0.006393 |
from __future__ import absolute_import
import six
from django.db.models import signals
from django.db.models.fields import BigIntegerField, Field
from bitfield.forms import BitFormField
from bitfield.query import BitQueryLookupWrapper
from bitfield.types import Bit, BitHandler
# Count binary capacity. Truncate "0b"... | looker/sentry | src/bitfield/models.py | Python | bsd-3-clause | 9,135 | 0.000876 |
# #!/usr/bin/env python
# -*- coding: utf-8 -*-
# <HTTPretty - HTTP client mock for Python>
# Copyright (C) <2011-2018> Gabriel Falcão <gabriel@nacaolivre.org>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to ... | andresriancho/HTTPretty | tests/functional/test_passthrough.py | Python | mit | 2,551 | 0.001176 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os.path
# Hack for import module in grandparent folder
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
import unittest
from SnsManager import ErrorCode
from SnsManager.twitter import TwitterBase
CONSUMER_KEY = 'ZglRcsve... | waveface/SnsManager | tests/it_TwitterBase.py | Python | bsd-3-clause | 1,730 | 0.00578 |
# Base classes for ASN.1 types
import sys
from pyasn1.type import constraint, tagmap
from pyasn1 import error
class Asn1Item: pass
class Asn1ItemBase(Asn1Item):
# Set of tags for this ASN.1 type
tagSet = ()
# A list of constraint.Constraint instances for checking values
subtypeSpec = constraint.Const... | jt6562/XX-Net | python27/1.0/lib/noarch/pyasn1/type/base.py | Python | bsd-2-clause | 9,450 | 0.002011 |
'''
mrtparse - MRT format data parser
Copyright (C) 2022 Tetsumune KISO
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 applicabl... | t2mune/mrtparse | mrtparse/base.py | Python | apache-2.0 | 9,331 | 0.001608 |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import os,time
driver = webdriver.Chrome()
driver.get('http://www.ciliba.org/s/MDB-740.html')
time.sleep(3)
driver.execute("confirm")
print(driver.page_source)
driver.close()
driver.quit() | pythonlittleboy/python_gentleman_crawler | test/seleium2.py | Python | apache-2.0 | 268 | 0.011194 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in complianc... | ChinaMassClouds/copenstack-server | openstack/src/nova-2014.2/nova/virt/ovirt/firewall.py | Python | gpl-2.0 | 13,628 | 0.000073 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib
from xml.etree.ElementTree import parse
from optparse import OptionParser
from pyproj import Geod
def adr2geo(adr):
api = "http://www.geocoding.jp/api/?v=1.1&q=%s" % (urllib.quote(adr.encode('utf-8')))
xml = parse(urllib.urlopen(api)).getroot()
... | toshi123/python4beginners | geoDistance.py | Python | mit | 1,325 | 0.011914 |
from common import common_global
from common import common_pagination_bootstrap
from sanic import Blueprint
blueprint_user_metadata_game_system = Blueprint('name_blueprint_user_metadata_game_system',
url_prefix='/user')
@blueprint_user_metadata_game_system.route('/user... | MediaKraken/MediaKraken_Deployment | source/web_app_sanic/blueprint/user/bp_user_metadata_game_system.py | Python | gpl-3.0 | 3,005 | 0.006988 |
# Copyright (C) 2010-2011 Mathijs de Bruin <mathijs@mathijsfietst.nl>
#
# This file is part of django-shopkit.
#
# django-shopkit 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 2, or (at... | dokterbob/django-shopkit | shopkit/currency/__init__.py | Python | agpl-3.0 | 1,300 | 0.002308 |
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# Copyright (C) 2009-2010 Fluendo, S.L. (www.fluendo.com).
# Copyright (C) 2009-2010 Marc-Andre Lureau <marcandre.lureau@gmail.com>
# This file may be distributed and/or modified under the terms of
# the GNU General Public License version 2 as published by
# the Free... | suykerbuyk/hls_toolkit | HLS/fetcher.py | Python | gpl-2.0 | 8,189 | 0.002076 |
# -*- coding: utf-8 -*-
# Copyright (C) 2017 Matthias Luescher
#
# Authors:
# Matthias Luescher
#
# This file is part of edi.
#
# edi is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of... | lueschem/edi | tests/test_command_line_interface.py | Python | lgpl-3.0 | 1,276 | 0.000784 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/osis | base/views/entity/detail.py | Python | agpl-3.0 | 5,701 | 0.001404 |
# -*- 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 TutItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
image_urls = scrapy.Field()
images = sc... | leonlcw92/myScrapy | tut/tut/items.py | Python | gpl-3.0 | 333 | 0 |
from typing import Any, Dict, List
from django.http import HttpRequest, HttpResponse
from zerver.decorator import webhook_view
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook_message
from zerver.models imp... | eeshangarg/zulip | zerver/webhooks/greenhouse/view.py | Python | apache-2.0 | 2,154 | 0.000929 |
import json
import os
from os.path import join as pjoin
import unittest
from IPython.testing.decorators import onlyif
from IPython.utils.tempdir import TemporaryDirectory
from IPython.kernel import kernelspec
sample_kernel_json = {'argv':['cat', '{connection_file}'],
'display_name':'Test kernel'... | wolfram74/numerical_methods_iserles_notes | venv/lib/python2.7/site-packages/IPython/kernel/tests/test_kernelspec.py | Python | mit | 2,717 | 0.003312 |
from __future__ import absolute_import, print_function, unicode_literals
from compat_patcher_core import generic_patch_software, make_safe_patcher
@make_safe_patcher
def patch(settings=None):
"""Load every dependency, and apply registered fixers according to provided settings (or Django settings as a fallback)."... | pakal/django-compat-patcher | src/django_compat_patcher/__init__.py | Python | mit | 928 | 0.001078 |
from __future__ import generators
import time
import operator
try:
import ctypes
except ImportError:
ctypes = None
import importlib
from uuid import UUID, uuid4, _uuid_generate_random
from inspect import getargspec
from itertools import islice
from carrot.utils import rpartition
from celery.utils.compat impo... | mitsuhiko/celery | celery/utils/__init__.py | Python | bsd-3-clause | 8,111 | 0.000863 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from math import isinf, isnan
from warnings import warn
NOT_MASS_BALANCED_TERMS = {"SBO:0000627", # EXCHANGE
"SBO:0000628", # DEMAND
"SBO:0000629", # BIOMASS
"SBO:0000631... | zakandrewking/cobrapy | cobra/manipulation/validate.py | Python | lgpl-2.1 | 2,116 | 0 |
import argparse
from PGEnv import PGEnvironment
from PGAgent import PGAgent
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--gym_environment', type=str, default='Pong-v0',
help='OpenAI Gym Environment to be used (default to Pong-v0)')
parser.add_... | YuMao1993/DRL | PG/main.py | Python | mit | 2,270 | 0.006167 |
"""A module to deal with processes."""
import datetime
def uptime(asstr = False):
"""Get system uptime>"""
raw = ''
with open('/proc/uptime','r') as ut:
raw = ut.read()[:-1]
uts = list(map(lambda x: int(float(x)), raw.split(' ')))
if asstr:
uts = str(datetime.timedelta(seconds = uts[0]))
return uts
| JoelBondurant/RandomCodeSamples | python/proc.py | Python | apache-2.0 | 312 | 0.044872 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | Azure/azure-sdk-for-python | tools/azure-devtools/src/azure_devtools/perfstress_tests/__init__.py | Python | mit | 1,479 | 0.000676 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import datetime
import sys
import MySQLdb
HOST = "127.0.0.1"
USER = "root"
PASSWD = "toor"
DB = "pyKeyLog"
def getSampleText( fname ):
filehandle = open( fname, "r" )
text = filehandle.read().decode("utf-8")
filehandle.close()
lines = []
for i in text.split("... | Magnus1990P/pyBiometricKeyLogger | api.py | Python | mit | 1,126 | 0.062167 |
import pendulum
locale = "nb"
def test_diff_for_humans():
with pendulum.test(pendulum.datetime(2016, 8, 29)):
diff_for_humans()
def diff_for_humans():
d = pendulum.now().subtract(seconds=1)
assert d.diff_for_humans(locale=locale) == "for 1 sekund siden"
d = pendulum.now().subtract(seconds... | sdispater/pendulum | tests/localization/test_nb.py | Python | mit | 3,021 | 0.000332 |
from sys import argv
|
| mrniranjan/python-scripts | reboot/math27.py | Python | gpl-2.0 | 24 | 0 |
# Copyright (C) 2013 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in ... | bwildenhain/virt-manager | tests/test_urls.py | Python | gpl-2.0 | 11,455 | 0.001135 |
"""
WSGI config for zemantaCounter project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "zemantaCounter.settings")
from... | kostans3k/DistributedCounters | zemantaCounter/wsgi.py | Python | mit | 403 | 0.002481 |
# test_sampleParser.py
import os
from ..sampleParser import SampleParser
class TestSampleParser:
def setup(self):
self.folderName = os.path.join('.', 'tests', 'Export')
self.parser = SampleParser(self.folderName)
def test_getDirectoryFiles(self):
files = self._obtainDirectory()
... | jmeline/wifi_signal_analysis | src/tests/test_sampleParser.py | Python | mit | 1,146 | 0.00349 |
import json
from urllib.parse import urlencode
from tests import TestCase
from tests.fixtures.factories import ProfessorFactory, CourseFactory
class SearchTestCase(TestCase):
def setUp(self):
super().setUp()
ProfessorFactory(first_name='Mathias')
CourseFactory(title='Math Stuff')
de... | SCUEvals/scuevals-api | tests/resources/test_search.py | Python | agpl-3.0 | 709 | 0.00141 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_11_01/models/application_gateway_url_path_map.py | Python | mit | 3,378 | 0.002368 |
from dependencies.dependency import base_hasattr, safe_callable, isIDAutoGenerated, \
getEmptyTitle, safe_unicode
from lims.utils import t
from dependencies.dependency import MessageFactory
_marker = []
def _pretty_title_or_id(context, obj, empty_value=_marker):
"""Return the best possible title or id of an i... | yasir1brahim/OLiMS | lims/monkey/utils.py | Python | agpl-3.0 | 1,303 | 0.00307 |
# This file is part of Copernicus
# http://www.copernicus-computing.org/
#
# Copyright (C) 2011, Sander Pronk, Iman Pouya, Erik Lindahl, and others.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as published
# by the Free Soft... | gromacs/copernicus | cpc/network/http/http_method_parser.py | Python | gpl-2.0 | 9,130 | 0.017087 |
'''
Created on 20/02/2009
@author: Chuidiang
Ejemplo de cliente de socket.
Establece conexion con el servidor, envia "hola", recibe y escribe la
respuesta, espera 2 segundos, envia "adios", recibe y escribe la respuesta
y cierrra la conexion
'''
import socket
#import time
if __name__ == '__main__':
# Se establece ... | oroxo/LPPDP | cliente.py | Python | mit | 1,465 | 0.012287 |
#!/usr/bin/env python3
lado = input("Digite o valor correspondente ao lado de um quadrado: ")
perimetro = ( int(lado) * 4 )
area = ( int(lado) ** 2)
print("perímetro:", perimetro, "- área:", area)
| ranog/coursera_python | quadrado.py | Python | gpl-3.0 | 202 | 0.015 |
from __future__ import unicode_literals
import datetime
import re
from itertools import chain
from django.conf import settings
from django.db import models
from django.db.migrations import operations
from django.db.migrations.migration import Migration
from django.db.migrations.operations.models import AlterModelOpti... | katrid/django | django/db/migrations/autodetector.py | Python | bsd-3-clause | 56,243 | 0.002045 |
"""
WSGI config for sdustoj_server project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJAN... | GuoDuanLZ/sdustoj-judge-webserver | sdustoj_server/sdustoj_server/wsgi.py | Python | apache-2.0 | 406 | 0 |
"""
Django settings for DESIGNDB_REBUILD project.
Generated by 'django-admin startproject' using Django 1.9.7.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
imp... | matt-dale/designdb | DESIGNDB_REBUILD/DESIGNDB_REBUILD/settings.py | Python | apache-2.0 | 3,383 | 0.001182 |
import bleach
from django.db.models.fields import TextField
from django.utils.encoding import smart_text
from .widgets import RichTextareaWidget
class RichTextarea(TextField):
"""
"""
def to_python(self, value):
"""
"""
if value:
html = value.replace(' ', ' ')
... | Merino/poc-cbb | vesper/fields.py | Python | bsd-3-clause | 1,042 | 0.001919 |
# orm/persistence.py
# Copyright (C) 2005-2013 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""private module containing functions used to emit INSERT, UPDATE
and DELETE state... | alex/sqlalchemy | lib/sqlalchemy/orm/persistence.py | Python | mit | 41,002 | 0.002 |
#!/usr/bin/python
#
try:
import gdb
except ImportError as e:
raise ImportError("This script must be run in GDB: ", str(e))
import sys
import os
sys.path.append(os.getcwd())
import common_helpers
simple_types = ["CMasternode", "CMasternodeVerification",
"CMasternodeBroadcast", "CMasternodePing... | ivansib/sibcoin | contrib/auto_gdb/simple_class_obj.py | Python | mit | 2,004 | 0.002495 |
#!/usr/bin/env python
# Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
This is a script for generating easily-viewable comparisons of text and pixel
diffs.
"""
import optparse
from layout_pack... | rwatson/chromium-capsicum | webkit/tools/layout_tests/test_output_formatter.py | Python | bsd-3-clause | 4,736 | 0.018581 |
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2017, F5 Networks Inc.
# 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
import os
import json
import pytest
import sys
from nose.plugins.skip i... | trondhindenes/ansible | test/units/modules/network/f5/test_bigip_profile_oneconnect.py | Python | gpl-3.0 | 3,947 | 0.001773 |
# -*- coding: utf-8 -*-
# Relational
# Copyright (C) 2008-2011 Salvo "LtWorf" Tomaselli
#
# Relational 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) an... | ltworf/relational | setup/python3-relational.setup.py | Python | gpl-3.0 | 846 | 0 |
"""
Implements a StreamTester that runs over Twitter data. See the class
docstring.
This module is written for Python 3 only. The __future__ imports you see here
are just to let Python 2 scan the file without crashing with a SyntaxError.
"""
from __future__ import print_function, unicode_literals
import os
from collec... | dantebarba/docker-media-server | plex/Sub-Zero.bundle/Contents/Libraries/Shared/ftfy/streamtester/twitter_tester.py | Python | gpl-3.0 | 3,155 | 0 |
"""
===========================================
Sparse coding with a precomputed dictionary
===========================================
Transform a signal as a sparse combination of Ricker wavelets. This example
visually compares different sparse coding methods using the
:class:`sklearn.decomposition.SparseCoder` esti... | cdegroc/scikit-learn | examples/decomposition/plot_sparse_coding.py | Python | bsd-3-clause | 3,808 | 0.001838 |
def abbreviate(words):
pass
| jmluy/xpython | exercises/practice/acronym/acronym.py | Python | mit | 32 | 0 |
# Copyright 2015, eBay 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 law or agre... | doug-fish/neutron-lbaas-dashboard | neutron_lbaas_dashboard/dashboards/project/loadbalancersv2/workflows/__init__.py | Python | apache-2.0 | 672 | 0 |
"""
Distribution of PM2.5 at Various Sites across Delhi
===================================================
_thumb: .2, .6
"""
import matplotlib.pyplot as plt
import seaborn as sns
import openaq
sns.set(style="ticks", font_scale=1.)
api = openaq.OpenAQ()
# grab the data
res = api.measurements(city='Delhi', parameter... | dhhagan/py-openaq | examples/pm25_histogram_delhi.py | Python | mit | 833 | 0.002401 |
from flask import Flask, request, abort
import json
from ReverseProxied import ReverseProxied
app = Flask(__name__)
app.wsgi_app = ReverseProxied(app.wsgi_app)
with open("intervals.json") as b:
data = json.load(b)
def intersects(interval, min_age, max_age):
if interval["lag"] <= min_age <= interval["eag"]:
... | tetherless-world/dtdi-geologic-time-resolver | app.py | Python | mit | 1,824 | 0.001096 |
from base_screen import BaseScreen
import pygame
from ..graphic_utils import ListView,\
ScreenObjectsManager, TouchAndTextItem
from ..input import InputManager
from play_options import PlayOptions
mode_track_name = 0
mode_album_name = 1
mode_artist_name = 2
class SearchScreen(BaseScreen):
def __init__(se... | jravey7/Joe2Music | mopidy_touchscreen/screens/search_screen.py | Python | mit | 7,928 | 0.002144 |
# -----------------------------------------------------------
# demonstrates the usage of a while loop with else condition
#o
# (C) 2017 Frank Hofmann, Berlin, Germany
# Released under GNU Public License (GPL)
# email frank.hofmann@efho.de
# -----------------------------------------------------------
# define list
sho... | hofmannedv/training-python | loops/while-else.py | Python | gpl-2.0 | 630 | 0.011111 |
"""Contains utility functions for working with the shell"""
from contextlib import contextmanager
import datetime
from decimal import Decimal
import json
import pprint
import sys
import time
import traceback
SHELL_CONTROL_SEQUENCES = {
'BLUE': '\033[34m',
'LTBLUE': '\033[94m',
'GREEN': '\033[32m',
'LT... | johnnadratowski/git-reviewers | python_lib/shell.py | Python | mit | 8,544 | 0.001287 |
import string
import pickle
import time
import threading
import re
from urllib.request import urlopen
from Socket import openSocket,sendMessage,joinRoom,getUser,getMessage
from Settings import CHANNEL,MBALL,COOLDOWNCMD,VERSION,UNMOD
#from pastebin import getChangelog
s=openSocket("#"+CHANNEL)
joinRoom(s)
#... | Vambok/Tanook-Lebot | Run.py | Python | cc0-1.0 | 24,528 | 0.039102 |
import sys as _sys
import ast as _ast
from ast import boolop, cmpop, excepthandler, expr, expr_context, operator
from ast import slice, stmt, unaryop, mod, AST
def _make_node(Name, Fields, Attributes, Bases):
def create_node(self, *args, **kwargs):
nbparam = len(args) + len(kwargs)
assert nbparam ... | ryfeus/lambda-packs | Tensorflow_Pandas_Numpy/source3.6/gast/gast.py | Python | mit | 9,289 | 0.000108 |
from concurrent.futures import ThreadPoolExecutor
import importlib
import logging
from numbers import Number
from operator import add
import os
import psutil
import sys
from time import sleep
import traceback
import asyncio
import dask
from dask import delayed
from dask.utils import format_bytes
from dask.system impor... | blaze/distributed | distributed/tests/test_worker.py | Python | bsd-3-clause | 46,667 | 0.000557 |
from moto.core.exceptions import AWSError
class ExecutionAlreadyExists(AWSError):
TYPE = "ExecutionAlreadyExists"
STATUS = 400
class ExecutionDoesNotExist(AWSError):
TYPE = "ExecutionDoesNotExist"
STATUS = 400
class InvalidArn(AWSError):
TYPE = "InvalidArn"
STATUS = 400
class InvalidName... | spulec/moto | moto/stepfunctions/exceptions.py | Python | apache-2.0 | 931 | 0 |
"""Test HTML5 notify platform."""
import asyncio
import json
from unittest.mock import patch, MagicMock, mock_open
from aiohttp.hdrs import AUTHORIZATION
from homeassistant.components.notify import html5
from tests.common import mock_http_component_app
SUBSCRIPTION_1 = {
'browser': 'chrome',
'subscription': ... | stefan-jonasson/home-assistant | tests/components/notify/test_html5.py | Python | mit | 15,352 | 0 |
from __future__ import unicode_literals
# !/usr/bin/env python
# -*- coding: utf-8 -*-
import glob
import os
from tags import tag_finder
import logging
from operator import itemgetter, attrgetter, methodcaller
def path_leaf(path):
"""
It gets the path final leaf
"""
head, tail = os.path.... | tex0l/JukeBox | parser.py | Python | apache-2.0 | 4,608 | 0.003906 |
# encoding: utf-8
import re
import jinja2
import jinja2.ext
import markdown2
import os
import sys
sys.path.append(".")
from staticjinja import make_site
from BeautifulSoup import BeautifulSoup, BeautifulStoneSoup
# remove annoying characters
def cleanitup(text):
chars = {
'\xe2': '',
'\x80': '',
'... | columbiaviz/columbiaviz.github.io | build.py | Python | mit | 3,474 | 0.012378 |
import json, time
from pyspider.database.base.taskdb import TaskDB as BaseTaskDB
from .couchdbbase import SplitTableMixin
class TaskDB(SplitTableMixin, BaseTaskDB):
collection_prefix = ''
def __init__(self, url, database='taskdb', username=None, password=None):
self.username = username
self.p... | luoq/pyspider | pyspider/database/couchdb/taskdb.py | Python | apache-2.0 | 3,764 | 0.00186 |
"""
This module provides an abstraction for working with XModuleDescriptors
that are stored in a database an accessible using their Location as an identifier
"""
import logging
import re
import json
import datetime
from pytz import UTC
from collections import defaultdict
import collections
from contextlib import cont... | CourseTalk/edx-platform | common/lib/xmodule/xmodule/modulestore/__init__.py | Python | agpl-3.0 | 55,549 | 0.002844 |
# Partname: ATmega644PA
# generated automatically, do not edit
MCUREGS = {
'ADCSRB': '&123',
'ADCSRB_ACME': '$40',
'ACSR': '&80',
'ACSR_ACD': '$80',
'ACSR_ACBG': '$40',
'ACSR_ACO': '$20',
'ACSR_ACI': '$10',
'ACSR_ACIE': '$08',
'ACSR_ACIC': '$04',
'ACSR_ACIS': '$03',
'DIDR1': '&127',
'DIDR... | hickey/amforth | core/devices/atmega644pa/device.py | Python | gpl-2.0 | 7,376 | 0.071448 |
from raptiformica.settings import conf
from raptiformica.settings.load import purge_local_config_mapping
from tests.testcase import TestCase
class TestPurgeLocalConfigMapping(TestCase):
def setUp(self):
self.remove = self.set_up_patch(
'raptiformica.settings.load.remove'
)
def tes... | vdloo/raptiformica | tests/unit/raptiformica/settings/load/test_purge_local_config_mapping.py | Python | mit | 698 | 0 |
import time
class Hdfs:
def __init__(self, ip, mode, log_prefix):
self.ip = ip
self.mode = mode
self.path = self.get_log_path(log_prefix)
def get_log_path(self, log_prefix):
path = '{pre}/hdfs/{ip}-{mode}-{time}'.format(pre=log_prefix, ip=self.ip, mode=self.mode, time=time.strftime('%Y%m%d%H%M%S'))
return... | artish/tera | example/docker/hdfs.py | Python | bsd-3-clause | 1,496 | 0.027406 |
import math
from PyQt5.QtCore import Qt, pyqtSlot
from PyQt5.QtGui import QCloseEvent
from PyQt5.QtWidgets import QDialog, QInputDialog
from urh import settings
from urh.models.FuzzingTableModel import FuzzingTableModel
from urh.signalprocessing.ProtocoLabel import ProtocolLabel
from urh.signalprocessing.ProtocolAnal... | jopohl/urh | src/urh/controller/dialogs/FuzzingDialog.py | Python | gpl-3.0 | 15,833 | 0.00379 |
from unittest import TestCase
from common.timer import timed
@timed
def fib(n):
ls = [1, 1]
if n == 0:
return 0
if n <= 2:
return ls[n - 1]
for i in range(3, n + 1):
tmp = ls[1]
ls[1] = ls[0] + ls[1]
ls[0] = tmp
return ls[-1]
class Test(TestCase):
def... | plilja/adventofcode | common/test_timer.py | Python | gpl-3.0 | 695 | 0 |
################################################################
# File: e621.py
# Title: MANGAdownloader's site scraper
# Author: ASL97/ASL <asl97@outlook.com>
# Version: 1
# Notes : DON'T EMAIL ME UNLESS YOU NEED TO
# TODO: *blank*
################################################################
import misc
# used ... | asl97/MANGAdownloader | scrapers/e621.py | Python | bsd-3-clause | 1,343 | 0.003723 |
from twisted.application.service import Application
from twisted.application.internet import TimerService, TCPServer
from twisted.web import server
from twisted.python import log
from scrapy.utils.misc import load_object
from .interfaces import IEggStorage, IPoller, ISpiderScheduler, IEnvironment
from .launcher impor... | mouadino/scrapy | scrapyd/app.py | Python | bsd-3-clause | 1,522 | 0.001971 |
from readSVCsig import readSVCdata
from readSVCsig import readSVCheader
from readSVCsig import readSVCsig
| pavdpr/svcread | python/__init__.py | Python | mit | 106 | 0 |
# -*- coding: utf-8 -*-
"""
We expect XML file with TextLine having the row, col, rowSpan, colSpan attributes
For each Page:
We delete any empty table (or complain if not empty)
We select TextLine with rowSPan=1 and colSpan=1
We create one cell for each pair of row and col number
We inject the TexLine... | Transkribus/TranskribusDU | TranskribusDU/tasks/tabulate_final.py | Python | bsd-3-clause | 9,416 | 0.012107 |
from subprocess import check_call, call, Popen, PIPE
import os
import textwrap
import glob
os.putenv("DEBIAN_FRONTEND", "noninteractive")
#######
## Plumbing
#######
def get_output(cmd, **kwargs):
check = kwargs.pop("check", True)
kwargs["stdout"] = PIPE
p = Popen(cmd, **kwargs)
stdout, stderr = p.c... | akx/requiem | requiem.py | Python | mit | 2,960 | 0.004054 |
from typing import Optional
from thinc.api import Model
from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS
from .stop_words import STOP_WORDS
from .lex_attrs import LEX_ATTRS
from .lemmatizer import UkrainianLemmatizer
from ...language import Language
class UkrainianDefaults(Language.Defaults):
tokenizer_ex... | spacy-io/spaCy | spacy/lang/uk/__init__.py | Python | mit | 903 | 0.002215 |
import sys, os, inspect
from PyQt5.QtWidgets import QWidget, QTreeWidgetItem
from PyQt5 import uic
directory = os.path.realpath(os.path.abspath(os.path.split(inspect.getfile(inspect.currentframe()))[0]))
sys.path.append(directory + "/lib")
from libstats import LibStats
from func_aux import paint_row, key_from_value
fro... | soker90/betcon | src/stats_tipster.py | Python | gpl-3.0 | 2,869 | 0.005228 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import os
import logging
from textwrap import dedent
import collections
import pytest
import mock
from gcdt_testtools.helpers import temp_folder, create_tempfile, cleanup_tempfiles
from gcdt_testtools import helpers
from gcdt_bundler.pyth... | glomex/gcdt-bundler | tests/test_python_bundler.py | Python | mit | 7,149 | 0.004756 |
"""
Command line interface for cobbler.
Copyright 2006-2009, Red Hat, Inc and Others
Michael DeHaan <michael.dehaan AT gmail>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the ... | nacc/cobbler | cobbler/cli.py | Python | gpl-2.0 | 28,939 | 0.011023 |
"""
Convenience interface to N-D interpolation
.. versionadded:: 0.9
"""
from __future__ import division, print_function, absolute_import
import numpy as np
from .interpnd import LinearNDInterpolator, NDInterpolatorBase, \
CloughTocher2DInterpolator, _ndim_coords_from_arrays
from scipy.spatial import cKDTree
_... | Eric89GXL/scipy | scipy/interpolate/ndgriddata.py | Python | bsd-3-clause | 7,557 | 0.000662 |
import logging
from logging import FileHandler
import psycopg2
import sqlalchemy
from sqlalchemy_utils import database_exists, create_database
from mongoengine import *
from flask import Flask
from flask_restful import Api
from flask_sqlalchemy import SQLAlchemy
from .config import test_config
from .config import app... | testlnord/entity_matching_tool | entity_matching_tool/__init__.py | Python | mit | 2,695 | 0.005566 |
from selenium import webdriver
from selenium.webdriver.support.ui import Select
driver = webdriver.Chrome('/home/leo/Downloads/chromedriver')
driver.get("http://your-url")
assert "Post Title" in driver.title
link=driver.find_element_by_link_text("Add new")
NewWindow=link.click()
assert "Save" in driver.page_source
#A... | Leo-g/Selenium | python-selenium.py | Python | gpl-2.0 | 1,713 | 0.013427 |
# -*- encoding: utf-8 -*-
# Copyright (c) 2019 ZTE Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | openstack/watcher | watcher/api/controllers/v1/data_model.py | Python | apache-2.0 | 2,661 | 0 |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
compat_urllib_parse,
)
class MalemotionIE(InfoExtractor):
_VALID_URL = r'^(?:https?://)?malemotion\.com/video/(.+?)\.(?P<id>.+?)(#|$)'
_TEST = {
'url': 'http://malemotion.com/video/bien-dur.1... | MiLk/youtube-dl | youtube_dl/extractor/malemotion.py | Python | unlicense | 1,665 | 0.001802 |
#!/usr/bin/env python
# -*- encoding: 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... | ashvina/heron | heron/tools/common/src/python/access/query.py | Python | apache-2.0 | 1,797 | 0.006121 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# sshuttle documentation build configuration file, created by
# sphinx-quickstart on Sun Jan 17 12:13:47 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# a... | apenwarr/sshuttle | docs/conf.py | Python | lgpl-2.1 | 8,316 | 0.00012 |
#
# 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... | apache/incubator-airflow | tests/ti_deps/deps/test_pool_slots_available_dep.py | Python | apache-2.0 | 2,317 | 0 |
#
# DESCRIPTION: This script parses the given input bowtie and/or LAST files and creates a csv row of their data in the given output csv.
#
# AUTHOR: Chelsea Tymms
import sys, os.path
import argparse
def getOptions():
"""Function to pull in arguments from the command line"""
description="""This script takes an i... | McIntyre-Lab/papers | lehmann_2015/mapping_and_overall_expression/scripts/logParser.py | Python | lgpl-3.0 | 5,162 | 0.032739 |
from flask import Blueprint
from zou.app.utils.api import configure_api_from_blueprint
from .asset_instance import AssetInstanceResource, AssetInstancesResource
from .attachment_file import AttachmentFilesResource, AttachmentFileResource
from .comments import CommentsResource, CommentResource
from .custom_action impo... | cgwire/zou | zou/app/blueprints/crud/__init__.py | Python | agpl-3.0 | 5,848 | 0 |
# -*- coding: utf-8 -*-
import application
import platform
import exceptions
from ctypes import c_char_p
from libloader import load_library
import paths
if platform.architecture()[0][:2] == "32":
lib = load_library("api_keys32", x86_path=paths.app_path("keys/lib"))
else:
lib = load_library("api_keys64", x64_path=path... | codeofdusk/ProjectMagenta | src/keys/__init__.py | Python | gpl-2.0 | 847 | 0.025974 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import glob
class Guidance(MakefilePackage):
"""Guidance: Accurate detection of unreliable align... | iulian787/spack | var/spack/repos/builtin/packages/guidance/package.py | Python | lgpl-2.1 | 1,751 | 0.001142 |
"""
Block Depth Transformer
"""
from __future__ import absolute_import
from openedx.core.djangoapps.content.block_structure.transformer import BlockStructureTransformer
class BlockDepthTransformer(BlockStructureTransformer):
"""
Keep track of the depth of each block within the block structure. In case
o... | ESOedX/edx-platform | lms/djangoapps/course_api/blocks/transformers/block_depth.py | Python | agpl-3.0 | 2,059 | 0.000971 |
# -*- encoding:utf-8 -*-
from __future__ import unicode_literals
MESSAGES = {
"Also available in": "Također dostupno i u",
"Archive": "Arhiva",
"Categories": "",
"LANGUAGE": "hrvatski",
"More posts about": "Više postova o",
"Newer posts": "Noviji postovi",
"Next post": "Sljedeći post",
... | damianavila/nikola | nikola/data/themes/base/messages/messages_hr.py | Python | mit | 824 | 0 |
# -*- coding: utf-8 -*-
from south.v2 import SchemaMigration
class Migration(SchemaMigration):
def forwards(self, orm):
pass
def backwards(self, orm):
pass
models = {
}
complete_apps = ['admin']
| Karaage-Cluster/karaage-debian | karaage/legacy/admin/south_migrations/0004_auto__del_logentry.py | Python | gpl-3.0 | 237 | 0 |
# encoding: 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 model 'DefinedGeography'
db.create_table('seak_definedgeography', (
('id', self.gf('d... | Ecotrust/cogs-priorities | priorities/seak/migrations/0002_auto__add_definedgeography.py | Python | bsd-3-clause | 12,162 | 0.007811 |
identifier = 'edu.cmu.sv.componentGraph'
name = 'Component Graph'
version = '1.0.0'
def menu_items():
"""menu_items() -> tuple of (str,function)
It returns a list of pairs containing text for the menu and a
callback function that will be executed when that menu item is selected.
"""
from test_for... | CMUSV-VisTrails/WorkflowRecommendation | vistrails/packages/componentGraph/__init__.py | Python | bsd-3-clause | 1,248 | 0.004808 |
from StateMachine.State import State
from StateMachine.StateMachine import StateMachine
from StateMachine.InputAction import InputAction
from GameData.GameData import GameData
class StateT(State):
state_stack = list()
game_data = GameData()
def __init__(self):
self.transitions = None
def next(... | jmacleod/dotr | GameStates.py | Python | gpl-2.0 | 3,904 | 0.013576 |
# -*- coding: utf-8 -*-
from django import template
from django.db import models
from django.utils.html import escape
register = template.Library()
class TreeTrunkNode(template.Node):
"""
Render the first few levels of a topic tree as an unordered HTML list.
"""
def __init__(self, model_name, levels=... | indexofire/gravoicy | gravoicy/libs/category/templatetags/__init__.py | Python | bsd-3-clause | 2,558 | 0.001564 |
###Level builder feature list
#preview of current section of level
#background texture pallete
#foreground texture pallete
#save/load/new interface
#addition of item balls
#addition of npcs
#screenchangers: addition, connection, and
#reciprocity checking (for indivdual and level)
#is there another world at the... | mgavrin/Punkemon | level builder v0+0-0-1i.py | Python | mit | 21,712 | 0.029477 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.{{ model_name }}List.as_view(), name='list'),
url(r'^new/$', views.{{ model_name }}Create.as_view(), name='create'),
url(r'^(?P<pk>\d+)/$', views.{{ model_name }}Detail.as_view(), name='detail'),
url(r'^(?P<pk>\d+)/... | grantmcconnaughey/django-app-gen | appgen/templates/appgen/python/urls.py | Python | bsd-3-clause | 479 | 0.02714 |
from __future__ import print_function, division
import unittest, numpy as np
from pyscf import gto, scf
from pyscf.nao import gw as gw_c
class KnowValues(unittest.TestCase):
def test_rf0_ref(self):
""" This is GW """
mol = gto.M( verbose = 1, atom = '''H 0 0 0; H 0.17 0.7 0.587''', basis = 'cc-pvdz',)
... | gkc1000/pyscf | pyscf/nao/test/test_0052_gw_rf0_ref.py | Python | apache-2.0 | 1,018 | 0.022593 |
"""
:author: samu
:created: 2/20/13 8:46 PM
"""
import os
from cool_logging import getLogger
logger = getLogger('config-gen')
STANDARD_DIRS = [
'templates',
'extra_templates',
'data',
'build', # No real need..
]
STANDARD_FILES = {}
STANDARD_FILES['templates/example.html.jinja'] = \
'<h1>{{ ex... | rshk/config-gen | config_gen/commands/quickstart.py | Python | gpl-3.0 | 1,027 | 0.000974 |
import torch
import sys
import types
class VFModule(types.ModuleType):
def __init__(self, name):
super(VFModule, self).__init__(name)
self.vf = torch._C._VariableFunctions
def __getattr__(self, attr):
return getattr(self.vf, attr)
sys.modules[__name__] = VFModule(__name__)
| ryfeus/lambda-packs | pytorch/source/torch/nn/_VF.py | Python | mit | 310 | 0.003226 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.