code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
from zmeyka_db_models.base_db_models import *
#from zmeyka_db_models.alexey_logging import write_to_log
from zmeyka_db_models.user_utils import delete_users_by_page_id_timestamp
from zmeyka_db_models.like_utils import delete_likes_by_page_id_timestamp
from zmeyka_db_models.comment_utils import delete_comments_by_pag... | eugeneks/zmeyka | zmeyka_db_models/page_utils.py | Python | mit | 8,008 |
from zope.formlib import form
from zope.app.form.browser import ASCIIWidget
from Products.CMFCore.utils import getToolByName
from Products.listen.browser.mailinglist_views import DescriptionWidget
from Products.listen.browser.mailinglist_views import MailingListAddForm \
as BaseAddForm
from Products.listen.brows... | socialplanning/opencore | opencore/listen/mailinglist_views.py | Python | gpl-3.0 | 1,858 |
# -*- coding: utf-8 -*-
"""
Test Cases para el cálculo de facturas de suministro eléctrico conforme al PVPC con datos horarios
"""
from unittest import TestCase
from esiosdata.facturapvpc import (FacturaElec, ROUND_PREC, TIPO_PEAJE_VHC, ZONA_IMPUESTOS_PENIN_BALEARES)
def _check_results_factura(factura,
... | azogue/esiosdata | tests/test_factura_horaria.py | Python | mit | 3,522 |
# Generated by Django 2.2.8 on 2020-02-11 22:07
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('schedule', '0018_scheduleitem_languages'),
]
operations = [
migrations.RenameField(
model_name='scheduleitem',
old_name='lan... | patrick91/pycon | backend/schedule/migrations/0019_auto_20200211_2207.py | Python | mit | 379 |
# coding=utf-8
# Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved.
# Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. team.
# 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 ... | mlperf/training_results_v0.7 | NVIDIA/benchmarks/bert/implementations/pytorch/run_squad.py | Python | apache-2.0 | 56,578 |
"""
Tequila: a command-line Minecraft server manager written in python
Copyright (C) 2014 Snaipe
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) ... | Snaipe/Tequila | tequila/server/group/exception.py | Python | gpl-3.0 | 1,272 |
import csv
import datetime
import os
from decimal import Decimal
from django.db.models import Count, Avg
from tqdm import tqdm
from .models import Receipt, Business, Location
def assign_businesses(show_progress=False):
"""
Associates "Receipts" with businesses
The initial run over 2.4MM receipts will t... | texas/tx_mixed_beverages | mixed_beverages/apps/receipts/utils.py | Python | apache-2.0 | 1,900 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012, Nachi Ueno, NTT MCL, 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://ww... | tpaszkowski/quantum | quantum/agent/linux/iptables_firewall.py | Python | apache-2.0 | 11,907 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# PyRATA
#
# Authors:
# Nicolas Hernandez <nicolas.hernandez@gmail.com>
# URL:
# https://github.com/nicolashernandez/PyRATA/
#
#
# Copyright 2017 Nicolas Hernandez
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | nicolashernandez/PyRATA | pyrata/nltk.py | Python | apache-2.0 | 8,224 |
import os
import sys
import platform
import time
import subprocess
import xbmc
import xbmcaddon
import fswitch_config as fsconfig
import fswitch_configutil as fsconfigutil
def getSourceFPS():
# function for getting for source frame rate from the XBMC log file
# initialize constants
refVideoOpen = 'NOTICE: DVD... | Mafarricos/Mafarricos-modded-xbmc-addons | script.video.fswitchRK/fswitch_util.py | Python | gpl-2.0 | 19,191 |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
from dataclasses import dataclass
from pants.backend.docker.lint.hadolint.skip_field import SkipHadolintField
from pants.backend.docker.lint.hadolint.su... | patricklaw/pants | src/python/pants/backend/docker/lint/hadolint/rules.py | Python | apache-2.0 | 3,252 |
'''
This module provides the utility functions and exceptions for the pyisam package.
'''
__all__ = ('ISAM_bytes', 'ISAM_str')
# Convert the given value to a bytes value
def ISAM_bytes(value,default=None):
if isinstance(value, bytes):
pass
elif isinstance(value, str):
value = bytes(value, 'utf-8')
elif v... | rpmoseley/pyisam | pyisam/utils.py | Python | gpl-3.0 | 829 |
import pysparkling
from pyspark import SparkContext
from pyspark.sql import SQLContext
# initiate SparkContext
sc = SparkContext("local", "App Name", pyFiles=[])
# initiate SQLContext
sqlContext = SQLContext(sc)
# initiate H2OContext
hc = pysparkling.H2OContext(sc).start() | nilbody/sparkling-water | py/examples/scripts/H2OContextDemo.py | Python | apache-2.0 | 276 |
#!/home/poclement/Prog/Perso/RezConso/venv/bin/python
from bs4 import BeautifulSoup
import urllib2
import base64
from datetime import date
import math
BASE_URL = "http://www2.cooptel.qc.ca/services/temps/?mois={0}&cmd=Visualiser".format(date.today().month)
req = urllib2.Request(BASE_URL)
base64string = base64.encod... | riyoth/Script | RezConso/RezConso.py | Python | mit | 876 |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from .youtube import YoutubeIE
from ..utils import (
js_to_json,
qualities,
determine_ext,
)
class Tele13IE(InfoExtractor):
_VALID_URL = r'^http://(?:www\.)?t13\.cl/videos(?:/[^/]+)+/(?P<id>[\w-]+)'
_TESTS =... | atomic83/youtube-dl | youtube_dl/extractor/tele13.py | Python | unlicense | 3,343 |
from clearest import *
from tests.wsgi import WSGITestCase
class Test(WSGITestCase):
def setUp(self):
unregister_all()
def test_http_bad_request(self):
@GET("/asd")
def asd():
raise HttpBadRequest()
self.get("/asd")
self.assertEqual(HTTP_BAD_REQUEST, self.... | petr-s/cleaREST | tests/test_http_exceptions.py | Python | mit | 1,547 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Cutting Edge QA Marcin Koperski
import csv
import os
from robot.api import logger
from robot.libraries import DateTime
from TestToolsMK.robot_instances import validate_create_artifacts_dir, bi
class LoggerKeywords(object):
@staticmethod
d... | IlfirinPL/robotframework-MarcinKoperski | src/TestToolsMK/logger_extension_keywords.py | Python | mit | 2,100 |
'''
Created on Jun 27, 2010
@author: jnaous
'''
from openflow.dummyom.models import DummyOM
def run():
for om in DummyOM.objects.all():
om.delete()
for i in xrange(3):
om = DummyOM.objects.create()
om.populate_links(10, 20)
| ict-felix/stack | vt_manager_kvm/src/python/scripts/create_oms.py | Python | apache-2.0 | 273 |
import sys
import os
maindir = os.path.realpath(
os.path.join(
os.path.dirname(__file__),
'../src'))
sys.path += [maindir]
| geometalab/OSM-Crosswalk-Detection | tests/__init__.py | Python | mit | 143 |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: type_Result.py
from types import *
RESULT_STATUS_SUCCESS = 0
RESULT_STATUS_FAILURE_CLEAN = 1
RESULT_STATUS_FAILURE_MANUAL_INTERVENTION_REQUIRED = 2
... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Pc/PyScripts/Lib/pc/pc/cmd/appcompat/type_Result.py | Python | unlicense | 1,298 |
from __future__ import unicode_literals
from django.db import models
class FileUpload(models.Model):
docfile = models.FileField(upload_to='')
timestamp = models.DateTimeField(default=None, null=True, blank=True)
content = models.TextField(default=None, null=True, blank=True)
identifier = models.TextField(default=... | alaniz3/Radium-IonCloud-UI | app/models.py | Python | mit | 396 |
# Copyright (C) 2013 ABRT Team
# Copyright (C) 2013 Red Hat, Inc.
#
# This file is part of faf.
#
# faf 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) ... | abrt/faf | src/pyfaf/actions/sf_prefilter_patshow.py | Python | gpl-3.0 | 3,009 |
SOUTH_TESTS_MIGRATE = False | DOIS/campus.security-service | conf/settings/apps/south.py | Python | mit | 27 |
#!/usr/bin/python
#------------------ IMAGE TO HEADER ---------------------
#
# Converts a color image into a grayscale matrix defined
# in the header file : 'image_matrix.h".
# --------------------- LIBRARIES ----------------------
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpim... | lscardoso/gr-ntsc-rc | lib/image_to_header.py | Python | gpl-3.0 | 967 |
# Copyright (c) 2015, Ecole Polytechnique Federale de Lausanne, Blue Brain Project
# All rights reserved.
#
# This file is part of NeuroM <https://github.com/BlueBrain/NeuroM>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are ... | wizmer/NeuroM | neurom/exceptions.py | Python | bsd-3-clause | 2,384 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013-2014 Tribus Developers
#
# This file is part of Tribus.
#
# Tribus 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 L... | LuisAlejandro/tribus | tribus/web/processors.py | Python | gpl-3.0 | 1,427 |
import pygame
class Player():
def __init__(self, name, x, y, health):
self.pushed = False
self.name = name
self.pos = [x, y]
self.rect = pygame.rect.Rect(self.pos, (10, 10))
self.speed = [0, 0]
self.size = 10
self.health = health
def __repr__(self):
... | haihala/sagum | client/player.py | Python | bsd-2-clause | 540 |
from fwiki import app
import config
if __name__ == "__main__":
app.run()
| lucasstanesa/FWiki | runserver.py | Python | gpl-2.0 | 76 |
"""sales URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-base... | luismayta/python-example-drf | src/sales/urls.py | Python | lgpl-3.0 | 1,121 |
# Copyright 2016 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... | ghchinoy/tensorflow | tensorflow/contrib/learn/python/learn/learn_io/graph_io_test.py | Python | apache-2.0 | 30,118 |
from brilws import api
import sys
r=api.parsecmsselectJSON('3')
print r[0]
if len(sys.argv)>1:
args = sys.argv[1]
r=api.parsecmsselectJSON(args)
print r
| xiezhen/brilws | utils/testparser.py | Python | mit | 165 |
#!/usr/bin/env python
from setuptools import setup, find_packages
from store import VERSION
setup(
name='store_fr',
version=VERSION,
url='https://github.com/tangentlabs/django-oscar-paypal',
author="Nicolas Karageuzian",
author_email="nicolas@karageuzian.com",
description=(
"Integrate... | nka11/store-fr | setup.py | Python | gpl-3.0 | 1,116 |
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 22 20:42:02 2016
@author: nouamanelaanait
"""
import xrayutilities as xu
import numpy as np
#%%
def Pnma(a, b, c):
#create orthorhombic unit cell
l = xu.materials.Lattice([a, 0, 0], [0, b, 0], [0, 0, c])
return l
latticeConstants=[3.905, 3.905, 3.905]
STO... | nlaanait/pyxrim | scripts/angleCalcs.py | Python | mit | 2,180 |
# -*- coding: utf-8 -*-
#
# yawd-translations documentation build configuration file, created by
# sphinx-quickstart on Mon Nov 12 13:46:54 2012.
#
# 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
# autogenerated fil... | yawd/yawd-translations | docs/source/conf.py | Python | bsd-3-clause | 8,346 |
import sys
import os
import subprocess
import tempfile
import shutil
import unittest
class CommandsTest(unittest.TestCase):
project_name = 'testproject'
def setUp(self):
self.temp_path = tempfile.mkdtemp()
self.proj_path = os.path.join(self.temp_path, self.project_name)
self.proj_mod... | Ethan-Zhang/mownfish | tests/test_commands.py | Python | apache-2.0 | 2,982 |
import os
import sys
from unittest import TestCase
try:
from unittest.mock import patch
except ImportError:
from mock import patch # py2
from ipython_genutils.tempdir import TemporaryDirectory
from ipython_genutils import py3compat
from traitlets.config.manager import BaseJSONConfigManager
from traitlets.test... | lancezlin/ml_template_py | lib/python2.7/site-packages/notebook/tests/test_serverextensions.py | Python | mit | 4,371 |
# Copyright 2015 Google 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 agreed to in writi... | steinarvk/rigour | rigour/tests/test_secrecy.py | Python | apache-2.0 | 1,198 |
from a10sdk.common.A10BaseClass import A10BaseClass
class ObjKey2(A10BaseClass):
"""Class Description::
Unit test of optional key.
Class obj-key-2 supports CRUD Operations and inherits from `common/A10BaseClass`.
This class is the `"PARENT"` class for this module.`
:param k2: {"minLength": ... | amwelch/a10sdk-python | a10sdk/core/cm/cm_ut_obj_key_2.py | Python | apache-2.0 | 1,217 |
from rodeo import render, render_file | derks/rodeo | rodeo/__init__.py | Python | bsd-3-clause | 38 |
import numpy as np
import scipy.misc as scimi
with open('test.txt') as f:
lines = f.readlines()
for line in lines:
filename = line.split()[0][:-4]
print filename
img = scimi.imread('imgs/' + filename + '.png')
# print img
scimi.imsave('bmp_imgs/' + filename + '.bmp', img)
| stormmax/Teaism | datasets/cifar10/convert_img.py | Python | mit | 288 |
#import boto
import json
with open('settings.json') as settings_file:
settings = json.load(settings_file)
from boto.s3.connection import S3Connection
s3conn = S3Connection(settings['aws_access_key_id'], settings["aws_secret_access_key"])
mybucket = s3conn.get_bucket(settings["incoming_bucket"])
import sys
video... | policevideorequests/policevideopublisher | process_video.py | Python | bsd-3-clause | 7,846 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from functools import reduce # noqa
except Exception:
pass
try:
from .tornado_handler import TornadoHandler # noqa
except ImportError:
pass
from .environmentdump import EnvironmentDump # noqa
from .healthcheck import HealthCheck # noqa
| ateliedocodigo/py-healthcheck | healthcheck/__init__.py | Python | mit | 310 |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
import pytest_dependency
# -- Project information -------------------------... | RKrahl/pytest-dependency | doc/src/conf.py | Python | apache-2.0 | 4,969 |
#! /usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions... | runt18/nupic | src/nupic/support/features_list.py | Python | agpl-3.0 | 2,584 |
# -*- coding: utf-8 -*-
from datetime import timedelta
from workalendar.core import LunarCalendar, WesternCalendar, Calendar
from workalendar.core import MON, FRI, SAT, IslamicMixin, EphemMixin
class SouthKorea(LunarCalendar):
"South Korea"
FIXED_HOLIDAYS = LunarCalendar.FIXED_HOLIDAYS + (
(3, 1, "In... | sirk390/workalendar | workalendar/asia.py | Python | mit | 4,072 |
# encoding=utf-8
from operator import eq
from django.contrib.auth.models import AnonymousUser
from rest_framework import serializers
from misc.base import JsonSerializer, create_response
CODE_OK = 0x200
CODE_EXCEPTION = 0x300
CODE_NO_AUTHENTICATION = 0x400
class MessageSerializer(JsonSerializer):
data = serial... | ChanJLee/YLive_Server | decor/decor.py | Python | apache-2.0 | 1,810 |
from pyCovertAudio_lib import *
import struct
class BitStream:
def __init__(self, circular, buffer):
if(type(buffer) is str):
self.stream = python_bit_stream_initialize(circular, buffer)
else:
self.stream = \
python_bit_stream_initialize_from_bit_packer(
... | bcarr092/pyCovertAudio | src/pyCovertAudio/BitStream.py | Python | apache-2.0 | 2,669 |
#!/usr/bin/env python
# based on https://www.raspberrypi.org/learning/sense-hat-marble-maze/worksheet/
from sense_hat import SenseHat
from time import sleep
sense = SenseHat()
sense.clear()
| claremacrae/raspi_code | hardware/sense_hat/turn_off_lights.py | Python | mit | 194 |
def extractArkMachineTranslations(item):
"""
# Ark Machine Translations
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if 'ark volume' in item['title'].lower():
return buildReleaseMessageWithType(item, 'Ark'... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractArkMachineTranslations.py | Python | bsd-3-clause | 708 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import re
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GtkSource
from pilas.console import console
INDENT = 4
EDITOR_STYLE = """
GtkTextView {
font-family: monospace;
font-size: 10px;
color: black;
... | cristian99garcia/pilas-activity | pilas/console/console_widget.py | Python | gpl-3.0 | 6,176 |
#! /usr/local/bin/stackless2.6
#
# demo_syncless_web_py.py: running a (web.py) application under Syncless WSGI
# by pts@fazekas.hu at Tue Dec 22 12:16:22 CET 2009
#
import web
urls = (
'/(.*)', 'hello',
)
class hello:
def GET(self, name):
if not name:
name = 'world'
web.header('Co... | HanWenfang/syncless | examples/demo_syncless_web_py.py | Python | apache-2.0 | 671 |
import datetime
import time
import unicodedata
from builtins import str
from collections import OrderedDict
from future.moves.urllib.parse import parse_qsl, quote_plus, unquote_plus
from aussieaddonscommon import utils
class Video(object):
def __init__(self):
self.video_id = None
self.title = '... | andybotting/xbmc-addon-afl-video | resources/lib/classes.py | Python | gpl-3.0 | 4,391 |
# -*- coding: utf-8 -*-
"""Test suite for the TG app's models"""
from nose.tools import eq_
from tg2app import model
from tg2app.tests.models import ModelTest
class TestGroup(ModelTest):
"""Unit test case for the ``Group`` model."""
klass = model.Group
attrs = dict(
group_name = u"test_group",
... | ralphbean/monroe | wsgi/tg2app/tg2app/tests/models/test_auth.py | Python | agpl-3.0 | 1,492 |
""" flags.py - Various constants that have special meaning in describe.
INIT - Represents a matcher be instanciated for initialization purposes only
NO_ARG - Represents no argument. This is Noner than None.
"""
__all__ = (
'NO_ARG', 'NO_ARGS', 'ANY_ARG', 'ANYTHING', 'ANY_ARGS', 'ANY_KWARGS', 'is_flag',
... | jeffh/describe | describe/flags.py | Python | mit | 5,303 |
class Human(object):
laugh="hahahahaha"
def show_laugh(self):
print self.laugh
def laugh_100(self):
for i in range(100):
print i
self.show_laugh()
Hanmeimei = Human()
Hanmeimei.laugh_100()
| MengbinZhu/pfldp | class.py | Python | gpl-3.0 | 242 |
from datetime import datetime
import random
from pprint import pformat
from dream.plugins import plugin
from dream.plugins.TimeSupport import TimeSupportMixin
class CapacityStationGantt(plugin.OutputPreparationPlugin, TimeSupportMixin):
def postprocess(self, data):
"""Post process the data for Gantt gadget
... | nexedi/dream | dream/plugins/CapacityStations/CapacityStationGantt.py | Python | gpl-3.0 | 3,146 |
import zlib # implied prerequisite
import zipfile
import os
import StringIO
import tempfile
try:
from test.test_support import TestFailed
except ImportError:
class TestFailed(Exception):
pass
from translate.misc import zipfileext
BrokenStringIO = StringIO.StringIO
class FixedStringIO(BrokenStringIO... | mozilla/verbatim | vendor/lib/python/translate/misc/test_zipfileext.py | Python | gpl-2.0 | 6,371 |
import numpy as np
from ase.units import Hartree, Bohr
def L_to_lm(L):
"""Convert L index to (l, m) index."""
l = int(np.sqrt(L))
m = L - l**2 - l
return l, m
def lm_to_L(l, m):
"""Convert (l, m) index to L index."""
return l**2 + l + m
def split_formula(formula):
"""Count elements in ... | robwarm/gpaw-symm | gpaw/utilities/tools.py | Python | gpl-3.0 | 14,632 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 17-4-19 上午11:02
# @Author : Tom.Lee
# @Description :
# @File : helper_os.py
# @Product : PyCharm
import commands
import os
import sys
def shell():
command_ls = 'ls -al /opt'
command_docker = 'docker ps -a'
# 使用... | amlyj/pythonStudy | 2.7/standard_library/study_os.py | Python | mit | 3,462 |
from pathlib import Path
from setuptools import setup
def get_advanced_templates():
template_base = 'aws/templates/advanced/'
template_names = ['advanced-master', 'advanced-priv-agent', 'advanced-pub-agent', 'infra', 'zen']
return [template_base + name + '.json' for name in template_names]
# These fil... | mesosphere-mergebot/mergebot-test-dcos | setup.py | Python | apache-2.0 | 4,571 |
from __future__ import unicode_literals
from copy import copy, deepcopy
from datetime import datetime
import logging
import sys
from time import mktime
import traceback
import warnings
from wsgiref.handlers import format_date_time
from django.conf import settings
from django.conf.urls import url
from django.core.exce... | beedesk/django-tastypie | tastypie/resources.py | Python | bsd-3-clause | 101,378 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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... | andreaso/ansible | lib/ansible/modules/system/facter.py | Python | gpl-3.0 | 1,855 |
"""
Defines URLs for the learner profile.
"""
from django.conf import settings
from django.conf.urls import url
from .views.learner_achievements import LearnerAchievementsFragmentView
from openedx.features.learner_profile.views.learner_profile import learner_profile
urlpatterns = [
url(
r'^{username_pat... | cpennington/edx-platform | openedx/features/learner_profile/urls.py | Python | agpl-3.0 | 638 |
import requests
from selfdrive.version import version
def api_get(endpoint, method='GET', timeout=None, access_token=None, **params):
backend = "https://api.commadotai.com/"
headers = {}
if access_token is not None:
headers['Authorization'] = "JWT "+access_token
headers['User-Agent'] = "openpilot-" + ve... | klaus385/openpilot | common/api/__init__.py | Python | mit | 431 |
from django.apps import AppConfig
class CoreConfig(AppConfig):
name = "source.core"
label = "core"
| olivertso/moneify | source/core/apps.py | Python | gpl-3.0 | 109 |
""" S3-backed pypi server """
import os
import sys
import calendar
import datetime
import logging
import traceback
from pyramid.config import Configurator
from pyramid.renderers import JSON, render
from pyramid.settings import asbool
from pyramid_beaker import session_factory_from_settings
from six.moves.urllib.parse... | rubikloud/pypicloud | pypicloud/__init__.py | Python | mit | 5,812 |
# -*- coding: utf-8 -*-
#
# imagetrac_docker documentation build configuration file, created by
# sphinx-quickstart.
#
# 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
# autogenerated file.
#
# All configuration valu... | arsenalstriker14/imagetraccloud | docs/conf.py | Python | mit | 7,974 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "marko"
import sys, os, datetime, smtplib, json
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import codecs
from collections import OrderedDict
import traceback
import sqlalchemy
from sqlalchemy import and_
import jinja2... | nena1/OxwallDigest | launch.py | Python | gpl-2.0 | 12,682 |
#!/usr/bin/env python
# encoding: utf-8
"""Create a sublime project file
"""
import logging
import os
import subprocess
log = logging.getLogger('virtualenvwrapper.sublime')
def template(args):
"""Deduces project directory to create a new sublime project.
"""
project_filename = "%s/%s" % (os.environ.get... | jihan/virtualenvwrapper.sublime | virtualenvwrapper/sublime.py | Python | gpl-2.0 | 990 |
import config
#Base class
#----------------------------------------------------------------------
class Event:
#This is a superclass for any events that might be generated by an
#object and sent to the EventManager
def __init__(self):
self.name = "Generic Event"
#General events
#-------------... | JordanMagnuson/Country-Connect | events.py | Python | lgpl-2.1 | 6,116 |
"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import unicode_literals
import json
from atomic_reactor.core import DockerTasker
from atomic_reactor.inner import DockerBui... | vrutkovs/atomic-reactor | tests/plugins/test_import_image.py | Python | bsd-3-clause | 8,863 |
"""SCons.Tool.zip
Tool-specific initialization for zip.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation
#
# Permiss... | BenLand100/rat-pac | python/SCons/Tool/zip.py | Python | bsd-3-clause | 3,291 |
# *** BFS Graph Solver ***
# (c) Krzysztof Kondrak (at) gmail (dot) com
import sys
import os
import itertools
import getopt
import pickle
from graph import *
from pathFinding import *
from tools import ProgressBar, usage, processGraphFile
sys.path.append(os.getcwd())
SILENT_MODE = False
def Message(msg):
if no... | kondrak/graph_bfs_solver | solver.py | Python | mit | 7,116 |
#!/usr/bin/python
r0 = [ 5, 0, 9, 8, 1, 2, 7, 0, 0 ]
r1 = [ 0, 0, 0, 9, 0, 6, 2, 5, 1 ]
r2 = [ 0, 0, 2, 0, 3, 0, 0, 6, 0 ]
r3 = [ 0, 0, 0, 0, 0, 5, 0, 7, 0 ]
r4 = [ 8, 7, 6, 0, 2, 0, 5, 4, 9 ]
r5 = [ 0, 4, 0, 7, 0, 0, 0, 0, 0 ]
r6 = [ 0, 5, 0, 0, 9, 0, 8, 0, 0 ]
r7 = [ 7, 9, 8, 1, 0, 4, 0, 0, 0 ]
r8 ... | jtraver/dev | python/sudoku/brute1.py | Python | mit | 2,806 |
from datetime import date
class MethodGet:
def __init__(self, query_user):
"""
:param query_user: Investment objects from ..models.py
"""
self.month_01 = date.today().strftime('%Y-%m-01')
# self.query_user = query_user
self.query_default = query_user.filter(date__gt... | hpfn/charcoallog | charcoallog/investments/get_service.py | Python | gpl-3.0 | 389 |
import logging
import time
from nose.tools import assert_equal, with_setup, assert_false, eq_, ok_
from nose.plugins.attrib import attr
from django.http import HttpRequest, HttpResponse
import json
from django.test.client import Client
from django.core.urlresolvers import reverse
from django.contrib.auth.models impo... | mozilla/badges.mozilla.org | badger/tests/test_middleware.py | Python | bsd-3-clause | 3,595 |
import logging
from ckan import logic
from ckan import lib
import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit
import ckan.plugins as plugins
import ckanext.dcatapit.validators as validators
import ckanext.dcatapit.schema as dcatapit_schema
import ckanext.dcatapit.helpers as helpers
import ckanext... | NicoVarg99/daf-recipes | ckan/ckan/ckanext-dcatapit/ckanext/dcatapit/plugin.py | Python | gpl-3.0 | 17,385 |
from django.contrib.sitemaps import Sitemap
from django_de.apps.ticker.models import Entry
class TickerSitemap(Sitemap):
changefreq = "daily"
priority = 0.6
def items(self):
return Entry.objects.public()
def lastmod(self, obj):
return obj.modified
| django-de/django-de-v2 | django_de/apps/ticker/sitemaps.py | Python | bsd-3-clause | 283 |
import fileinput # 1
for line in fileinput.input(inplace=True): # 2
line = line.rstrip() # 3
num = fileinput.lineno() # 4
print '%-40s # %2i' % (line, num) # 5
| wufengwhu/my_blog | exercise/numberlines.py | Python | apache-2.0 | 232 |
#
# Copyright 2017 CNIT - Consorzio Nazionale Interuniversitario per le Telecomunicazioni
#
# 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/LICE... | superfluidity/RDCL3D | code/lib/srv6_net_prog/srv6_net_prog_rdcl_graph.py | Python | apache-2.0 | 2,398 |
#!/usr/bin/python
#
# This widget demonstrates the http-cache code: with the Vary response
# header, beng-proxy knows how to cache different responses for the
# same resource.
#
# author: Max Kellermann <mk@cm4all.com>
from os import getenv
from sys import stdout
from datetime import date, timedelta
from time import m... | CM4all/beng-proxy | demo/cgi-bin/vary.py | Python | bsd-2-clause | 684 |
"""Meta related things."""
from __future__ import unicode_literals
from collections import namedtuple
import re
RE_VER = re.compile(
r'''(?x)
(?P<major>\d+)(?:\.(?P<minor>\d+))?(?:\.(?P<micro>\d+))?
(?:(?P<type>a|b|rc)(?P<pre>\d+))?
(?:\.post(?P<post>\d+))?
(?:\.dev(?P<dev>\d+))?
'''
)
REL_MAP... | max00xam/service.maxxam.teamwatch | lib/soupsieve/__meta__.py | Python | gpl-3.0 | 6,621 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
#
"""Module to emulate a VT100 terminal in Tkinter.
Maintainer: Paul Swartz
"""
try:
import tkinter as Tkinter
import tkinter.font as tkFont
except ImportError:
import Tkinter, tkFont
import string
from . import ansi
ttyFont = None... | EricMuller/mynotes-backend | requirements/twisted/Twisted-17.1.0/src/twisted/conch/ui/tkvt100.py | Python | mit | 7,052 |
def ispal(n):
n=str(n)
half=len(n)//2
return n[:half]==n[::-1][:half]
def reverse(n):
return int(str(n)[::-1])
def islychrel(n):
for i in xrange(50):
n+=reverse(n)
if ispal(n):
return 0
return 1
if __name__ == "__main__":
total_lychrels=0
for i in ... | jamtot/PyProjectEuler | 55 - Lychrel numbers/lychrel.py | Python | mit | 456 |
import math
import shutil
import time
from typing import Any, Callable, Dict, List, Optional
import click
from valohai_cli.utils import force_text
class LayoutElement:
style: Dict[str, Any] = {}
layout: 'Layout'
def draw(self) -> None:
raise NotImplementedError(f'{self.__class__} must implement... | valohai/valohai-cli | valohai_cli/tui.py | Python | mit | 3,896 |
"""
"""
import unittest
import numpy as np
from skgstat.estimators import matheron, cressie, dowd, genton
from skgstat.estimators import minmax, percentile, entropy
class TestEstimator(unittest.TestCase):
def setUp(self):
pass
def test_matheron(self):
# extract actual estimator
e =... | mmaelicke/scikit-gstat | skgstat/tests/test_estimator.py | Python | mit | 3,116 |
from django.core.management import BaseCommand
from django.db.models import Count
from zds.notification.models import Subscription
class Command(BaseCommand):
help = "Delete all but last duplicate subscriptions"
def handle(self, *args, **options):
self.stdout.write("Starting uniquifying subscription... | ChantyTaguan/zds-site | zds/notification/management/commands/uniquify_subscriptions.py | Python | gpl-3.0 | 1,008 |
import mox
from django.test import TestCase
from mistune import Markdown
from model_mommy import mommy
from djblog.models import Article
class ArticleTest(TestCase):
def setUp(self):
self.mock = mox.Mox()
def tearDown(self):
self.mock.UnsetStubs()
def test_is_published(self):
... | buddylindsey/dj-blog | tests/test_models.py | Python | bsd-3-clause | 1,356 |
#!/usr/bin/python
import logging
import os
import StringIO
import subprocess
import unittest
import select
try:
import autotest.common as common
except ImportError:
import common
from autotest.client.shared import logging_manager, logging_config
class PipedStringIO(object):
"""
Like StringIO, but al... | joyxu/autotest | client/shared/logging_manager_unittest.py | Python | gpl-2.0 | 8,740 |
# vim: set encoding=utf-8
# Copyright (c) 2016 Intel 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 require... | ashaarunkumar/spark-tk | python/sparktk/frame/ops/map_columns.py | Python | apache-2.0 | 3,144 |
#http://stackoverflow.com/questions/18907503/logging-in-to-linkedin-with-python-requests-sessions
import http.cookiejar as cookielib
import os
import urllib
import re
import string
from bs4 import BeautifulSoup
cookie_filename = "parser.cookies.txt"
username = "check-ai-team@umich.edu"
password = "checkaiteam"
class... | preetsmohan/check-ai | scrapers/linkedin_scraper.py | Python | mit | 3,572 |
#!/usr/bin/env python
"""A simple qsub based cluster submission script for Torque."""
__author__ = "Jens Reeder"
__copyright__ = "Copyright 2011-2013, The PICRUSt Project"
__credits__ = ["Jens Reeder",
"Rob Knight",
"Greg Caporaso",
"Morgan Langille"]
__license__ = "GPL"... | zaneveld/picrust | scripts/start_parallel_jobs_torque.py | Python | gpl-3.0 | 3,676 |
"""module interval.py
This module contains functions to estimate confidence or credible intervals.
"""
import logging
import math
import scipy.optimize
import scipy.stats
__all__ =['pllr']
# Logging system
logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)
_ch = logging.StreamHandler() # Console... | bruneli/statspy | statspy/interval.py | Python | bsd-3-clause | 5,471 |
#!/usr/bin/python
# Script pour telecharger City
import MySQLdb
file_ = open('city.csv', 'w')
file_.write ('city_id,city,country_id\n')
db = MySQLdb.connect( user='etudiants',
passwd='etudiants_1',
host='192.168.99.100',
db='sakila')
cur = db.cursor... | setrar/INF1069 | C.PYTHON/mysql.py | Python | mit | 475 |
import os
from cuttsum.resources import MultiProcessWorker
import cuttsum.judgements
import pandas as pd
import numpy as np
import regex as re
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LogisticRegression
from sklearn import cross_validation
from sklearn.metrics import ... | kedz/cuttsum | trec2015/cuttsum/classifiers/_nugget_classifier.py | Python | apache-2.0 | 17,658 |
from numbers import Number
from interfaces.emuinput import EmuInput
class DummyInput(EmuInput):
"""
Dummy class for use in unit testing.
"""
def _validate_content(content):
return True
def _validate_count(count):
return isinstance(count, Number) | jk977/twitch-plays | bot/tests/structs/dummyinput.py | Python | gpl-3.0 | 283 |
'''
Created on Mar 22, 2011
@author: jeroen
'''
import os
from fileinfo import FileInfo
from bytesize import ByteSize
class DirInfo(object):
'''
Simple class to represent a directory and obtain data about if when needed.
'''
def __init__(self, path, recursive=False):
'''
Construc... | JeroenDeDauw/phpstat | src/phpstat/dirinfo.py | Python | gpl-3.0 | 4,098 |
# Copyright (c) 2012 OpenStack Foundation.
#
# 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... | shakamunyi/neutron-vrrp | neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py | Python | apache-2.0 | 71,665 |
from .adjusters import runAdjusters, addAdjuster # noqa
from .gui import GUI # noqa
from .tpcore import ( # noqa
updateReposers,
reposerExists,
goToBindPose,
matchReposer,
markBindPose,
getReposeRoots,
) | patcorwin/fossil | pdil/tool/fossil/_lib/tpose/__init__.py | Python | bsd-3-clause | 258 |
from utils import CanadianScraper, CanadianPerson as Person
COUNCIL_PAGE = 'http://www.mississauga.ca/portal/cityhall/mayorandcouncil'
MAYOR_PAGE = 'http://www.mississauga.ca/portal/cityhall/mayorsoffice'
CONTACT_PAGE = 'http://www.mississauga.ca/portal/helpfeedback/contactus'
class MississaugaPersonScraper(Canadian... | opencivicdata/scrapers-ca | ca_on_mississauga/people.py | Python | mit | 1,883 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.