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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
##############################################################################
#
# Gym
# Copyright (C) 2013 Sistemas ADHOC
# No email
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# publ... | ingadhoc/odoo-kinesis-classes | addons/gym_x/__init__.py | Python | agpl-3.0 | 1,044 |
#coding=utf-8
#author: sloop
'''
ÈÎÎñ
Çë´´½¨°üº¬Á½¸ö Person ÀàµÄʵÀýµÄ list£¬²¢¸øÁ½¸öʵÀýµÄ name ¸³Öµ£¬È»ºó°´ÕÕ name ½øÐÐÅÅÐò¡£
'''
class Person(object):
pass
p1 = Person()
p1.name = 'Bart'
p2 = Person()
p2.name = 'Adam'
p3 = Person()
p3.name = 'Lisa'
L1 = [p1, p2, p3]
L2 = sorted(L1,key=lambda x:x.name)
# L2 ... | GcsSloop/PythonNote | PythonCode/Python进阶/面向对象基础/创建实例属性.py | Python | apache-2.0 | 1,105 |
DEF = '''
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
typedef signed char khronos_int8_t;
typedef unsigned char khronos_uint8_t;
typedef signed sho... | cydenix/OpenGLCffi | OpenGLCffi/Defs/gldefs.py | Python | mit | 228,791 |
# Software License Agreement (BSD License)
#
# Copyright (c) 2008, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above... | tim36272/p2os-tim | src/p2os_dashboard/src/p2os_dashboard/power_state_control.py | Python | bsd-3-clause | 5,551 |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License,... | bcorbet/SickRage | sickbeard/dailysearcher.py | Python | gpl-3.0 | 3,750 |
"""Support for Z-Wave fans."""
import math
from homeassistant.components.fan import (
DOMAIN as FAN_DOMAIN,
SUPPORT_SET_SPEED,
FanEntity,
)
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.util.percentage import (
percentag... | turbokongen/home-assistant | homeassistant/components/ozw/fan.py | Python | apache-2.0 | 2,383 |
# pylint: disable=missing-docstring
from django.contrib.auth import get_user_model
from django.contrib.auth.models import AnonymousUser
from django.core.urlresolvers import reverse
from guardian.shortcuts import assign_perm
from rest_framework.test import APITestCase
from resolwe.flow.models import Process
class Pr... | jberci/resolwe | resolwe/flow/tests/test_ordering.py | Python | apache-2.0 | 1,377 |
# Eve W-Space
# Copyright 2014 Andrew Austin and contributors
#
# 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... | proycon/eve-wspace | evewspace/Alerts/method_registry.py | Python | apache-2.0 | 2,102 |
from threadedcomments import get_model
ThreadedComment = get_model()
| sinnwerkstatt/landmatrix | apps/public_comments/models.py | Python | agpl-3.0 | 70 |
#!/usr/bin/python3
vec = [2, 4, 6]
print([3 * x for x in vec])
print([[x, x*2] for x in vec])
print([3*x for x in vec if x > 3])
print([3*x for x in vec if x < 2])
freshfruit = [' banana', ' loganberry', 'passion fruit']
print([weapon.strip() for weapon in freshfruit])
vec1 = [2, 4, 6]
vec2 = [4, 3, -9]
print([x... | misizeji/python_study_notes | auto-list.py | Python | mit | 457 |
from zipfile import ZipFile
import tempfile
from os import path
_shp_exts = ["dbf","prj","shx"]
_shp_exts = _shp_exts + map(lambda s: s.upper(), _shp_exts)
def shp_files(fpath):
basename, ext = path.splitext(fpath)
paths = [ "%s.%s" % (basename,ext) for ext in _shp_exts ]
paths.append(fpath)
return fi... | michaelBenin/geonode | geonode/geoserver/uploader/utils.py | Python | gpl-3.0 | 603 |
# -*- coding: utf-8 -*-
import pandas as pd
from ..compat.numpy import DTYPE
from ._base import fetch_from_web_or_disk
__all__ = [
'load_gasoline'
]
url = 'http://alkaline-ml.com/datasets/gasoline.csv'
def load_gasoline(as_series=False, dtype=DTYPE):
"""Weekly US finished motor gasoline products
A we... | tgsmith61591/pyramid | pmdarima/datasets/gasoline.py | Python | mit | 2,009 |
# -*- coding: utf-8 -*-
# Copyright 2017 GIG Technology NV
#
# 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... | rogerthat-platform/rogerthat-backend | src/rogerthat/to/news.py | Python | apache-2.0 | 26,289 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
readme = open('README.rst').read()
history = open('HISTORY.rst').read().replace('.. :changelog:', '')
requirements = [
"boto",
]
test_requirements = [
]
setup(
name... | catlee/hashsync | setup.py | Python | bsd-3-clause | 1,386 |
"""
This program extracts data from RPM and SRPM packages and stores it in
a database for later querying.
based on the srpm script of similar function copyright (c) 2005 Stew Benedict <sbenedict@mandriva.com>
copyright (c) 2007-2017 Vincent Danen <vdanen@linsec.ca>
This file is part of rq.
rq is free software: you c... | vdanen/rq | rq/source.py | Python | gpl-3.0 | 34,593 |
import logging
import logging.config
import pytest
from path import Path
from qface.generator import FileSystem
import qface.idl.domain as domain
# logging.config.fileConfig('logging.ini')
logging.basicConfig()
log = logging.getLogger(__name__)
inputPath = Path('tests/in')
log.debug('input path folder: {0}'.format(... | Pelagicore/qface | tests/test_parser.py | Python | mit | 8,708 |
from .frontend import frontend
from .api import api
from .user import user
from .context import context
from .sweet import sweet
from .app import app
from .oauth import Oauth
| janastu/swtstore | swtstore/classes/views/__init__.py | Python | bsd-2-clause | 175 |
"""
Technical constraints for different families/kinds of subsystems.
From these classes many instances can be generated, with quantities
generated from given intervals.
Aerospace support from Giacomo Gatto
"""
__author__ = 'lorenzo'
tech_constrains = dict({
"communication" : {
"slug": "COM",
"ont... | pincopallino93/rdfendpoints | scripts/datagenerator/constraints.py | Python | apache-2.0 | 4,188 |
# -*- coding: utf-8 -*-
#
# SpeX Prism Library Analysis Toolkit documentation build configuration file, created by
# sphinx-quickstart on Sat Jul 11 20:07:28 2015.
#
##################
# you should compile this using the following command in the _build folder:
# sphinx-apidoc -f -o docs/source projectdir
#########... | aburgasser/splat | docs/conf.py | Python | mit | 10,003 |
from unittest.mock import Mock, patch
import pytest
from requests import Response
from backend.common.frc_api import FRCAPI
from backend.common.sitevars.fms_api_secrets import (
ContentType as FMSApiSecretsContentType,
)
from backend.common.sitevars.fms_api_secrets import FMSApiSecrets
from backend.tasks_io.dataf... | the-blue-alliance/the-blue-alliance | src/backend/tasks_io/datafeeds/tests/datafeed_fms_api_event_test.py | Python | mit | 2,672 |
import sublime
import re
import os
ALIAS_SETTING = "alias"
DEFAULT_INITIAL_SETTING = "default_initial"
USE_CURSOR_TEXT_SETTING = "use_cursor_text"
SHOW_FILES_SETTING = "show_files"
SHOW_PATH_SETTING = "show_path"
DEFAULT_ROOT_SETTING = "default_root"
DEFAULT_PATH_SETTING = "default_path"
DEFAULT_FOLDER_INDEX_SETTING =... | kerma/Sublime-AdvancedNewFile | advanced_new_file/anf_util.py | Python | mit | 6,553 |
'''
Created on Dec 13, 2010
@author: Henrik Rudstrom
`we evolve for two input bits. When a successful solution is found,
the fitness function requires that the program produces a two bit
circuit, followed by a three bit circuit. Then when a genotype has
been found that solves the two bit problem and on iteration so... | thanos/ecspy | examples/smcgp_parity_example.py | Python | gpl-3.0 | 7,951 |
#!/usr/bin/python3
# coding: utf-8
import os.path
import subprocess
import pytest
import pyregdict
# TODO: add cases expecting exception
def test_connexion():
pyregdict.Registry()
pyregdict.Registry(subkey='SOFTWARE')
pyregdict.Registry(subkey=r'HARDWARE\DESCRIPTION')
def test_access(request):
"... | CharlesAracil/pyregdict | test/test_pyregdict.py | Python | mit | 9,572 |
# 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... | Huyuwei/tvm | vta/tests/python/integration/test_benchmark_topi_conv2d.py | Python | apache-2.0 | 10,351 |
import _plotly_utils.basevalidators
class ShowscaleValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(
self, plotly_name="showscale", parent_name="scatterternary.marker", **kwargs
):
super(ShowscaleValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/scatterternary/marker/_showscale.py | Python | mit | 476 |
#!/usr/bin/env python
#
# Copyright (c) 2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should h... | cakofony/katello_notification | setup.py | Python | gpl-2.0 | 1,475 |
# #####
# This file is part of the RobotDesigner developed in the Neurorobotics
# subproject of the Human Brain Project (https://www.humanbrainproject.eu).
#
# The Human Brain Project is a European Commission funded project
# in the frame of the Horizon2020 FET Flagship plan.
# (http://ec.europa.eu/programmes/hori... | HBPNeurorobotics/BlenderRobotDesigner | robot_designer_plugin/export/collada15/__init__.py | Python | gpl-2.0 | 1,392 |
# Generated by Django 2.1.15 on 2020-12-10 21:17
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0040_page_draft_title'),
('wagtaildocs', '0008_document_file_size'),
('core', '0042_auto_201... | nfletton/bvspca | bvspca/core/migrations/0043_redirectpage.py | Python | mit | 1,328 |
def extractSleepyWitchcraftAcademy(item):
'''
Parser for 'sleepy.witchcraft.academy'
'''
badwords = [
'Manga',
'badword',
]
if any([bad in item['tags'] for bad in badwords]):
return None
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in i... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractSleepyWitchcraftAcademy.py | Python | bsd-3-clause | 673 |
"""Support for Danfoss Air HRV."""
from datetime import timedelta
import logging
from pydanfossair.commands import ReadCommand
from pydanfossair.danfossclient import DanfossClient
import voluptuous as vol
from homeassistant.const import CONF_HOST, Platform
from homeassistant.core import HomeAssistant
from homeassista... | rohitranjan1991/home-assistant | homeassistant/components/danfoss_air/__init__.py | Python | mit | 3,534 |
#!/usr/bin/env python
'''
Copyright (C) 2005 Carsten Goetze c.goetze@tu-bs.de
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.
... | danieljabailey/inkscape_experiments | share/extensions/fractalize.py | Python | gpl-2.0 | 3,762 |
"""
This module contains signals needed for email integration
"""
import datetime
import logging
from random import randint
from typing import Any, Dict, Optional, Tuple
import crum
from celery.exceptions import TimeoutError as CeleryTimeoutError
from django.conf import settings
from django.dispatch import receiver
... | eduNEXT/edunext-platform | lms/djangoapps/email_marketing/signals.py | Python | agpl-3.0 | 11,786 |
"""
Helpers for working with DC/OS E2E clusters.
"""
import logging
from datetime import datetime
from pathlib import Path
from subprocess import CalledProcessError
from typing import List
from _pytest.fixtures import SubRequest
from dcos_e2e.cluster import Cluster
from dcos_e2e.exceptions import DCOSTimeoutError
fr... | GoelDeepak/dcos | test-e2e/cluster_helpers.py | Python | apache-2.0 | 5,064 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants_test.cont... | manasapte/pants | contrib/python/tests/python/pants_test/contrib/python/checks/tasks/checkstyle/test_new_style_classes.py | Python | apache-2.0 | 1,026 |
from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
# Examples:
url(r'^upload/$', 'easy_avatar.views.upload'),
) | chawk/django-easy-avatar | easy_avatar/urls.py | Python | mit | 148 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) Rooms For (Hong Kong) Limited T/A OSCG (<http://www.openerp-asia.net>).
#
# This program is free software: you can redistribute it and/or modify
# ... | yostashiro/awo-custom | account_anglo_saxon_fix/__init__.py | Python | lgpl-3.0 | 1,026 |
from __main__ import vtk, qt, ctk, slicer
#
# LengthStat
#
class FiberLengthCleaning:
def __init__(self, parent):
parent.title = "Fiber Length Cleaning"
parent.categories = ["Diffusion"]
parent.contributors = ["Jean-Baptiste Berger and Martin Styner"]
self.parent = paren... | NIRALUser/FiberViewerLight | FiberLengthCleaning.py | Python | apache-2.0 | 11,548 |
#!/usr/bin/env python
from __future__ import absolute_import
import os
os.putenv('OCIO', colorconfig_file)
command += pythonbin + " src/test_colorconfig.py > out.txt"
| OpenImageIO/oiio | testsuite/python-colorconfig/run.py | Python | bsd-3-clause | 171 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
csvexport.shortcuts
-------------------------
Contains django view shortcuts
"""
from django.http import HttpResponse
def render_to_csv(exporter, filename=None):
"""
Helper that generates a downloadable csv based on exporter,
similar to django.shortcuts.... | marteinn/django-csvexport | csvexport/shortcuts.py | Python | mit | 1,161 |
import _plotly_utils.basevalidators
class TexttemplateValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(self, plotly_name="texttemplate", parent_name="scatter3d", **kwargs):
super(TexttemplateValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent... | plotly/python-api | packages/python/plotly/plotly/validators/scatter3d/_texttemplate.py | Python | mit | 509 |
# -*- coding: utf-8 -*-
import uuid
from django.db import models, IntegrityError
from django.utils.translation import ugettext_lazy as _
from orgs.mixins.models import OrgModelMixin
__all__ = ['UserGroup']
class UserGroup(OrgModelMixin):
id = models.UUIDField(default=uuid.uuid4, primary_key=True)
name = mo... | eli261/jumpserver | apps/users/models/group.py | Python | gpl-2.0 | 1,698 |
"""Request to the Gatherer site"""
import re
from collections import Iterable
from mtglib.constants import base_url, TYPES, SPECIAL_TYPES, VALID_WORDS, COLOR_PROPER_NAMES
from mtglib.functions import is_string
__all__ = ['SearchRequest', 'CardRequest']
# linearize nested lists
def flatten(l):
for el in l:
... | chigby/mtg | mtglib/gatherer_request.py | Python | mit | 9,477 |
# This module provides a base class for maintaining a single replicated
# value via multi-paxos. The responsibilities of this class are:
#
# * Loading and saving the state to/from disk
# * Maintaining the integrity of the multi-paxos chain
# * Bridging the composable_paxos.PaxosInstance object for the current ... | GianlucaBortoli/krafters | paxos/replicated_value.py | Python | mit | 8,133 |
# -*- coding: utf-8 -*-
from __future__ import with_statement
from cms.admin import forms
from cms.admin.forms import PageUserForm
from cms.api import create_page, create_page_user
from cms.forms.fields import PageSelectFormField, SuperLazyIterator
from cms.forms.utils import (get_site_choices, get_page_choices,
u... | vipins/ccccms | env/Lib/site-packages/cms/tests/forms.py | Python | bsd-3-clause | 5,967 |
"""
This module handles initial database propagation, which is only run the first
time the game starts. It will create some default channels, objects, and
other things.
Everything starts at handle_setup()
"""
import django
from django.conf import settings
from django.contrib.auth import get_user_model
from src.server... | google-code-export/evennia | src/server/initial_setup.py | Python | bsd-3-clause | 11,444 |
# Copyright 2017 gRPC authors.
#
# 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... | firebase/grpc | src/python/grpcio_testing/grpc_testing/_server/_service.py | Python | apache-2.0 | 2,859 |
"""
Tree Bayesian Networks: a probability distribution factored according to a tree
whose structure is learned using the Chow-Liu algorithm
Chow, C. K. and Liu, C. N. (1968), Approximating discrete probability distributions
with dependence trees, IEEE Transactions on Information Theory IT-14 (3): 462-467.
"""
imp... | nicoladimauro/dcsn | cltree.py | Python | gpl-2.0 | 18,443 |
'''tests for the lima module (without submodules)'''
import pytest
import lima
def test_namespace_pollution():
'''Test if all shortcuts are present in package.'''
from lima.schema import Schema as _Schema
assert hasattr(lima, 'exc')
assert hasattr(lima, 'fields')
assert hasattr(lima, 'schema')
... | b6d/lima | test/test_lima.py | Python | mit | 354 |
#!/usr/bin/env python3
import argparse
import os
import shutil
import signal
import sys
from razer_daemon.daemon import daemonize
from subprocess import check_output
from time import sleep
# Basically copied from https://github.com/jleclanche/python-xdg/blob/master/xdg/basedir.py
HOME = os.path.expanduser("~")
XDG_D... | z3ntu/razer-drivers | daemon/run_razer_daemon.py | Python | gpl-2.0 | 3,448 |
# -*- coding: utf-8 -*-
# Open Source Initiative OSI - The MIT License (MIT):Licensing
#
# The MIT License (MIT)
# Copyright (c) 2015 François-Xavier Bourlet (bombela+zerorpc@gmail.com)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files... | strawerry/zerorpc-python | zerorpc/events.py | Python | mit | 10,118 |
import sys
from graphene.commands.command import Command
from graphene.expressions.match_node import MatchNode
from graphene.query.planner import QueryPlanner
class DeleteNodeCommand(Command):
"""
Used to delete individual nodes from the database.
"""
def __init__(self, data):
self.node_type =... | PHB-CS123/graphene | graphene/commands/delete_node_command.py | Python | apache-2.0 | 777 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-12-19 16:36
from __future__ import unicode_literals
from django.db import migrations, models
import timezone_field.fields
import userprofile.models
class Migration(migrations.Migration):
dependencies = [
('userprofile', '0001_initial'),
]
... | geminateCoder/Gemini-Project | rp_grounds/userprofile/migrations/0002_auto_20161219_1136.py | Python | gpl-3.0 | 942 |
from tornado import websocket, web, ioloop, autoreload
import json
import sys
new_msg=''
old_msg=''
def send_response():
print 'msg'
if new_msg<>old_msg:
print new_msg
class SocketHandler(websocket.WebSocketHandler):
''' websocket handler '''
def open(self):
''' ran once an open ws co... | mehmoodz/Influenzr | publishers/resources/simple_ws.py | Python | mit | 818 |
# -*- coding: utf-8 -*-
# * Authors:
# * TJEBBES Gaston <g.t@majerti.fr>
# * Arezki Feth <f.a@majerti.fr>;
# * Miotte Julien <j.m@majerti.fr>;
def test_treasury_measure_type():
from autonomie.models.accounting.treasury_measures import TreasuryMeasureType
type_ = TreasuryMeasureType(label=u"T... | CroissanceCommune/autonomie | autonomie/tests/models/accounting/test_treasury_measures.py | Python | gpl-3.0 | 745 |
class MPModule(object):
'''
The base class for all modules
'''
def __init__(self, mpstate, name, description=None, public=False):
'''
Constructor
if public is true other modules can find this module instance with module('name')
'''
self.mpstate = mpstate
... | bugobliterator/MAVProxy | MAVProxy/modules/lib/mp_module.py | Python | gpl-3.0 | 2,684 |
#!usr/bin/env python3.7
#-*-coding:utf-8-*-
## TtgcBot - a bot for discord
## Copyright (C) 2017 Thomas PIOT
##
## 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... | ttgc/TtgcBot | src/utils/DatabaseManager.py | Python | gpl-3.0 | 2,067 |
'''
Test cases for pyclbr.py
Nick Mathewson
'''
from test.test_support import run_unittest
import unittest, sys
from types import ClassType, FunctionType, MethodType, BuiltinFunctionType
import pyclbr
from unittest import TestCase
StaticMethodType = type(staticmethod(lambda: None))
ClassMethodType = type(classme... | xbmc/atv2 | xbmc/lib/libPython/Python/Lib/test/test_pyclbr.py | Python | gpl-2.0 | 7,102 |
import numpy as np
import matplotlib.pyplot as plt
data1 = np.loadtxt("threebody_euler.dat")
data2 = np.loadtxt("threebody_verlet.dat")
euler_earth = data1[0::3]
euler_sun = data1[1::3]
euler_jupiter = data1[2::3]
verlet_earth = data2[0::3]
verlet_sun = data2[1::3]
verlet_jupiter = data2[2::3]
fig = ... | linegpe/FYS3150 | build-solar-system-fys3150-Desktop-Release/plot_methods.py | Python | gpl-3.0 | 1,392 |
# -*- coding:utf-8 -*-
# Copyright (c) 2010-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 ... | mjwtom/swift | test/unit/obj/test_diskfile.py | Python | apache-2.0 | 221,579 |
from __future__ import unicode_literals
import os
import sys
from optparse import make_option
from django.core.files.storage import FileSystemStorage
from django.core.management.base import CommandError, NoArgsCommand
from django.utils.encoding import smart_text
from django.utils.datastructures import SortedDict
from... | edisonlz/fruit | web_project/base/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py | Python | apache-2.0 | 13,001 |
from django.contrib.admin import ModelAdmin, site
class NodeOptions(ModelAdmin):
list_display = ['user', 'host', 'enabled', 'outbound', 'image_sharing', 'foreign_username']
def share_images(self, request, queryset):
try:
queryset.update(image_sharing=True)
self.message_user(req... | CMPUT404/socialdistribution | api/admin/node.py | Python | apache-2.0 | 910 |
import matplotlib.pyplot as plt
import numpy.random as ran
import matplotlib.animation as animation
from multiprocessing import Process
import numpy as np
__all__ = ['SortAnalyzer', 'SortingAlgorithm']
class SortingAlgorithm:
"""
Base class for all sorting algorithms
Increment the number of basic co... | OpenWeavers/openanalysis | openanalysis/sorting.py | Python | gpl-3.0 | 7,422 |
from flask import Flask, request, url_for, redirect
import sqlite3
dbFile = 'task.db'
conn = None
def get_conn():
global conn
if conn is None:
conn = sqlite3.connect(dbFile)
conn.row_factory = sqlite3.Row
return conn
def close_connection():
global conn
if conn is not None:
... | rooshilp/CMPUT410Lab4 | exercises/todo.py | Python | apache-2.0 | 1,593 |
"""Proxy tunnel for use through urllib http tunnel. (extends str)
"""
import re
from urllib.request import build_opener, ProxyHandler
import socks
from sockshandler import SocksiPyHandler
from ui.color import colorize
class Proxy(str):
"""Proxy tunnel for use through urllib http tunnel. (extends str)
Takes... | nil0x42/phpsploit | src/datatypes/Proxy.py | Python | gpl-3.0 | 2,808 |
# -*- coding: utf-8 -*-
class Parser(object):
_json_data = None
@property
def json_data(self):
return self._json_data
@json_data.setter
def json_data(self, value):
self._json_data = value
| arcticio/ice-bloc-hdr | utils/external/geolocation/parser.py | Python | mit | 228 |
class Solution:
# @param {integer[]} nums
# @return {string}
def largestNumber(self, nums):
strnums=[]
for num in nums:
strnums.append(str(num))
# sorted as string
strnums.sort(lambda x,y:int(y+x)-int(x+y))
res=''.join(strnums)
# ... | Tanych/CodeTracking | 179-Largest-Number/solution.py | Python | mit | 436 |
import requests
from bs4 import BeautifulSoup
import sys
import os
import pandas
import re
targetURL = "http://www.ubcpress.ca/search/subject_list.asp?SubjID=45"
bookLinks = "http://www.ubcpress.ca/search/"
outputDir = "UBC_Output"
def main():
r = requests.get(targetURL)
soup = BeautifulSoup(r.content, "ht... | reidmcy/pressScrapers | ubcScraper.py | Python | gpl-2.0 | 2,909 |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def levelOrderBottom(self, root):
"""
:type root: TreeNode
:rtype: List[List[int]]
"""
... | Tanych/CodeTracking | 107-Binary-Tree-Level-Order-Traversal-II/solution.py | Python | mit | 722 |
#! /usr/bin/env python
import sys
import os.path
import pybindgen.settings
from pybindgen.gccxmlparser import ModuleParser, PygenClassifier, PygenSection, WrapperWarning
from pybindgen.typehandlers.codesink import FileCodeSink
from pygccxml.declarations import templates
from pygccxml.declarations.class_declaration im... | dgomezunican/network-coding-ns3 | ns-3.13/bindings/python/ns3modulescan.py | Python | gpl-2.0 | 13,937 |
# Bishop inference
from Bishop import *
Observer = LoadObserver("Tatik_T1_L1")
# When Feedback is True function prints percentage complete
Res = Observer.InferAgent(
ActionSequence=['R', 'R'], Samples=500, Feedback=True)
Res.Summary()
| julianje/Bishop | build/lib/Bishop/Examples/SimpleInference.py | Python | mit | 241 |
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/platypus/paraparser.py
__version__=''' $Id$ '''
__doc__='''The parser used to process markup within paragraphs'''
import string
import re
from t... | olivierdalang/stdm | third_party/reportlab/platypus/paraparser.py | Python | gpl-2.0 | 44,921 |
import unittest
from decimal import Decimal
import os
import blivet
from blivet import devicefactory
from blivet.devicelibs import raid
from blivet.devices import DiskDevice
from blivet.devices import DiskFile
from blivet.devices import LUKSDevice
from blivet.devices import LVMLogicalVolumeDevice
from blivet.devices... | vpodzime/blivet | tests/devicefactory_test.py | Python | lgpl-2.1 | 22,392 |
"""
Django settings for runnerreads project.
Generated by 'django-admin startproject' using Django 1.11.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
impor... | mguarascio/runnerreads-com | runnerreads/settings.py | Python | mit | 4,189 |
#
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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
#
# Unle... | citrix-openstack-build/heat-cfntools | heat_cfntools/tests/test_cfn_helper.py | Python | apache-2.0 | 48,427 |
from abapy.indentation import DeformableCone2D
from matplotlib import pyplot as plt
c = DeformableCone2D(Na =8, Nb = 8, Ns = 1)
f = open('DeformableCone2D.inp', 'w')
f.write(c.dump2inp())
f.close()
x,y,z = c.mesh.get_edges()
plt.plot(x,y)
plt.gca().set_aspect('equal')
plt.show()
| lcharleux/abapy | doc/example_code/indentation/DeformableCone2D.py | Python | gpl-2.0 | 281 |
from muntjac.api import VerticalLayout, ListSelect
from muntjac.data.property import IValueChangeListener
class ListSelectMultipleExample(VerticalLayout, IValueChangeListener):
_cities = ['Berlin', 'Brussels', 'Helsinki', 'Madrid', 'Oslo',
'Paris', 'Stockholm']
def __init__(self):
super... | rwl/muntjac | muntjac/demo/sampler/features/selects/ListSelectMultipleExample.py | Python | apache-2.0 | 915 |
# -*- coding: utf-8 -*-
__author__ = """Hervé Beraud"""
__email__ = 'herveberaud.pro@gmail.com'
__version__ = '0.1.0'
| 4383/rogue | rogue/__init__.py | Python | mit | 120 |
# -*- coding: UTF-8 -*-
# **********************************************************************************#
# File:
# **********************************************************************************#
from pymongo import MongoClient, UpdateOne
client = MongoClient('localhost', 27017)
database = client['iqiyi'... | myron0330/caching-research | iqiyi/mongo_base.py | Python | mit | 1,344 |
from threading import *
import copy
class Future:
def __init__(self,func,*param):
# Constructor
self.__done=0
self.__result=None
self.__status='working'
self.__C=Condition() # Notify on this Condition when result is ready
# Run the actual function in a separate ... | paulopontesm/METI_EADW-libra | libra/politics/management/commands/utils/future.py | Python | gpl-2.0 | 1,180 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Cloudbase Solutions Srl
# 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.ap... | TieWei/nova | nova/virt/hyperv/hostops.py | Python | apache-2.0 | 6,186 |
from rest_framework_json_schema.transforms import (
CamelCaseTransform,
CamelCaseToUnderscoreTransform,
)
def test_camel_case_transform() -> None:
tx = CamelCaseTransform()
assert tx.transform("one") == "one"
assert tx.transform("one_two_three") == "oneTwoThree"
def test_camel_case_to_underscor... | paulcwatts/drf-json-schema | tests/test_transforms.py | Python | mit | 484 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
from superde... | sivakuna-aap/superdesk-core | superdesk/publish/transmitters/email.py | Python | agpl-3.0 | 1,688 |
import optunity
import numpy as np
import hpolib_generator as hpo
import cloudpickle as pickle
from sklearn.datasets import load_digits
positive_digit = 1
name='digits-%d' % positive_digit
num_folds=5
budget = 150
search={'logC': [-8, 1], 'logGamma': [-8, 1]}
digits = load_digits()
n = digits.data.shape[0]
positiv... | claesenm/optunity-benchmark | benchmarks/optunity/digits-1.py | Python | gpl-3.0 | 851 |
# Patchwork - automated patch tracking system
# Copyright (C) 2008 Jeremy Kerr <jk@ozlabs.org>
# Copyright (C) 2015 Intel Corporation
#
# This file is part of the Patchwork package.
#
# Patchwork is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published ... | ivyl/patchwork | patchwork/models.py | Python | gpl-2.0 | 33,987 |
from microcosm_flask.conventions.crud_adapter import CRUDStoreAdapter
class EncryptableCRUDStoreAdapter(CRUDStoreAdapter):
"""
Adapt the CRUD conventions callbacks to the `EncryptableStore` interface.
"""
def update_and_reencrypt(self, **kwargs):
"""
Support re-encryption by enforcin... | globality-corp/microcosm-flask | microcosm_flask/encryption/conventions/crud_adapter.py | Python | apache-2.0 | 1,330 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_python_image_object_detection
----------------------------------
Tests for `python_image_object_detection` module.
"""
import pytest
from python_image_object_detection import python_image_object_detection
class TestPython_image_object_detection(object):
... | shanedevane/python-image-object-detection | tests/test_python_image_object_detection.py | Python | mit | 478 |
#!/usr/bin/env python3
# Copyright (c) 2014-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Base class for RPC testing."""
import configparser
from enum import Enum
import logging
import argpars... | vmp32k/litecoin | test/functional/test_framework/test_framework.py | Python | mit | 22,844 |
#!/usr/bin/python3
# vim:fileencoding=utf-8:sw=4:et
from __future__ import print_function, unicode_literals, absolute_import
import sys
import os
import io
import logging as log
NATIVE=sys.getfilesystemencoding()
from gi.repository import GObject, Liferea
def liferea_symbols():
"""Print out symbols exported by `... | mozbugbox/liferea-plugin-studio | blocklink-addon/utils.py | Python | gpl-3.0 | 1,729 |
from registration.forms import RegistrationForm
from sanitizer.forms import SanitizedCharField
from django import forms, apps
from django.conf import settings
from django.core.validators import validate_email
from django.forms.widgets import PasswordInput, Textarea, TextInput
from django.utils.translation import ... | numbas/editor | accounts/forms.py | Python | apache-2.0 | 8,897 |
from unittest import TestCase
from scrapy.spider import BaseSpider
from scrapy.http import Request
from scrapy.contrib.downloadermiddleware.useragent import UserAgentMiddleware
from scrapy.utils.test import get_crawler
class UserAgentMiddlewareTest(TestCase):
def get_spider_and_mw(self, default_useragent):
... | rahul-c1/scrapy | scrapy/tests/test_downloadermiddleware_useragent.py | Python | bsd-3-clause | 2,232 |
#
# Copyright (c) 2021 Arm Limited and Contributors. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
"""Implements reset method for the ARM_MPS2 platform."""
import os
import time
from .host_test_plugins import HostTestPluginBase
# Note: This plugin is not fully functional, needs improvements
class Ho... | ARMmbed/greentea | src/htrun/host_tests_plugins/module_reset_mps2.py | Python | apache-2.0 | 2,821 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
RectangleMapTool.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**********************... | pblottiere/QGIS | python/plugins/processing/gui/RectangleMapTool.py | Python | gpl-2.0 | 3,872 |
# This file is part of Indico.
# Copyright (C) 2002 - 2019 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import logging.config
from alembic import context
from flask import current_app
from flask_pluginengine i... | mvidalgarcia/indico | indico/core/plugins/alembic/env.py | Python | mit | 3,235 |
from setuptools import setup, find_packages
DESCRIPTION = "Djangotoolbox for Django-nonrel"
LONG_DESCRIPTION = None
try:
LONG_DESCRIPTION = open('README.rst').read()
except:
pass
CLASSIFIERS = [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Operating System :: OS Independe... | adamjmcgrath/glancydesign | src/djangotoolbox/setup.py | Python | bsd-3-clause | 947 |
from django.contrib.auth.forms import UserChangeForm
from django import forms
from django.utils.translation import ugettext_lazy as _
| villager10086/PythonDaily | awesome/account/forms.py | Python | lgpl-3.0 | 138 |
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Australian Government, Department of the Environment
#
# 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... | lpinner/metageta | metageta/overviews.py | Python | mit | 36,431 |
# encoding: UTF-8
structDict = {}
#//////////////////////////////////////////////////////////////////////
#@system QuantDo Platform
#@company 上海量投网络科技有限公司
#@file QdpFtdcUserApiStruct.h
#@brief 定义了客户端接口使用的业务数据结构
#@history
#//////////////////////////////////////////////////////////////////////
#系统用户登录请求
CQdp... | harveywwu/vnpy | vnpy/api/qdp/pyscript/qdp_struct.py | Python | mit | 61,297 |
#----------------------------------------------------------------------
# Name: wx.lib.pdfwin
# Purpose: A class that allows the use of the Acrobat PDF reader
# ActiveX control
#
# Author: Robin Dunn
#
# Created: 22-March-2004
# RCS-ID: $Id: pdfwin.py 64237 2010-05-06 18:25:24Z RD ... | ezequielpereira/Time-Line | libs64/wx/lib/pdfwin.py | Python | gpl-3.0 | 11,394 |
from setuptools import setup, find_packages
setup(
name="west-cli",
version="0.1",
description="",
long_description="""\
""",
classifiers=[],
keywords="",
author="Florent",
author_email="florent@toopy.org",
url="http://www.toopy.org",
license="MIT",
packages=find_packages(ex... | toopy/west-cli | setup.py | Python | mit | 611 |
del a[b]
del x
del a.b
| github/codeql | python/ql/test/library-tests/stmts/general/subexpr_test.py | Python | mit | 24 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.