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 django.apps import AppConfig
class DkappConfig(AppConfig):
name = 'dkapp'
| rakvat/direktkreditverwaltung | dkapp/apps.py | Python | gpl-3.0 | 85 |
from bson.objectid import ObjectId
class UserMongoUtils(object):
def __init__(self, mongo):
self.mongo = mongo
self.users_collection = 'user'
| crtarsorg/glasomer.rs-v2 | app/utils/user_mongo_utils.py | Python | cc0-1.0 | 165 |
'''
Classes related to producing logs
'''
__copyright__='''
Copyright (C) 2014 Andrew Beekhof <andrew@beekhof.net>
Licensed under the GNU GPL.
'''
#
# 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 Foundat... | ingted/pacemaker | cts/logging.py | Python | gpl-2.0 | 3,204 |
# -*- coding: utf-8 -*-
from django.db import models
from south.db import db
from south.utils import datetime_utils as datetime
from south.v2 import SchemaMigration
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'ActionServer.command_type'
db.add_column(u'xmlrpc_actions... | Pajinek/vhm | server/apps/xmlrpc/migrations/0004_auto__add_field_actionserver_command_type.py | Python | gpl-2.0 | 7,426 |
#!/usr/bin/env python
#encoding:utf-8
#author:smeggingsmegger/Scott Blevins
#project:PyBambooHR
#repository:http://github.com/smeggingsmegger/PyBambooHR
#license:mit (http://opensource.org/licenses/MIT)
"""
PyBambooHR.py contains a class by the same name with functions that correspond
to BambooHR API calls defined at ... | smeggingsmegger/PyBambooHR | PyBambooHR/PyBambooHR.py | Python | mit | 32,466 |
# 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 *
class RRrcov(RPackage):
"""rrcov: Scalable Robust Estimators with High Breakdown Point"""
h... | iulian787/spack | var/spack/repos/builtin/packages/r-rrcov/package.py | Python | lgpl-2.1 | 932 |
# Copyright 2016 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Writes a dictionary to a json file with the passed key-value pairs.
Expected to be called like:
dump_build_config.py path/to/file.json [key1=value1 ...... | zero-ui/miniblink49 | v8_7_5/tools/testrunner/utils/dump_build_config.py | Python | gpl-3.0 | 658 |
"Database cache backend."
import base64
from datetime import datetime
from django.conf import settings
from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache
from django.db import DatabaseError, connections, router, transaction
from django.db.backends.utils import typecast_timestamp
from django.utils i... | memtoko/django | django/core/cache/backends/db.py | Python | bsd-3-clause | 8,779 |
#
raise ExceptionType(abc)
#
| general-language-syntax/GLS | test/integration/ThrowException/one parameter.py | Python | mit | 29 |
import dices
class skill(object):
"""
Contains a skill.
calling is done by skill(bases,value,known=True)
bases::string : attributes it depends on. (either ABCx2 or ABC+XYZ format)
value: value of the skill. If left empty, standard is calculated.
study(learned) --> learned is added to the valu... | kergely/Character-creator-szerep | src/skills.py | Python | mit | 4,916 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
ROOT_WEATHER_API = 'openweathermap.org/data/2.5'
OBSERVATION_URI = 'weather'
GROUP_OBSERVATIONS_URI = 'group'
STATION_URI = 'station'
FIND_OBSERVATIONS_URI = 'find'
FIND_STATION_URI = 'station/find'
BBOX_STATION_URI = 'box/station'
BBOX_CITY_URI = 'box/city'
THREE_HOURS_F... | csparpa/pyowm | pyowm/weatherapi25/uris.py | Python | mit | 573 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
#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) any later version.
#
#This program is distributed i... | corryl/facebook-leak | facebook-leak.py | Python | gpl-3.0 | 1,513 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
# Facilities to record pushrebase traffic. Primary motivation is to replay it
# on another hg backend e. g. Mononoke
import json
import subprocess
impo... | facebookexperimental/eden | eden/hg-server/edenscm/hgext/pushrebase/recording.py | Python | gpl-2.0 | 4,801 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import gconf
import gtk
import logging
import subprocess
from pango import FontDescription
from xml.sax.saxutils import escape as xml_escape
import guake.notifier
from guake.common import _
from guake.commo... | saisai/guake | src/guake/gconfhandler.py | Python | gpl-2.0 | 22,957 |
# Copyright 2016 - Nokia
#
# 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, sof... | openstack/vitrage | vitrage/tests/unit/entity_graph/states/test_datasource_info_mapper.py | Python | apache-2.0 | 11,911 |
import xlrd
import csv
import sys;
reload(sys);
sys.setdefaultencoding("utf8")
with xlrd.open_workbook('GeocodesVer2.xls') as wb:
sh = wb.sheet_by_index(0) # or wb.sheet_by_name('name_of_the_sheet_here')
with open('alpha.geocodes.csv', 'wb') as f:
c = csv.writer(f)
for r in range(sh.nrows):
... | rukku/casualty-geocoder | geocodes.xls2csv.py | Python | gpl-2.0 | 359 |
# vim: set fileencoding=utf-8
# Mountpoint selector accordion and page classes
#
# Copyright (C) 2012-2014 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your o... | jkonecny12/anaconda | pyanaconda/ui/gui/spokes/lib/accordion.py | Python | gpl-2.0 | 21,821 |
#!/usr/bin/env python
"""
Copyright (C) 2014, Digium, Inc.
Mark Michelson <mmichelson@digium.com>
Matt Jordan <mjordan@digium.com>
This program is free software, distributed under the terms of
the GNU General Public License Version 2.
"""
import logging
from asterisk.test_case import TestCase
from twisted.internet im... | coreyfarrell/testsuite | tests/manager/exten_state_list/ami_exten_state_list.py | Python | gpl-2.0 | 6,630 |
# -*- coding: utf-8 -*-
'''
Exodus Add-on
Copyright (C) 2016 Exodus
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 opti... | JamesLinEngineer/RKMC | addons/plugin.video.exodus/resources/lib/indexers/movies.py | Python | gpl-2.0 | 45,657 |
# -*- coding: utf-8 -*-
"""
Django settings for LNUPdemo project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
# Build paths inside the project like this: os.pa... | ostercloud/LNUPdemo | LNUPdemo/config/settings.py | Python | bsd-3-clause | 13,817 |
'''
Created on Jul 19, 2011
@author: sean
'''
from __future__ import print_function
from . import Visitor
import sys
import _ast
from warnings import warn
if sys.version_info.major < 3:
from StringIO import StringIO
else:
from io import StringIO
class Indentor(object):
def __init__(self, printer, inden... | diana-hep/femtocode | lang/femtocode/thirdparty/meta/asttools/visitors/print_visitor.py | Python | apache-2.0 | 5,036 |
def consecutive(arr):
arr.sort()
return len(set(xrange(arr[0], arr[-1] + 1)).difference(arr)) if arr else 0
| the-zebulan/CodeWars | katas/kyu_7/consecutive_numbers_needed.py | Python | mit | 116 |
# -*- encoding:utf-8 -*-
import logging
from flask import (
Blueprint, Response,
current_app,
abort, jsonify, redirect, stream_with_context, request,
render_template, render_template_string, make_response
)
from bergenholm.database.groups import (
get_group, get_groups, create_group, update_group,... | yosshy/bergenholm | bergenholm/views/groups.py | Python | apache-2.0 | 1,270 |
# -*- coding: utf-8 -*-
"""
gspread.client
~~~~~~~~~~~~~~
This module contains Client class responsible for communicating with
Google Data API.
"""
import re
try:
from urllib import urlencode
except ImportError:
from urllib.parse import urlencode
from xml.etree import ElementTree
from . import __version__... | steven-martins/Drive2Ini | gsp/client.py | Python | mit | 11,160 |
# ***** BEGIN GPL LICENSE BLOCK *****
#
#
# 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 distribute... | PLyczkowski/Sticky-Keymap | 2.74/scripts/addons/object_edit_linked.py | Python | gpl-2.0 | 10,520 |
import os
import platform
import threading
import time
from http.client import HTTPConnection
from distutils.spawn import find_executable
import pytest
from path import Path
from more_itertools import consume
import portend
import cherrypy
from cherrypy._cpcompat import HTTPSConnection
from cherrypy.lib import sessio... | JonnyWong16/plexpy | lib/cherrypy/test/test_session.py | Python | gpl-3.0 | 17,949 |
import unittest
from test import support
from test.test_grammar import (VALID_UNDERSCORE_LITERALS,
INVALID_UNDERSCORE_LITERALS)
from random import random
from math import atan2, isnan, copysign
import operator
INF = float("inf")
NAN = float("nan")
# These tests ensure that complex math ... | yotchang4s/cafebabepy | src/main/python/test/test_complex.py | Python | bsd-3-clause | 30,275 |
# Copyright 2019 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 writing,... | google/personfinder | tests/server_test_cases/input_escaping_tests.py | Python | apache-2.0 | 5,290 |
#!/usr/bin/env python
#
# Appcelerator Titanium Module Packager
#
#
import os, subprocess, sys, glob, string
import zipfile
from datetime import date
cwd = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename))
os.chdir(cwd)
required_module_keys = ['architectures', 'name','version','moduleid','descripti... | McDo/tipop | iphone/build.py | Python | mit | 8,628 |
#!/usr/bin/env python
#! -*- encoding:utf-8
import sys
import requests
import requests_cache
from os.path import dirname
from BeautifulSoup import BeautifulSoup
from model import *
VERBOSE_LEVEL = 0
def fetch_villages(url, town):
i = 0
while True:
try:
response = requests.get(url)
... | gokush/CNRegion | cnregion/fetch.py | Python | mit | 6,153 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-07-05 11:12
from __future__ import unicode_literals
from django.conf import settings
import django.contrib.postgres.fields
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import taiga.projects.notificatio... | xdevelsistemas/taiga-back-community | taiga/projects/epics/migrations/0001_initial.py | Python | agpl-3.0 | 4,984 |
'''
Copyright 2011 Jean-Baptiste B'edrune, Jean Sigwald
Using New BSD License:
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditio... | ydkhatri/mac_apt | plugins/helpers/hfs_alt.py | Python | mit | 22,333 |
#
# Copyright (c) 2015 Will Bond, Mjumbe Wawatu Ukweli, 2012 Canonical Ltd
#
# This program 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, version 3 only.
#
# This program is distributed in the hope th... | ticklemepierce/ghostpy | ghostpy/_compiler.py | Python | lgpl-3.0 | 45,996 |
import re
import random
from itertools import chain
from discord.ext import commands
from sqlalchemy import func
import equations
from . import util
from .util import m
async def do_roll(expression, session, character=None, output=[]):
'''
Does the variable replacement and dice rolling
'''
expressio... | b-hodges/dice-bot | dicebot/cogs/rolls.py | Python | mit | 10,909 |
#!/usr/bin/python
import sys
import json
import argparse
from operator import itemgetter
curr_year = 2016
max_age = 150
result = []
dups = {}
missing = []
parser = argparse.ArgumentParser(description='Finalizes the dataset, sorts by rating.')
parser.add_argument('--limit', default=None, type=int,
... | ybogdanov/history-timeline | scripts/final.py | Python | gpl-2.0 | 1,817 |
# -*- coding: utf-8 -*-
"""
A Theil-Sen Estimator for Multiple Linear Regression Model
"""
# Author: Florian Wilhelm <florian.wilhelm@gmail.com>
#
# License: BSD 3 clause
import warnings
from itertools import combinations
import numpy as np
from scipy import linalg
from scipy.special import binom
from scipy.linalg.... | kevin-intel/scikit-learn | sklearn/linear_model/_theil_sen.py | Python | bsd-3-clause | 14,823 |
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 |
# -*- coding: utf-8 -*-
"""Prepare configure file for fuzzy slope position inference program.
@author : Liangjun Zhu
@changelog:
- 15-09-08 lj - initial implementation.
- 17-07-30 lj - reorganize and incorporate with pygeoc.
"""
from __future__ import absolute_import, unicode_literals
import time
... | lreis2415/AutoFuzSlpPos | autofuzslppos/FuzzySlpPosInference.py | Python | gpl-2.0 | 6,208 |
# -*- coding: utf-8 -*-
import json
from django.conf.urls import patterns, url
from django.contrib import admin
from django import forms
from tracker import models
from django.utils.translation import ugettext, ugettext_lazy as _
from django.http import Http404, HttpResponse, HttpResponseNotAllowed
from django.templat... | che0/teh-tracker | trackersite/tracker/admin.py | Python | gpl-2.0 | 5,963 |
# Copyright 2014 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 ... | wijnandb/CodeCult-Scratch | tests/functional/modules_questionnaire.py | Python | apache-2.0 | 9,171 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-18 12:16
from __future__ import unicode_literals
import django.contrib.gis.db.models.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('primus', '0020_island_geom'),
]
operations = [
... | sighill/shade_app | primus/migrations/0021_auto_20160418_1416.py | Python | mit | 503 |
# -*- coding: UTF-8 -*-
# utils.py
#
# Copyright (C) 2014 HES-SO//HEG Arc
#
# Author(s): Cédric Gaspoz <cedric.gaspoz@he-arc.ch>
#
# This file is part of Midefa.
#
# Midefa 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 ... | HEG-Arc/Midefa | midefa/theglue/utils.py | Python | gpl-3.0 | 4,889 |
#!/usr/bin/env python3
import os
import socket
import ssl
import sys
import time
import dummy_killer
import socketserver
PORT = 14433
HOST_NAME = '127.0.0.1'
PID = "/tmp/dummy_ssl.pid"
class SSLTCPHandler(socketserver.StreamRequestHandler):
def handle(self):
time.sleep(0.5)
data = self.request.... | moisseev/rspamd | test/functional/util/dummy_ssl.py | Python | apache-2.0 | 1,883 |
#!/usr/bin/env python3
import os
from setuptools import setup, find_packages
from homeassistant.const import (__version__, PROJECT_PACKAGE_NAME,
PROJECT_LICENSE, PROJECT_URL,
PROJECT_EMAIL, PROJECT_DESCRIPTION,
PROJECT_CL... | srcLurker/home-assistant | setup.py | Python | mit | 1,381 |
# -*- encoding: utf-8 -*-
from __future__ import print_function
try:
from urllib.request import build_opener, Request, HTTPCookieProcessor
except ImportError:
from urllib2 import build_opener, Request, HTTPCookieProcessor
try:
from urllib.parse import urlencode as urlencode_
urlencode = lambda data: u... | shucommon/little-routine | training/python/web-crawler-training-exercise/exercise/e02-form-post/form-post-save-cookie.py | Python | gpl-3.0 | 1,265 |
# -*- coding: utf-8 -*-
import pytest
from widgetastic.utils import partial_match
from cfme.common.provider import cleanup_vm
from cfme.rest.gen_data import dialog as _dialog
from cfme.rest.gen_data import service_catalog_obj as _catalog
from cfme.services.catalogs.catalog_item import CatalogItem
from cfme.services.se... | quarckster/cfme_tests | cfme/fixtures/service_fixtures.py | Python | gpl-2.0 | 3,364 |
"""drop unused bill_event_table
Revision ID: 2ff6718f2a66
Revises: 1bc74869f9f0
Create Date: 2015-02-11 09:28:12.315901
"""
# revision identifiers, used by Alembic.
revision = '2ff6718f2a66'
down_revision = '1bc74869f9f0'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def up... | Code4SA/pmg-cms-2 | migrations/versions/2ff6718f2a66_drop_unused_bill_event_table.py | Python | apache-2.0 | 953 |
from common.log import logUtils as log
from constants import clientPackets
from constants import serverPackets
def handle(userToken, packetData):
# get token data
username = userToken.username
# Read packet data
packetData = clientPackets.setAwayMessage(packetData)
# Set token away message
userToken.awayMessa... | osuripple/pep.py | events/setAwayMessageEvent.py | Python | agpl-3.0 | 743 |
import frappe
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
def execute():
frappe.reload_doc('accounts', 'doctype', 'accounting_dimension')
accounting_dimensions = frappe.db.sql("""select fieldname, label, document_type, disabled from
`tabAccounting Dimension`""", as_dict=1)
... | mhbu50/erpnext | erpnext/patches/v12_0/create_accounting_dimensions_in_missing_doctypes.py | Python | gpl-3.0 | 1,090 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 CERN.
##
## Invenio 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 ve... | pombredanne/invenio | modules/bibformat/lib/bibformatadmin_regression_tests.py | Python | gpl-2.0 | 2,884 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2013 ErpAndCloud All Rights Reserved
# https://github.com/jmesteve
# https://github.com/escrichov
# ... | jmesteve/saas3 | openerp/addons_extra/google_map_kml/__openerp__.py | Python | agpl-3.0 | 2,030 |
from django.contrib import admin
from .models import BookingState, Booking, BookingItem, TrackingEvent, TrackingValue, Agreement, Payment
@admin.register(BookingState)
class BookingStateAdmin(admin.ModelAdmin):
list_display = ('title', 'color', 'income')
@admin.register(Agreement)
class AgreementAdmin(admin.Mod... | eedf/jeito | booking/admin.py | Python | mit | 1,743 |
#
# Copyright (c) 2008-2015 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | mahabs/nitro | nssrc/com/citrix/netscaler/nitro/resource/config/appfw/appfwprofile_contenttype_binding.py | Python | apache-2.0 | 9,811 |
#
# Copyright (c) 2012, Regents of the University of California
# BSD license, See the COPYING file for more information
# Written by: Derek Kulinski <takeda@takeda.tk>
#
__TT_BITS__ = 3
__TT_MASK__ = (1 << __TT_BITS__) - 1
__TT_HBIT__ = (1 << 7)
__TT_LBIT__ = __TT_HBIT__ - 1
DTAG_NAME = 14
DTAG_COLLECTION = 17... | cawka/packaging-PyNDN | python/pyndn/impl/ndnb.py | Python | bsd-3-clause | 2,362 |
"""Provide a way to connect entities belonging to one device."""
from collections import OrderedDict
import logging
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Set, Tuple, Union
import attr
from homeassistant.const import EVENT_HOMEASSISTANT_STARTED
from homeassistant.core import Event, callback
impo... | titilambert/home-assistant | homeassistant/helpers/device_registry.py | Python | apache-2.0 | 22,483 |
import mxnet as mx
import logging
import os
import time
def _get_lr_scheduler(args, kv):
if 'lr_factor' not in args or args.lr_factor >= 1:
return (args.lr, None)
epoch_size = args.num_examples / args.batch_size
if 'dist' in args.kv_store:
epoch_size /= kv.num_workers
begin_epoch = args.load_epoch if ... | yancz1989/lr_semi | common/fit.py | Python | mit | 6,993 |
#! /usr/bin/env python
#
# Copyright (c) 2008-2013 University of Utah and the Flux Group.
#
# {{{GENIPUBLIC-LICENSE
#
# GENI Public License
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without rest... | nmc-probe/emulab-nome | protogeni/test/listimages.py | Python | agpl-3.0 | 1,913 |
# There are two kangaroos on a number line ready to jump in the
# positive direction (i.e, toward positive infinity). The first
# kangaroo starts at location x1 and moves at a rate of v1 meters
# per jump. The second kangaroo starts at location x2 and moves
# at a rate of v2 meters per jump. Given the starting loca... | Murillo/Hackerrank-Algorithms | Algorithms/Implementation/kangaroo.py | Python | mit | 941 |
from graphics import *
import cv2
import time
import warp
import matchpicture
import graypictrue
import arm
timeF=0 #时间片
lasttimeF=0xffffff#上一次执行的时间片
win = GraphWin('testAI', 720, 720)
win.setBackground('yellow')
p = [[0 for a in range(20)] for b in range(20)]
black = [[0 for a in range(20)] for b in ra... | hakujyo/chessplaying_robot | AI.py | Python | gpl-3.0 | 20,898 |
# Copyright (c) 2013 eNovance
#
# 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, ... | zancas/hacking | hacking/tests/checks/test_comments.py | Python | apache-2.0 | 2,468 |
"""
Connect with VKLongpoll
"""
import time
from concurrent.futures import ThreadPoolExecutor
from requests.exceptions import ConnectionError as RequestsConnectionError
from django.core.management.base import BaseCommand
import vk_api
from vk_api.bot_longpoll import VkBotLongPoll, VkBotEventType
from main.bot import Bo... | Ridys/ribot | main/management/commands/longpoll.py | Python | bsd-3-clause | 1,446 |
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 24 15:08:01 2013
@author: steve
"""
import numpy as np
import mdptoolbox
from .utils import SMALLNUM, P_forest, R_forest, P_small, R_small, P_sparse
from .utils import P_forest_sparse, R_forest_sparse
def test_ValueIterationGS_small():
sdp = mdptoolbox.mdp.ValueIt... | silgon/pymdptoolbox | src/tests/test_ValueIterationGS.py | Python | bsd-3-clause | 1,658 |
"""
Unit tests for reverse URL lookups.
"""
__test__ = {'API_TESTS': """
RegexURLResolver should raise an exception when no urlpatterns exist.
>>> from django.core.urlresolvers import RegexURLResolver
>>> no_urls = 'regressiontests.urlpatterns_reverse.no_urls'
>>> resolver = RegexURLResolver(r'^$', no_urls)
>>> resol... | iguzu/gae-django | tests/regressiontests/urlpatterns_reverse/tests.py | Python | bsd-3-clause | 12,590 |
# -*- coding: utf-8 -*-
"""
Copyright (c) 2012 University of Oxford
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modif... | benosteen/django-databank | src/frontend/utils/_old/ident_md.py | Python | mit | 1,379 |
# Copyright 2018 Samsung Electronics
# 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 requi... | openstack/vitrage | vitrage/datasources/trove/cluster/driver.py | Python | apache-2.0 | 1,930 |
__author__ = 'lorenzo'
from config.config import _HYDRA_VOCAB
EntryPoint = {
"@context": {
"hydra": "http://www.w3.org/ns/hydra/core#",
"vocab": _HYDRA_VOCAB + "#",
"EntryPoint": "vocab:EntryPoint",
"subsystems": {
"@id": "vocab:EntryPoint/subsystems",
"@typ... | pincopallino93/rdfendpoints | hydra/contexts.py | Python | apache-2.0 | 4,311 |
from appfd.models import Place
@then(u'The number of places should be greater than 10 million')
def check_number_of_places(context):
assert(Place.objects.count() > 10000000)
| DanielJDufour/firstdraft | projfd/features/steps/geonames.py | Python | apache-2.0 | 178 |
from dal import autocomplete, forward
from django import forms
from django.contrib import admin
from djiffy.admin import ManifestSelectWidget
from derrida.common.admin import NamedNotableAdmin
from derrida.footnotes.admin import FootnoteInline
from .models import Subject, Language, Publisher, OwningInstitution, \
... | Princeton-CDH/derrida-django | derrida/books/admin.py | Python | apache-2.0 | 14,846 |
import unittest
from tests import test_pluggable_package
suite = unittest.TestSuite()
loader = unittest.defaultTestLoader
suite.addTest(loader.loadTestsFromModule(test_pluggable_package))
| monkeython/scriba | tests/__init__.py | Python | bsd-3-clause | 191 |
# - * - Coding: utf -8 - * -
from django.http import HttpResponse
def page(request):
return HttpResponse("Hello World!")
| fenexomega/DjangoBookExercises | example_app/index.py | Python | gpl-3.0 | 124 |
from __future__ import print_function, absolute_import
from PySide2 import QtGui,QtCore,QtWidgets
from math import *
import pickle, os, json
import learnbot_dsl.guis.EditVar as EditVar
from learnbot_dsl.learnbotCode.Block import *
from learnbot_dsl.learnbotCode.Language import getLanguage
from learnbot_dsl.learnbotCode... | robocomp/learnbot | learnbot_dsl/learnbotCode/VisualBlock.py | Python | gpl-3.0 | 29,715 |
# coding=utf-8
#
# This file is part of Medusa.
#
# Medusa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Medusa is distributed in... | FireBladeNooT/Medusa_1_6 | medusa/show/recommendations/anidb.py | Python | gpl-3.0 | 3,966 |
"""
Test the Service state
"""
from sermin import Service
from sermin.utils import shell, ShellError
from .utils import FullTestCase
class ServiceTest(FullTestCase):
# Service to use for tests
service = 'atd'
def clean(self):
"""
Ensure service is not running
"""
shell('/... | radiac/sermin | tests/test_state_service.py | Python | bsd-3-clause | 1,405 |
queries = [
'tak(Crime)',
'tak(Criminal)',
'tak(homicide violence)',
'tak(homicide gang)',
'tak(homicide rates)',
'tak(homicide gun)',
'tak(homicide firearm)',
'tak(homicide economics)',
'tak(homicide impact)',
'tak(kill violence)',
'tak(kill gang)',
'tak(kill rates)',
... | latorrefabian/gapmaps | gapmaps/query.py | Python | mit | 5,285 |
from django.core.management.base import BaseCommand
from south.db import db
class Command(BaseCommand):
help = "Adds indexes that have to be defined with raw SQL commands"
def handle(self, **options):
db.execute('alter table videos_videourl add unique url_type (url(255), type);')
| ofer43211/unisubs | apps/videos/management/commands/setup_indexes.py | Python | agpl-3.0 | 298 |
# -*- coding: utf-8 -*-
"""
pygments.styles.bw
~~~~~~~~~~~~~~~~~~
Simple black/white only style.
:copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.style import Style
from pygments.token import Keyword, Name, Comment, Strin... | wakatime/wakatime | wakatime/packages/py27/pygments/styles/bw.py | Python | bsd-3-clause | 1,355 |
#!/usr/bin/env python3
"""Python binding of 7Seg Click wrapper of LetMeCreate library.
You must initialise the SPI bus and select the right one before using any of
these functions.
"""
import ctypes
_LIB = ctypes.CDLL('libletmecreate_click.so')
def display_decimal_number(dec_num):
"""Display a decimal number o... | francois-berder/PyLetMeCreate | letmecreate/click/seven_seg.py | Python | bsd-3-clause | 1,540 |
# Copyright (c) 2015 Red Hat, 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 ... | cloudbase/neutron | neutron/agent/ovsdb/impl_idl.py | Python | apache-2.0 | 10,456 |
# 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... | dmlc/tvm | python/tvm/relay/_build_module.py | Python | apache-2.0 | 996 |
import logging
import numpy as np
from pycqed.measurement.randomized_benchmarking.clifford_group import (
clifford_lookuptable,
)
import pycqed.measurement.randomized_benchmarking.two_qubit_clifford_group as tqc
from pycqed.measurement.randomized_benchmarking.clifford_decompositions import (
gate_decomposition... | DiCarloLab-Delft/PycQED_py3 | pycqed/measurement/randomized_benchmarking/randomized_benchmarking.py | Python | mit | 8,558 |
# -*- coding: utf-8 -*-
"""
sphinx.ext.mathjax
~~~~~~~~~~~~~~~~~~
Allow `MathJax <http://mathjax.org/>`_ to be used to display math
in Sphinx's HTML writer - requires the MathJax JavaScript library
on your webserver/computer.
Kevin Dunn, kgdunn@gmail.com, 3-clause BSD license.
https://bit... | abhishektiwari/ToyProjects | Python/Sphinx_Ext/mathjax.py | Python | mit | 2,621 |
#!/usr/bin/env python2
#
# Copyright (C) 2013-2017(H)
# Max Planck Institute for Polymer Research
#
# This file is part of ESPResSo++.
#
# ESPResSo++ 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,... | govarguz/espressopp | testsuite/pickle_potential/pickle_potential.py | Python | gpl-3.0 | 1,526 |
# -*- coding: utf-8 -*-
# Copyright (C) 2012-2018 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed ... | rpm-software-management/dnf | tests/test_remove.py | Python | gpl-2.0 | 3,773 |
# (c) 2016, Dag Wieers <dag@wieers.com>
# (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 = '''
callback: dense
type: stdout
short_description: mi... | roadmapper/ansible | lib/ansible/plugins/callback/dense.py | Python | gpl-3.0 | 17,476 |
# Gaussian mixture model suign PyMC3
# Based on https://github.com/aloctavodia/BAP/blob/master/code/Chp6/06_mixture_models.ipynb
import superimport
import pymc3 as pm
import numpy as np
import scipy.stats as stats
import pandas as pd
import theano.tensor as tt
import matplotlib.pyplot as plt
import arviz as az
import... | probml/pyprobml | scripts/gmm_identifiability_pymc3.py | Python | mit | 2,149 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from io import open
from os import makedirs, urandom
from os.path import join, exists
from shutil import rmtree
from tempfile import mkdtemp
from rst2html5slides import SlideWriter
from docutils.core import publish_file, publish_string
presen... | wdv4758h/rst2html5slides | test/test_output_dir.py | Python | mit | 4,833 |
from lxml import etree
class PathfinderRace:
def __init__(self):
self.name = None
self.id = None
self.attributeMods = {}
self.size = None
self.speed = None;
self.subtypes = []
self.tags = []
self.startingLanguages = []
self.possibleLanguages = []
self.abilities = []
def genXML(self, root):
... | ghbenjamin/NotPathfinder | utils/xmlgen/RaceGen.py | Python | gpl-3.0 | 4,171 |
import mantidplottests
import os
import platform
import unittest
import mantidplot
from mantidplottests import runTests, threadsafe_call
from glob import glob
#from mantid.kernel import *
from mantid import AnalysisDataService, ConfigService
from mantid.simpleapi import CreateWorkspace
from PyQt4 import QtGui
import sh... | mganeva/mantid | MantidPlot/test/MantidPlotProjectRecovery.py | Python | gpl-3.0 | 1,644 |
# Copyright 2017 Mark Dickinson
#
# 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,... | mdickinson/pcgrandom | scripts/regenerate_data.py | Python | apache-2.0 | 1,960 |
from sys import argv
script, user_name = argv
prompt = "> "
print "Hi, %s, I'm the %s script." % (user_name, script)
print "I'd like to ask you a few questions."
print "Do you like me, %s?" % user_name
likes = raw_input(prompt)
print "Where do you live, %s?" % user_name
lives = raw_input(prompt)
print "What kind of... | wicker/python-the-hard-way | ex14.py | Python | gpl-3.0 | 533 |
# -*- coding: utf-8 -*-
# Copyright (C) 2012, 2015 Michael Boman (@mboman), Accuvant, Inc. (bspengler@accuvant.com)
#
# 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 Lice... | lixiangning888/whole_project | modules/signatures_merge_tmp/antivirus_virustotal.py | Python | lgpl-3.0 | 2,008 |
#
# Copyright (C) 2013 Pablo Barenbaum <foones@gmail.com>, Ary Pablo Batista <arypbatista@gmail.com>
#
# 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 y... | mateoqac/unqTip | language/vxgbs/lang/gbs_io.py | Python | gpl-3.0 | 4,006 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of You only get one! (match).
#
# 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
#... | Fenixin/yogom | scripts/match_counter.py | Python | gpl-3.0 | 3,267 |
############################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way witho... | CeltonMcGrath/TACTIC | src/bin/fixes/fix_submission.py | Python | epl-1.0 | 2,153 |
# *-* encoding: utf-8 *-*
import bnetapi.realm
import unittest
class RealmUnitTest(unittest.TestCase):
def setUp(self):
self.realmStatus = bnetapi.RealmStatus()
def tearDown(self):
del self.realmStatus
def test_QueryByName(self):
name = 'Uther'
status = self.realmStatus.QueryRealm(name, region = bn... | lightsfury/bnetapi | bnetapi_tests/realm.py | Python | mit | 1,626 |
##
# Copyright (c) 2009-2015 Apple 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 l... | red-hood/calendarserver | twistedcaldav/directory/augment.py | Python | apache-2.0 | 15,955 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# streamondemand.- XBMC Plugin
# Canal para piratestreaming
# http://blog.tvalacarta.info/plugin-xbmc/streamondemand.
#------------------------------------------------------------
import urlparse
import urllib2
import re
import sys
f... | Zanzibar82/streamondemand.test | channels/piratestreaming.py | Python | gpl-3.0 | 8,743 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
import pytest
from shuup.core.mode... | hrayr-artunyan/shuup | shuup_tests/core/test_module_interface.py | Python | agpl-3.0 | 646 |
#!/usr/bin/env python
import glob
import multiprocessing
import os
import random
import re
import subprocess as sp
import sys
import tempfile
import time
class TestBase:
supported_lang = {
'C': { 'cc': 'gcc', 'flags': 'CFLAGS', 'ext': '.c' },
'C++': { 'cc': 'g++', 'flags': 'CXXFLAGS', 'ext': '... | namhyung/uftrace | tests/runtest.py | Python | gpl-2.0 | 30,306 |
import getopt, sys
import ConfigParser, string
def config(cfgstruct, section='default', cfgfile='config'):
cfgdict=dict([item[0], list(item[1:])] for item in cfgstruct)
# get value from command
abbrevstring=''
verbose = []
for key in cfgdict:
if isinstance(cfgdict[key][1], bool):
verbose.append(key)
abbre... | lihuiba/SoftSAN | config.py | Python | apache-2.0 | 3,462 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.