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.contrib.auth.models import User, Group
from rest_framework import serializers
from usersystem import settings
class GroupSerializer(serializers.ModelSerializer):
class Meta:
model = Group
fields = ('name', )
class UserSerializer(serializers.ModelSerializer):
groups = GroupSeria... | si3792/icough | server/project/usersystem/serializers.py | Python | gpl-3.0 | 1,163 |
"""Example views. Feel free to delete this app."""
from django import http
import jingo
def home(request):
data = {}
return jingo.render(request, 'examples/home.html', data)
| haoqili/MozSecWorld | apps/examples/views.py | Python | bsd-3-clause | 186 |
import os
print "Hello World!"
| ywl19891989/TestGit | hello.py | Python | mit | 32 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pygments import lexers
def make_default_c_lexer():
c_lexer = lexers.get_lexer_by_name('c')
def get_c_lexer(*args, **kwargs):
return c_lexer
lexers.guess_lexer = get_c_lexer
| mpanczyk/pp_course | bin/configure_highlighter.py | Python | lgpl-3.0 | 236 |
#!/usr/bin/env python
import collections
import sys
import re
def tokenize(stream):
Token = collections.namedtuple('Token', ['typ', 'value', 'line', 'column'])
tokenSpec = [
('REAL', r'[-]?(?=\d*[.eE])(?=\.?\d)\d*\.?\d*(?:[eE][+-]?\d+)?'),
('INTEGER', r'[-]?[0-9]+'),
... | stumped2/school | CS480/milestone3/myreglexer.py | Python | apache-2.0 | 2,134 |
# Strategy Guide - Basic bot by ramk13
import rg
class Robot:
def act(self, game):
all_locs = {(x, y) for x in xrange(19) for y in xrange(19)}
spawn = {loc for loc in all_locs if 'spawn' in rg.loc_types(loc)}
obstacle = {loc for loc in all_locs if 'obstacle' in rg.loc_types(loc)}
... | ramk13/robotgame | strategy_guide/strategy-basic.py | Python | unlicense | 1,597 |
#!/usr/bin/python
import json
import logging
from core.alive import alive
from core.emailx import Emailx
from core.twitterc import TwitterC
from core.voicerecognition import VoiceRecognition
class VoiceExperimental(object):
def __init__(self, voicesynthetizer):
self.modulename = 'VoiceExperimental'
... | xe1gyq/nuupxe | modules/voiceexperimental.py | Python | apache-2.0 | 1,617 |
# -*- coding: utf-8 -*-
import pytest
from tests.base import Author, Post, Comment, fake
def make_author():
return Author(id=fake.random_int(), first_name=fake.first_name(),
last_name=fake.last_name(), twitter=fake.domain_word())
def make_post(with_comments=True, with_author=True):
comments... | akira-dev/marshmallow-jsonapi | tests/conftest.py | Python | mit | 1,225 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('deals', '0015_auto_20151223_1725'),
]
operations = [
migrations.AlterField(
model_name='deal',
name=... | HelloLily/hellolily | lily/deals/migrations/0016_auto_20160119_1354.py | Python | agpl-3.0 | 1,316 |
#!/usr/bin/env python
#
# Copyright 2007 Google LLC
#
# 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... | GoogleCloudPlatform/appengine-python-standard | src/google/appengine/ext/ndb/utils.py | Python | apache-2.0 | 5,606 |
'''CatalogIntegration management command'''
from django.core.management import BaseCommand, CommandError
from openedx.core.djangoapps.catalog.models import CatalogIntegration
class Command(BaseCommand):
"""Management command used to create catalog integrations."""
help = "Create catalog integration record i... | edx/edx-platform | openedx/core/djangoapps/catalog/management/commands/create_catalog_integrations.py | Python | agpl-3.0 | 2,698 |
from django.shortcuts import render
from django.http import HttpResponse
from symptom_tracker.models import SymptomEntry, Symptom
def index(request):
symptoms = SymptomEntry.objects.all()
data = {}
data['symptoms'] = symptoms
return render(request, 'index.html', data)
def add_symptom_entry(request)... | sbelskie/symplicity | symptom_tracker/views.py | Python | apache-2.0 | 1,023 |
'''
Created on 21 kwi 2013
@author: jurek
'''
from hra_core.special import ImportErrorMessage
try:
from PyQt4.QtGui import * # @UnusedWildImport
from PyQt4.QtCore import * # @UnusedWildImport
from hra_gui.qt.utils.keys import delete_key
from hra_gui.qt.utils.keys import movement_key
from hra_gui.... | TEAM-HRA/hra_suite | HRAGUI/src/hra_gui/qt/widgets/number_edit_widget.py | Python | lgpl-3.0 | 1,240 |
import numpy as np
from classifip.representations.credalset import CredalSet
from math import fabs
class BelFun(CredalSet):
"""Class of belief functions, described by their mass assignment.
:param mass: a 1 x m array containing focal sets weight
:type mass: :class:`~numpy.array`
:param nbD... | sdestercke/classifip | classifip/representations/belfun.py | Python | gpl-2.0 | 5,537 |
"""Base models
Revision ID: 734b944fd3a7
Revises:
Create Date: 2016-08-15 23:43:35.411885
"""
# revision identifiers, used by Alembic.
revision = '734b944fd3a7'
down_revision = None
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generate... | beslave/auto-collector | migrations/versions/734b944fd3a7_base_models.py | Python | mit | 6,579 |
#!/usr/bin/python
#-*- coding: utf-8 -*-
# This script has to import an existing *.tcx file
# into the sqlite database
#
# Requirements (import from):
# - sqlite3
# - xml
#
# Requirements:
# - sqlite database have already been generated using generate_db.py
#
# Syntax:
# ./import_tcx.py <*.pyx file>
from _... | dubzzz/py-run-tracking | www/scripts/import_tcx.py | Python | mit | 6,361 |
from .comics import Comics
__red_end_user_data_statement__ = (
"This cog does not persistently store data or metadata about users."
)
def setup(bot):
bot.add_cog(Comics(bot))
| flapjax/FlapJack-Cogs | comics/__init__.py | Python | mit | 186 |
# Copyright 2012 OpenStack Foundation
# 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 requ... | HybridF5/tempest_debug | tempest/services/volume/v1/json/volumes_client.py | Python | apache-2.0 | 818 |
#! /usr/bin/env python
import rospy
import sys
from time import sleep
import actionlib
import yaml
from random import randint
#from threading import Timer
import strands_tweets.msg
import image_branding.msg
from std_msgs.msg import String
from sensor_msgs.msg import Image
#from cv_bridge import CvBridge, CvBridge... | hawesie/strands_social | card_image_tweet/scripts/tweet_card.py | Python | mit | 2,961 |
size(500, 500)
# Draw a grid of grids.
# Use corner transformations to rotate objects from the top-left corner,
# instead of from the center of an object (which is the default).
transform(CORNER)
font('Gill Sans', 72)
for i in range(600):
# At the beginning of the loop, push the current transformation.
# Thi... | karstenw/nodebox-pyobjc | examples/Text/GridGrid.py | Python | mit | 790 |
# -*- coding: utf-8 -*-
"""
Organization Registry - Controllers
"""
module = request.controller
resourcename = request.function
if not settings.has_module(module):
raise HTTP(404, body="Module disabled: %s" % module)
# -----------------------------------------------------------------------------
def index(... | code-for-india/sahana_shelter_worldbank | controllers/org.py | Python | mit | 10,621 |
import json
from django.core.paginator import Paginator
from django.core.urlresolvers import reverse
from django.http import HttpResponse
from django.views.generic import View
from .models import Data
class FormApi(View):
def post(self, request, **kwargs):
request_data = json.loads(request.body.decode())
... | jonashagstedt/django-jsx | demo/demo/api.py | Python | bsd-3-clause | 1,502 |
#!/usr/bin/env python
import sys, cPickle
import gtk
import gnome
import gnome.ui
import gtk.gdk
import gobject
import xml.dom.minidom
from xml.dom.ext import PrettyPrint
from gettext import gettext as _
import notemeister
class NoteTree(gtk.TreeView):
anote = None
noteList = []
def __init__(self, view):
gt... | robotii/notemeister | src/lib/NoteTree.py | Python | gpl-2.0 | 12,949 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2013 Acysos S.L. (http://acysos.com) All Rights Reserved.
# Ignacio Ibeas <ignacio@acysos.com>
# $Id$
#
# This program i... | BorgERP/borg-erp-6of3 | verticals/garage61/acy_mrp_procurement_virtual_stock/procurement.py | Python | agpl-3.0 | 4,154 |
"""Games, or Adversarial Search. (Chapters 6)
"""
from utils import *
import random
#______________________________________________________________________________
# Minimax Search
def minimax_decision(state, game):
"""Given a state in a game, calculate the best move by searching
forward all the way to the... | jogo279/trobo | opponents/corey_abshire/games.py | Python | bsd-2-clause | 10,110 |
"""
# b43 debugging library
#
# Copyright (C) 2008-2010 Michael Buesch <m@bues.ch>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3
# as published by the Free Software Foundation.
#
# This program is distributed in the hope t... | FabianKnapp/nexmon | buildtools/b43/debug/libb43.py | Python | gpl-3.0 | 19,793 |
#!/usr/bin/env python3
# Copyright (c) 2015-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test transaction signing using the signrawtransaction* RPCs."""
from test_framework.blocktools import ... | domob1812/bitcoin | test/functional/rpc_signrawtransaction.py | Python | mit | 16,836 |
#!/usr/bin/python
# Copyright (c) 2015, BROCADE COMMUNICATIONS SYSTEMS, 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:
# 1. Redistributions of source code must retain the above copyright n... | jebpublic/pybvc | samples/sampleopenflow/demos/demo23.py | Python | bsd-3-clause | 6,660 |
# Copyright 2018 - Nokia Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | openstack/vitrage | vitrage/api_handler/apis/operational.py | Python | apache-2.0 | 1,030 |
#! /usr/bin/env 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... | davivcgarcia/python-dcc-ufrj | Exercicios - Lista Paulo Roma/Lista 1/ex7.py | Python | gpl-3.0 | 1,463 |
"""
Integration tests for the stem.control.Controller class.
"""
import hashlib
import os
import shutil
import socket
import tempfile
import threading
import time
import unittest
import stem.connection
import stem.control
import stem.descriptor.reader
import stem.descriptor.router_status_entry
import stem.response.pr... | ver007/stem-1.4.1 | test/integ/control/controller.py | Python | lgpl-3.0 | 48,636 |
import factory
from core.models import HomePage, FeaturedSectionBlock
from functional_tests.factory import ContentTypeFactory
from functional_tests.factory.article_factory import ArticleFactory
from core.models import AffixImage
class HomePageFactory(factory.django.DjangoModelFactory):
class Meta:
model = ... | PARINetwork/pari | functional_tests/factory/home_page_factory.py | Python | bsd-3-clause | 2,073 |
"""
ISO 9660 (cdrom) file system parser.
Documents:
- Standard ECMA-119 (december 1987)
http://www.nondot.org/sabre/os/files/FileSystems/iso9660.pdf
Author: Victor Stinner
Creation: 11 july 2006
"""
from hachoir_parser import Parser
from hachoir_core.field import (FieldSet, ParserError,
UInt8, UInt32, UInt64, ... | kreatorkodi/repository.torrentbr | plugin.video.yatp/site-packages/hachoir_parser/file_system/iso9660.py | Python | gpl-2.0 | 4,954 |
# Django settings for project project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '... | fmierlo/django-default-settings | release/1.2/project/settings.py | Python | bsd-3-clause | 3,293 |
from __future__ import absolute_import
# Django settings for zulip project.
########################################################################
# Here's how settings for the Zulip project work:
#
# * settings.py contains non-site-specific and settings configuration
# for the Zulip Django app.
# * settings.py impor... | sup95/zulip | zproject/settings.py | Python | apache-2.0 | 39,590 |
# Parts of Code and idea by Homey
from Components.Sources.Source import Source
from Components.Network import iNetworkInfo
class About(Source):
def __init__(self, session):
Source.__init__(self)
self.session = session
def handleCommand(self, cmd):
self.result = False, "unknown command"
def command(self):
... | carlo0815/enigma2-plugins | webinterface/src/WebComponents/Sources/About.py | Python | gpl-2.0 | 969 |
# This file is part of Androguard.
#
# Copyright (c) 2012 Geoffroy Gueguen <geoffroy.gueguen@gmail.com>
# 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://... | CZ-NIC/thug | src/Analysis/androguard/decompiler/dad/writer.py | Python | gpl-2.0 | 25,574 |
#!/usr/bin/python
# Author: Jon Trulson <jtrulson@ics.com>
# Copyright (c) 2016 Intel Corporation.
#
# 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 l... | andreivasiliu2211/upm | examples/python/aeotecdw2e.py | Python | mit | 2,661 |
__author__ = 'pokey'
from trace import Trace
from dash import *
from abc import ABCMeta, abstractmethod
import algorithms as alg
import bisect
import copy
from itertools import ifilter
class Adaptation(object):
__metaclass__ = ABCMeta
def __init__(self, bitrates):
self.bitrates = copy.deepcopy(bitrat... | pokey909/dash_adaptation_simulator | adaptation.py | Python | gpl-2.0 | 11,778 |
# -*- encoding: utf-8 -*-
import ast
import inspect
class NameLower(ast.NodeVisitor):
def __init__(self, lowered_names):
self.lowered_names = lowered_names
def visit_FunctionDef(self, node):
code = '__globals = globals()\n'
code += '\n'.join("{0} = __globals['{0}']".format(name) for ... | xu6148152/Binea_Python_Project | PythonCookbook/meta/newlower.py | Python | mit | 1,116 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from mptt.models import MPTTModel, TreeForeignKey
from django.conf import settings
from django.contrib.auth.models import Group
from ast import literal_eval
import os
from upy.models import UpyModel
from upy.fields import NullTrueField... | 20tab/upy | upy/contrib/tree/models.py | Python | bsd-3-clause | 21,916 |
__author__ = 'charlotte'
| Godley/MuseParse | MuseParse/classes/__init__.py | Python | mit | 25 |
#!/usr/bin/env python
# encoding: utf-8
'''
Created by Brian Cherinka on 2016-04-29 01:15:33
Licensed under a 3-clause BSD license.
Revision History:
Initial Version: 2016-04-29 01:15:33 by Brian Cherinka
Last Modified On: 2016-04-29 01:15:33 by Brian
'''
from __future__ import print_function
from __future__... | sdss/marvin | python/marvin/web/controllers/images.py | Python | bsd-3-clause | 1,995 |
# Copyright 2013 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 l... | zhangg/trove | trove/tests/api/mgmt/instances_actions.py | Python | apache-2.0 | 7,801 |
# Copyright 2020 Tecnativa - Ernesto Tejeda
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import api, models
class IrModel(models.Model):
_inherit = "ir.model"
@api.model
def get_authorized_fields(self, model_name):
"""Hack this method to force some rma fields to be ... | OCA/rma | website_rma/models/ir_model.py | Python | agpl-3.0 | 836 |
# -*- coding: utf-8 -*-
# Lumina User Guide documentation build configuration file.
# All configuration values have a default; values that are commented out
# serve to show the default.
import os
import six
import string
import sys
import time
# If extensions (or modules to document with autodoc) are in another direc... | a-stjohn/lumina-docs | conf.py | Python | bsd-2-clause | 13,283 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-23 11:16
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('directorio', '0008_auto_20160219_1209'),
]
operations = [
migrations.AddFiel... | josemfc/directorio-iep | directorio/migrations/0009_auto_20160223_1216.py | Python | apache-2.0 | 620 |
# -*- coding: utf-8 -*-
"""
End-to-end tests for the Account Settings page.
"""
from unittest import skip
from nose.plugins.attrib import attr
from bok_choy.web_app_test import WebAppTest
from ...pages.lms.account_settings import AccountSettingsPage
from ...pages.lms.auto_auth import AutoAuthPage
from ...pages.lms.da... | analyseuc3m/ANALYSE-v1 | common/test/acceptance/tests/lms/test_account_settings.py | Python | agpl-3.0 | 17,430 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import glitter.assets.fields
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('glitter_assets', '0001_initial'),
('glitter', '0001_initial'),
]
... | developersociety/django-glitter | glitter/blocks/carousel/migrations/0001_initial.py | Python | bsd-3-clause | 3,688 |
class DynamicAction:
def __init__(self):
pass
def evaluate(self, rule_match):
pass
class Num(DynamicAction):
def __init__(self, index=0, integer=True, default=0):
self.index = index
self.integer = integer
self.default = default
self.change = 0
def evalu... | evfredericksen/pynacea | pynhost/pynhost/dynamic.py | Python | mit | 789 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2010 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... | silenceli/nova | nova/wsgi.py | Python | apache-2.0 | 19,138 |
# Copyright 2012 the Melange 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 wr... | rhyolight/nupic.son | tests/app/soc/modules/gci/views/helper/__init__.py | Python | apache-2.0 | 632 |
# a party site configuration file to be used in tests
SECRET_KEY = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
SERVER_NAME = 'example.com'
SESSION_COOKIE_SECURE = True
TESTING = True
SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://byceps_test:test@127.0.0.1/byc... | m-ober/byceps | config/test_party.py | Python | bsd-3-clause | 544 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Website.about_url'
db.alter_column(u'event_website', 'about_url', self.gf('django.db.mode... | Makerland/makethings.io | event/migrations/0003_auto__chg_field_website_about_url.py | Python | gpl-3.0 | 15,391 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.db.models import F
from sentry.utils.query import RangeQuerySetWrapperWithProgressBar
class Migration(DataMigration):
def forwards(self, or... | mvaled/sentry | src/sentry/south_migrations/0298_backfill_project_has_releases.py | Python | bsd-3-clause | 95,115 |
from django.core.mail import send_mass_mail
from django.db.models import Q
from django.http import HttpResponseBadRequest, HttpResponseNotAllowed
from django.shortcuts import render, redirect, get_object_or_404
from django.template import Context, Template
from django.views.decorators.http import require_POST
from acc... | pydata/symposion | symposion/reviews/views.py | Python | bsd-3-clause | 19,054 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('communities', '0010_auto_20150607_1148'),
]
operations = [
migrations.AlterModelOptions(
name='communitygrouprol... | nonZero/OpenCommunity | src/communities/migrations/0011_auto_20150615_1535.py | Python | bsd-3-clause | 458 |
""" Grades API v1 URLs. """
from django.conf import settings
from django.conf.urls import url
from lms.djangoapps.grades.api.v1 import views
from lms.djangoapps.grades.api.views import CourseGradingPolicy
app_name = 'lms.djangoapps.grades'
urlpatterns = [
url(
r'^courses/$',
views.CourseGradesVi... | teltek/edx-platform | lms/djangoapps/grades/api/v1/urls.py | Python | agpl-3.0 | 887 |
"""The Keenetic Client class."""
from __future__ import annotations
from collections.abc import Callable
from datetime import timedelta
import logging
from ndms2_client import Client, ConnectionException, Device, TelnetConnection
from ndms2_client.client import RouterInfo
from homeassistant.config_entries import Con... | mezz64/home-assistant | homeassistant/components/keenetic_ndms2/router.py | Python | apache-2.0 | 6,359 |
import rcommander.tool_utils as tu
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import rospy
import pypr2.tf_utils as tfu
import tf.transformations as tr
import move_base_msgs.msg as mm
import math
import pypr2.pr2_utils as p2u
import numpy as np
import smach
import actionlib
from tf_broadcast_server.srv import... | gt-ros-pkg/rcommander-pr2 | rcommander_pr2_gui/src/rcommander_pr2_gui/look_at_tool.py | Python | bsd-3-clause | 4,048 |
import sys
from PySide import QtGui
app = QtGui.QApplication(sys.argv)
win = QtGui.QWidget()
win.resize(320, 240)
win.setWindowTitle("Hello, World!")
win.show()
sys.exit(app.exec_())
| gavrie/pycourse3 | examples/pyside/hello.py | Python | mit | 187 |
#!/usr/bin/env python
#
# CI runs this script to verify that options appearing in ZTools' ggo.in files also appear in their .ronn files.
# It does not check that `make manpages` has actually been run.
#
# This script assumes it's being run from the root of the zmap repository.
#
import sys
checks = [
("zopt.ggo.i... | shakenetwork/zmap | scripts/check_manfile.py | Python | apache-2.0 | 987 |
import numpy as np
import math
def install(a):
""" Styblinski-Tang function
http://en.wikipedia.org/wiki/Test_functions_for_optimization
f(x1,x2,...xi) = sum((xi^4 - 16*xi^2 + 5*xi) / 2 )
Input parameters: x - A numpy array of real values
Output : One real value
Suggested limits: -5 <= x... | Robbie025/ComplexMethod | complexRF/src/testfunctions/objfunc3.py | Python | lgpl-3.0 | 927 |
import logging
from ...engines.light import SimEngineLight
from ...errors import SimEngineError
l = logging.getLogger(name=__name__)
class SimEnginePropagatorBase(SimEngineLight): # pylint:disable=abstract-method
def __init__(self, stack_pointer_tracker=None, project=None):
super().__init__()
... | iamahuman/angr | angr/analyses/propagator/engine_base.py | Python | bsd-2-clause | 1,026 |
# -*- coding: utf-8 -*-
"""
|oauth1| Providers
--------------------
Providers which implement the |oauth1|_ protocol.
.. autosummary::
OAuth1
Bitbucket
Flickr
Meetup
Plurk
Twitter
Tumblr
UbuntuOne
Vimeo
Xero
Xing
Yahoo
"""
import abc
import authomatic.core as... | the-duck/that-startpage-rocks | lib/authomatic/providers/oauth1.py | Python | lgpl-3.0 | 38,270 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from tinkerforge.ip_connection import IPConnection
from tinkerforge.bricklet_barometer import Barometer
from create_cfg import local_db, cfg_filename, wd_table, date_table # include variables from create_cfg
from os import path, access, R_OK, W_OK
from datetime imp... | wegtam/weather-client | src/barometer.py | Python | gpl-2.0 | 2,024 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-06-13 20:18
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('transformation', '0102_reli... | cfe-lab/Kive | kive/transformation/migrations/0103_no_default_user.py | Python | bsd-3-clause | 582 |
# Copyright (C) 2010 Google 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 copyright
# notice, this list of conditions and the f... | indashnet/InDashNet.Open.UN2000 | android/external/chromium_org/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py | Python | apache-2.0 | 16,715 |
from pdb import pm
from miasm.analysis.sandbox import Sandbox_Win_x86_32
from miasm.core.locationdb import LocationDB
# Insert here user defined methods
# Parse arguments
parser = Sandbox_Win_x86_32.parser(description="PE sandboxer")
parser.add_argument("filename", help="PE Filename")
options = parser.parse_args()
# ... | serpilliere/miasm | example/jitter/sandbox_pe_x86_32.py | Python | gpl-2.0 | 479 |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import collections
import copy
import logging
import os
import pickle
import re
from devil.android import apk_helper
from devil.android import md5sum
from p... | danakj/chromium | build/android/pylib/instrumentation/instrumentation_test_instance.py | Python | bsd-3-clause | 23,018 |
# This file is part of PyEMMA.
#
# Copyright (c) 2016 Computational Molecular Biology Group, Freie Universitaet Berlin (GER)
#
# PyEMMA is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 o... | marscher/PyEMMA | pyemma/plots/thermoplots.py | Python | lgpl-3.0 | 5,906 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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... | citrix-openstack-build/python-keystoneclient | keystoneclient/tests/v3/test_endpoints.py | Python | apache-2.0 | 3,490 |
##############################################################################
# MDTraj: A Python Library for Loading, Saving, and Manipulating
# Molecular Dynamics Trajectories.
# Copyright 2012-2015 Stanford University and the Authors
#
# Authors: Christoph Klein
# Contributors: Tim Moore
#
# MDTraj is free s... | leeping/mdtraj | mdtraj/geometry/order.py | Python | lgpl-2.1 | 12,556 |
# -*- coding: utf-8 -*-
#
# disthelpers.py - useful distutils helper commands
#
# Copyright (c) 2014 Eric Le Bihan <eric.le.bihan.dev@free.fr>
#
# 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 Softwar... | elebihan/python-ptraceplus | disthelpers.py | Python | gpl-3.0 | 6,064 |
#!/usr/bin/env python
import os
import shutil
import glob
import re
list = glob.glob("*en_00.mrc")
counter=1
for img in list:
tmp1 = re.sub("_00_","_01_",img)
tiltname = re.sub("_00.mrc","_01.mrc",tmp1)
boxImg = img.replace('.mrc','.box')
boxTilt = tiltname.replace('.mrc','.box')
if os.path.isfile(img) &... | mcianfrocco/Cianfrocco_et_al._2013 | OTR/makeNumberedMicros.py | Python | mit | 734 |
"""Operations module.
Provides various helper functions for carrying out database operations.
"""
import re
from sqlalchemy import MetaData
from paf_tools.database import engine
from paf_tools.database.tables import Base
#############################
# Database helper functions #
#############################
def e... | DanMeakin/paf-tools | paf_tools/database/operations.py | Python | mit | 3,814 |
from biohub.core.routes import register_default, url
from .views import upload
register_default(r'^files/', [
url(r'^upload/$', upload, name='upload')
], namespace='files')
| igemsoftware2017/USTC-Software-2017 | biohub/core/files/urls.py | Python | gpl-3.0 | 178 |
#!/usr/bin/env python
"""Unit tests for Online CA WSGI Middleware classes and Application. These are
run using paste.fixture i.e. tests stubs to a web application server
"""
__author__ = "P J Kershaw"
__date__ = "23/09/12"
__copyright__ = "(C) 2012 Science and Technology Facilities Council"
__license__ = "BSD - see LI... | cedadev/online_ca_service | contrail/security/onlineca/server/test/test_client_register.py | Python | bsd-3-clause | 5,398 |
# -*- coding: utf-8 -*-
"""
Acceptance tests for CMS Video Editor.
"""
import ddt
from nose.plugins.attrib import attr
from common.test.acceptance.pages.common.utils import confirm_prompt
from common.test.acceptance.tests.video.test_studio_video_module import CMSVideoBaseTest
@attr(shard=6)
@ddt.ddt
class VideoEdito... | BehavioralInsightsTeam/edx-platform | common/test/acceptance/tests/video/test_studio_video_editor.py | Python | agpl-3.0 | 21,386 |
from vis import rate, vector # importing vPython module
# from pygame.mixer import music, init # importing PyGame music module
from graphics import camera # importing vPython with predefined settings
from key_control import key_check, mouse_check # importing keyboard and mouse control module
from spaceship import s... | lukekulik/solar-system | main.py | Python | mit | 3,249 |
from numpy import array, deg2rad, empty, imag, cos, sin, unique, where
import numpy
from ast import literal_eval
from collections import defaultdict, Counter
from numbers import Number
from yaml import load
from re import match
import os.path
from itertools import chain
__all__=['read_config']
def process_config(pa... | SuperFluffy/DeerQMC | configuration.py | Python | mit | 6,018 |
"""
Tokyo Toshokan (A BitTorrent Library for Japanese Media)
@website https://www.tokyotosho.info/
@provide-api no
@using-api no
@results HTML
@stable no (HTML can change)
@parse url, title, publishedDate, seed, leech,
filesize, magnetlink, content
"""
import re
from c... | pointhi/searx | searx/engines/tokyotoshokan.py | Python | agpl-3.0 | 3,537 |
# Copyright 2013 Locaweb.
# 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 appli... | locaweb/simplestack | tests/exceptions_test.py | Python | apache-2.0 | 1,255 |
import sys
import re
import gzip
def get_lon_lat(idf, maxtoget=50000, verbose=False):
"""
Get the longitude and latitude of different ids. Note that we have longitude first to work with cartopy
:param idf: the id.map file
:param maxtoget: the maxiumum number of ids to get. This is just for debugging
... | linsalrob/crAssphage | bin/map_drawing/crassphage_maps/read_files.py | Python | mit | 3,508 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# SpiceyPy documentation build configuration file, created by
# sphinx-quickstart on Fri Nov 21 22:32:26 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# a... | seap-udea/GravRay | util/SpiceyPy/docs/conf.py | Python | gpl-3.0 | 10,592 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Noun',
fields=[
('id', models.AutoField(verbose... | bahattincinic/arguman.org | web/nouns/migrations/0001_initial.py | Python | mit | 1,343 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License... | sparkslabs/kamaelia_ | Sketches/MPS/BugReports/FixTests/Kamaelia/Kamaelia/Chassis/Prefab.py | Python | apache-2.0 | 4,325 |
# Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
from collections import OrderedDict
import os
import re
import shutil
import signal
import time
import traceback
import flask
import gevent
import gevent.event
import gevent.queue
from . import utils
from .con... | dongjoon-hyun/DIGITS | digits/scheduler.py | Python | bsd-3-clause | 19,330 |
import time
def euler040():
n = 10000000
s, i = '', 1
while len(s) < n:
s += str(i)
i += 1
arr = [1, 10, 100, 1000, 10000, 100000, 1000000]
return reduce(lambda x,y: int(x)*int(y), list(s[x-1] for x in arr))
if __name__ == '__main__' :
a = time.time()
print euler040()
p... | gefei/project-euler | 040.py | Python | mit | 378 |
# -*- coding: utf-8 -*-
#
# Copyright 2018 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | tseaver/google-cloud-python | trace/noxfile.py | Python | apache-2.0 | 4,933 |
#!/usr/bin/env python
from Tkinter import Tk, Frame, BOTH, Text, Menu, END, Label, Canvas, Button, Toplevel, Message
from ttk import Style
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
from matplotlib.backend_bases import key_press_handler
from matplotlib.figure import Figure... | urrfinjuss/gas-network | version_1.0.0/python/clean.py | Python | gpl-2.0 | 17,615 |
#!/usr/bin/env python3
"""Radio scheduling program.
Usage:
schedule.py [--host=HOST] PORT
Options:
--host=HOST Hostname of MPD [default: localhost]
-h --help Show this text
Takes a port number, and does the following:
1. Sets the play order to normal, looping.
2. Clears all music before the cursor positi... | barrucadu/lainonlife | scripts/schedule.py | Python | mit | 4,548 |
# 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 use ... | cloudkick/libcloud | setup.py | Python | apache-2.0 | 5,136 |
"""
This sample shows how to create a
replica from portal of a feature service
"""
import arcrest
from arcrest.security import AGOLTokenSecurityHandler
def trace():
"""
trace finds the line, the filename
and error message and returns it
to the user
"""
import traceback, inspe... | jgravois/ArcREST | samples/create_replica_portal_item.py | Python | apache-2.0 | 2,205 |
#!/usr/bin/env python
# Author: Jane Curry
# Date June 3rd 2016
# Description: Output all local templates for a device to a fil
# Includes interface and filesystem components
# Output is sorted on device id
# Parameters: File name for output
#
import sys
import time
fro... | jcurry/Audit | local_templates.py | Python | gpl-2.0 | 1,972 |
from __future__ import unicode_literals
from reviewboard.webapi.tests.mixins import test_template
from reviewboard.webapi.tests.mixins_extra_data import (ExtraDataItemMixin,
ExtraDataListMixin)
class ReviewListMixin(ExtraDataListMixin):
@test_template
d... | 1tush/reviewboard | reviewboard/webapi/tests/mixins_review.py | Python | mit | 8,138 |
# -*- coding: utf-8 -*-
# Copyright(C) 2014 Oleg Plakhotniuk
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at y... | sputnick-dev/weboob | modules/citibank/test.py | Python | agpl-3.0 | 1,150 |
from rpython.rlib.parsing.regexparse import make_runner
def test_simple():
r = make_runner("a*")
assert r.recognize("aaaaa")
assert r.recognize("")
assert not r.recognize("aaaaaaaaaaaaaaaaaaaaaaaaaa ")
r = make_runner("a*bc|d")
assert r.recognize("aaaaabc")
assert r.recognize("bc")
as... | oblique-labs/pyVM | rpython/rlib/parsing/test/test_regexparse.py | Python | mit | 6,893 |
# Modules.py -- Load/Unload Lustre modules
# Copyright (C) 2013-2015 CEA
#
# This file is part of shine
#
# 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 (a... | cea-hpc/shine | lib/Shine/Lustre/Actions/Modules.py | Python | gpl-2.0 | 6,531 |
"""
Data iterator for text datasets that are used for translation model.
"""
__docformat__ = 'restructedtext en'
__authors__ = ("Razvan Pascanu "
"Caglar Gulcehre "
"KyungHyun Cho ")
__contact__ = "Razvan Pascanu <r.pascanu@gmail>"
import numpy as np
import os, gc
import tables
import c... | neozhangthe1/coverage_model | build/lib/groundhog/datasets/TM_dataset.py | Python | bsd-3-clause | 12,592 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.