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 |
|---|---|---|---|---|---|
"""
xModule implementation of a learning sequence
"""
# pylint: disable=abstract-method
import collections
from datetime import datetime
from django.utils.timezone import UTC
import json
import logging
from pkg_resources import resource_string
from lxml import etree
from xblock.core import XBlock
from xblock.fields i... | pepeportela/edx-platform | common/lib/xmodule/xmodule/seq_module.py | Python | agpl-3.0 | 22,210 |
import tg
import warnings
from pylons import tmpl_context as c
import bson
from forgeshorturl.command.base import ShortUrlCommand
from forgeshorturl.model import ShortUrl
from allura.lib import exceptions
from allura.lib import helpers as h
from allura import model as M
from ming.orm import session
import sqlalchemy
fr... | Bitergia/allura | ForgeShortUrl/forgeshorturl/command/migrate_urls.py | Python | apache-2.0 | 4,178 |
# encoding: utf-8
from yast import import_module
import_module('UI')
from yast import *
class LayoutWeights1Client:
def main(self):
# Layout example:
#
# Build a dialog with three widgets with different weights.
#
# Weights do not need to add up to 100 or any other special
# num... | yast/yast-python-bindings | examples/Layout-Weights1.py | Python | gpl-2.0 | 1,003 |
from django.conf.urls import patterns, url
from django.conf.urls.static import static
from django.conf import settings
urlpatterns = [
# Examples:
url(r'^$', 'nebulosa.views.home', name='home'),
url(r'^concepts$', 'nebulosa.views.concepts', name='concepts'),
url(r'^nebulosa', 'nebulosa.views.related', ... | palkeo/nebulosa | nebulosa/urls.py | Python | unlicense | 407 |
from collections import deque
import net.mapserv as mapserv
from loggers import debuglog
from utils import extends
from textutils import preprocess as pp
sent_whispers = deque()
def send_whisper(nick, message):
sent_whispers.append((nick, message))
mapserv.cmsg_chat_whisper(nick, message)
@extends('smsg_wh... | mekolat/manachat | chat.py | Python | gpl-2.0 | 1,301 |
# Generated by Django 1.11.14 on 2018-07-14 01:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounting', '0035_merge_20180711_2039'),
]
operations = [
migrations.CreateModel(
name='DomainUserHistory',
field... | dimagi/commcare-hq | corehq/apps/accounting/migrations/0036_domainuserhistory.py | Python | bsd-3-clause | 660 |
class ScaleFormatError(Exception):
pass
class InvalidTokenError(Exception):
pass
| oleiade/durations | durations/exceptions.py | Python | mit | 91 |
# Copyright 2021 The TF-Coder 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... | google-research/tensorflow-coder | setup.py | Python | apache-2.0 | 3,049 |
# Copyright 2017 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, s... | cschnei3/forseti-security | tests/iam/api_tests/__init__.py | Python | apache-2.0 | 608 |
"""
Tests for Molecular Graph data structures.
"""
import unittest
import numpy as np
from deepchem.feat.mol_graphs import ConvMol
class TestMolGraphs(unittest.TestCase):
"""
Test mol graphs.
"""
def test_construct_conv_mol(self):
"""Tests that ConvMols can be constructed without crash."""
# Artifici... | peastman/deepchem | deepchem/feat/tests/test_mol_graphs.py | Python | mit | 5,782 |
from hubcheck.pageobjects.basepagewidget import BasePageWidget
from hubcheck.pageobjects.basepageelement import Link
from hubcheck.pageobjects.basepageelement import TextReadOnly
from hubcheck.pageobjects.widgets.item_list_item import ItemListItem
from selenium.webdriver.common.action_chains import ActionChains
class ... | codedsk/hubcheck | hubcheck/pageobjects/widgets/resources_tool_file_upload_row.py | Python | mit | 3,019 |
"""Benchmark how quickly Python's regex implementation can compile regexes.
We bring in all the regexes used by the other regex benchmarks, capture them by
stubbing out the re module, then compile those regexes repeatedly. We muck with
the re module's caching to force it to recompile every regex we give it.
"""
# Py... | python/performance | pyperformance/benchmarks/bm_regex_compile.py | Python | mit | 1,778 |
# -*- coding: utf-8 -*-
# Copyright 2016-2017 LasLabs Inc.
# License GPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from odoo import _, api, models
from odoo.exceptions import ValidationError
class MedicalPrescriptionOrder(models.Model):
_inherit = 'medical.prescription.order'
@api.multi
def ... | laslabs/vertical-medical | medical_prescription_state_verify/models/medical_prescription_order.py | Python | agpl-3.0 | 2,866 |
from django import template
from oscar.core.loading import feature_hidden
register = template.Library()
def get_parameters(parser, token):
"""
{% get_parameters except_field %}
"""
args = token.split_contents()
if len(args) < 2:
raise template.TemplateSyntaxError(
"get_parame... | mexeniz/django-oscar | src/oscar/templatetags/display_tags.py | Python | bsd-3-clause | 1,908 |
import sys
sys.path.insert(0, '../..')
from lsystem import draw_koch_islands, LFigure, LSystem2D
black = ( 0, 0, 0, 255)
white = (255, 255, 255, 255)
iterations = 3
angel = 90 # In gradus
axiom = 'F-F-F-F'
productions = {
'F': 'F-F+F+FF-F-F+F',
}
for i in range(4):
# Make figure example of class
ls... | maruschin/l-system | examples/Koch islands/make.py | Python | mit | 561 |
from mysite.polls.models import Poll
from mysite.polls.models import Choice
from django.contrib import admin
class ChoiceInline(admin.TabularInline):
model = Choice
extra = 3
class PollAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['question']}),
('Date information... | aldeka/5-minute-design | demos/ngrok_demo/mysite/polls/admin.py | Python | mit | 611 |
import json
import time
import argparse
import sys
import urllib.request
parser = argparse.ArgumentParser(
description='This tool allow to extract domains from IP information on Virustotal and save the output in a file. You have to set up the IP range where you like to extract domain or subdomain. Additionally i... | jevalenciap/iptodomain | iptodomain.py | Python | gpl-3.0 | 4,548 |
from __future__ import division
import numpy as np
from numpy.lib.stride_tricks import as_strided as ast
### striding data for efficient AR computations
def AR_striding(data,nlags):
# I had some trouble with views and as_strided, so copy if not contiguous
data = np.asarray(data)
if not data.flags.c_contig... | mattjj/pyhsmm-autoregressive | autoregressive/util.py | Python | gpl-2.0 | 1,782 |
# This file is part of the GOsa framework.
#
# http://gosa-project.org
#
# Copyright:
# (C) 2016 GONICUS GmbH, Germany, http://www.gonicus.de
#
# See the LICENSE file in the project's top-level directory for details.
from uuid import uuid4
from unittest import TestCase, mock
from gosa.client.mqtt_service import *
fro... | gonicus/gosa | client/src/tests/client/test_mqtt_service.py | Python | lgpl-2.1 | 4,300 |
import json
from flask import request
from .hooks import before_request
def route(bp, rule, **kwargs):
def decorator(f):
endpoint = kwargs.pop('endpoint', None)
if isinstance(rule, list):
for url in rule:
bp.add_url_rule(url, endpoint, f, **kwargs)
elif isinsta... | vgamula/breakyourantiques | antiques/core/utils.py | Python | mit | 634 |
import socket
import sys
import time
import filecmp
from lettuce import *
@step('I have the file "(.*)"')
def have_the_file(step, filename):
world.filename = filename
@step('I send this file to analyzer')
def send_this_file_to_analyzer(step):
send_file_to_server(host="localhost", port=55678, filename=worl... | alexgarzao/noise-analyzer | tests/features/test_analyzer_steps.py | Python | gpl-3.0 | 1,153 |
from test_schema import Field, Schema
myschema = Schema("mytable")
myschema.add_fields(["user", "range", "metric", "ccypair"])
myschema.add_fields({"date": int, "tradedate": int})
val_schema = Schema()
val_schema.add_fields(["orders", "trades"], float)
myschema.add_array("vals", object, val_schema, always_unwind=Tru... | sidazad/ezmongo | testconf.py | Python | gpl-2.0 | 566 |
# This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | nop33/indico | indico/modules/events/persons/operations.py | Python | gpl-3.0 | 1,357 |
# Copyright (c) LinkedIn Corporation. All rights reserved. Licensed under the BSD-2 Clause license.
# See LICENSE in the project root for license information.
from falcon import HTTPNotFound, HTTPBadRequest, HTTPForbidden
from ...auth import login_required, check_team_auth
from .schedules import insert_schedule_event... | dwang159/oncall | src/oncall/api/v0/schedule.py | Python | bsd-2-clause | 6,641 |
# ~*~ coding: utf-8 ~*~
from django.conf.urls import *
import virtenviro.registration.views
import django.contrib.auth.views
urlpatterns = [
url(r'^signup/$', virtenviro.registration.views.signup),
url(r'^login/$', django.contrib.auth.views.login, {"template_name": "virtenviro/accounts/login.html"}),
url(r... | Haikson/virtenviro | virtenviro/registration/urls_new.py | Python | apache-2.0 | 396 |
r"""XML-RPC Servers.
This module can be used to create simple XML-RPC servers
by creating a server and either installing functions, a
class instance, or by extending the SimpleXMLRPCServer
class.
It can also be used to handle XML-RPC requests in a CGI
environment using CGIXMLRPCRequestHandler.
The Doc* classes can b... | bgris/ODL_bgris | lib/python3.5/xmlrpc/server.py | Python | gpl-3.0 | 36,640 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import json
import unittest
import twitter
def test_streaming_extended_tweet():
with open('testdata/streaming/streaming_extended_tweet.json') as f:
tweet = twitter.Status.NewFromJsonDict(json.loads(f.... | jeremylow/python-twitter | tests/test_streaming.py | Python | apache-2.0 | 1,116 |
"""
KDL - deep learning for medic
"""
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy.signal import convolve2d, fftconvolve
from sklearn import preprocessing, model_selection, metrics
import os
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers impo... | jskDr/jamespy_py3 | medic/kdl.py | Python | mit | 53,787 |
# Copyright (c) 2016-present, Facebook, 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... | Yangqing/caffe2 | caffe2/python/model_helper.py | Python | apache-2.0 | 23,553 |
# -*- coding:utf-8 -*-
class BaseDatabaseValidation(object):
"""
This class encapsulates all backend-specific model validation.
"""
def __init__(self, connection):
self.connection = connection
def check_field(self, field, **kwargs):
return []
| wfxiang08/django197 | django/db/backends/base/validation.py | Python | bsd-3-clause | 280 |
data = (
'Chu ', # 0x00
'Jing ', # 0x01
'Nie ', # 0x02
'Xiao ', # 0x03
'Bo ', # 0x04
'Chi ', # 0x05
'Qun ', # 0x06
'Mou ', # 0x07
'Shu ', # 0x08
'Lang ', # 0x09
'Yong ', # 0x0a
'Jiao ', # 0x0b
'Chou ', # 0x0c
'Qiao ', # 0x0d
'[?] ', # 0x0e
'Ta ', # 0x0f
'... | gquirozbogner/contentbox-master | third_party/unidecode/x08e.py | Python | apache-2.0 | 4,917 |
# proxy module
from traitsui.theme import *
| enthought/etsproxy | enthought/traits/ui/theme.py | Python | bsd-3-clause | 44 |
'''
Run the tests using testrunner.py script in the project root directory.
Usage: testrunner.py SDK_PATH TEST_PATH
Run unit tests for App Engine apps.
SDK_PATH Path to the SDK installation
TEST_PATH Path to package containing test modules
Options:
-h, --help show this help message and exit
'''
import unitt... | markap/TravelMap | web/tests.py | Python | lgpl-3.0 | 3,375 |
# -*- coding: utf-8 -*-
import werkzeug
from openerp import SUPERUSER_ID
from openerp import http
from openerp.http import request
from openerp.tools.translate import _
from openerp.addons.website.models.website import slug
from openerp.addons.web.controllers.main import login_redirect
PPG = 20 # Products Per Page
PP... | Kilhog/odoo | addons/website_sale/controllers/main.py | Python | agpl-3.0 | 42,039 |
# Copyright (c) 2013 Cloudbase Solutions Srl
#
# 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 applicab... | cmin764/cloudbase-init | cloudbaseinit/plugins/windows/extendvolumes.py | Python | apache-2.0 | 1,753 |
from collections import deque, Counter, defaultdict
from copy import deepcopy
import hashlib
import json
import logging
from operator import itemgetter
from queue import Queue, Empty, PriorityQueue
from threading import Thread, Lock
from concurrent.futures import ThreadPoolExecutor
import retrace
import shelve
import ... | Tjorriemorrie/pokeraide | term/mc/mc.py | Python | gpl-2.0 | 49,460 |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate... | agry/NGECore2 | scripts/mobiles/endor/gondula_cub.py | Python | lgpl-3.0 | 3,128 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
from __future__ import (unicode_literals, absolute_import,
division, print_function)
import logging
import os
from django.core.management.base import BaseCommand
from optparse import make_option
from py3compat import... | yeleman/snisi | snisi_maint/management/commands/create-users-mopti-uninut.py | Python | mit | 3,814 |
from mytest import WindowsTestCase
__all__ = ["WindowsTestCase"]
| sogeti-esec-lab/LKD | windows/test/__init__.py | Python | bsd-3-clause | 66 |
from pyven.exceptions.exception import PyvenException
import pyven.constants
from pyven.steps.step import Step
from pyven.steps.utils import retrieve
from pyven.checkers.checker import Checker
from pyven.logging.logger import Logger
from pyven.reporting.content.step import StepListing
class PackageStep(Step):
de... | mgaborit/pyven | source/pyven/steps/package.py | Python | mit | 1,753 |
#! /usr/bin/python3
import unittest
import string
import random
from palindrome import isPalindrome
class TestPalindrome(unittest.TestCase):
def test_single_chars(self):
for c in string.ascii_letters:
self.assertTrue(isPalindrome(c))
def test_len_1_decimals(self):
for i in range(10):
self.as... | Ephphatha/Project-Euler | Problem 004/test_palindrome.py | Python | mit | 1,732 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | cg31/tensorflow | tensorflow/contrib/tensor_forest/python/kernel_tests/count_extremely_random_stats_op_test.py | Python | apache-2.0 | 13,601 |
# $Id: 126_sdp_with_port_0_and_no_rtpmap_for_dynamic_pt.py 369517 2012-07-01 17:28:57Z file $
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=video 0 RTP/AVP 100
m=audio 5000 RTP/AVP 0
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers =... | fluentstream/asterisk-p2p | res/pjproject/tests/pjsua/scripts-sendto/126_sdp_with_port_0_and_no_rtpmap_for_dynamic_pt.py | Python | gpl-2.0 | 659 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Marcelo Jorge Vieira <metal@alucinados.com>
#
# This program 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... | scorphus/politicos | tests/unit/handlers/test_political_party.py | Python | agpl-3.0 | 4,973 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | AutorestCI/azure-sdk-for-python | azure-mgmt-web/azure/mgmt/web/models/azure_table_storage_application_logs_config.py | Python | mit | 1,223 |
#!/bin/python3
import subprocess
import requests
import re
import os
import shutil
import lzma
import tarfile
url = 'https://dist.torproject.org/torbrowser/'
def error(message):
print(message)
subprocess.call(['allUserNotifySend',
'-a', 'Tor updater',
'-u', 'critical... | phuhl/.dotfiles | tor/updateTor.py | Python | mit | 3,292 |
#
# Copyright 2009 Eigenlabs Ltd. http://www.eigenlabs.com
#
# This file is part of EigenD.
#
# EigenD 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) a... | Eigenlabs/EigenD | lib_pico/preadtemp.py | Python | gpl-3.0 | 1,052 |
#!/usr/bin/env python
# ===============================================================================
# Copyright (c) 2014 Geoscience Australia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
... | alex-ip/agdc | api-examples/source/main/python/observation_count.py | Python | bsd-3-clause | 6,093 |
#!/sw/bin/python
from pyx import *
from math import *
class ArrowPlotter:
def __init__(self,g):
self.g = g # graph to plot to
self.gsize = (g.width,g.height) # size of graph canvas
self.gaxes = (g.axes['x'].axis, g.axes['y'].axis)
self.axi... | mpmendenhall/rotationshield | Scripts/ArrowPlotter.py | Python | gpl-3.0 | 1,787 |
from menpo.misctools.circlefit import circle_fit
| karla3jo/menpo-old | menpo/misctools/__init__.py | Python | bsd-3-clause | 49 |
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLI... | 111pontes/ydk-py | cisco-ios-xr/ydk/models/cisco_ios_xr/_meta/_Cisco_IOS_XR_controller_otu_oper.py | Python | apache-2.0 | 73,315 |
# coding=utf-8
import time
from django.core.cache import cache
from django.conf import settings
from django.shortcuts import render_to_response, RequestContext
from dateutil.parser import parse as parse_date
from silk.profiling.profiler import silk_profile
def index(request):
return render_to_response('index.htm... | openslack/openslack-web | openslack/openslack/views.py | Python | apache-2.0 | 355 |
from setuptools import setup
def readme():
with open('README.md') as f:
return f.read()
setup(
name='bunqclient',
version='2020.10.30',
description='Python client for the bunq public API',
long_description=readme(),
keywords=["bunq", "client", "bank", "api", "bunqclient"... | bartbroere/bunqclient | setup.py | Python | mit | 1,086 |
import os
import numpy as np
from ase import Atom, Atoms
from ase.lattice import bulk
from ase.units import Hartree, Bohr
from gpaw import GPAW, FermiDirac
from gpaw.response.bse import BSE
from ase.dft.kpoints import monkhorst_pack
from gpaw.mpi import rank
GS = 1
bse = 1
check = 1
if GS:
kpts = (4,4,4)
a ... | robwarm/gpaw-symm | gpaw/test/bse_silicon.py | Python | gpl-3.0 | 1,576 |
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import traceback
import sys
def handle_exception(msg=''):
"""This function is the project's exception handler.
There is currently no logic, but could be easily added in the future.
:param msg: T... | onfido/dependencies-resolver | dependencies_resolver/utils/exception_handler.py | Python | mit | 469 |
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
from pootle.core.delegate import crud, data_... | ta2-1/pootle | pootle/apps/pootle_data/getters.py | Python | gpl-3.0 | 2,490 |
import os
from celery.schedules import crontab
import djcelery
__copyright__ = "Copyright 2011 Red Robot Studios Ltd."
__license__ = "GPL v3.0 http://www.gnu.org/licenses/gpl.html"
djcelery.setup_loader()
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Panic Stations', 'panic@redrobotstudios.com'),
)
MAN... | andrewgleave/OpenElm | web/openelm/settings.py | Python | mit | 6,211 |
from prisoner.gateway.ServiceGateway import ServiceGateway, WrappedResponse
import prisoner.SocialObjects as SocialObjects
import json
import urlparse
import oauth2
import datetime
import urllib
class TwitterServiceGateway(ServiceGateway):
""" Service Gateway for Twitter.
This gateway supports reading a user's t... | uoscompsci/PRISONER | prisoner/gateway/TwitterGateway.py | Python | bsd-3-clause | 7,453 |
import subprocess
import sys
from pathlib import Path
from django.core.management.base import BaseCommand
class Command(BaseCommand):
def handle(self, *args, **options):
bin = Path(sys.exec_prefix) / 'bin' / 'pybabel'
compile_cmd = f'{bin} compile -D django -d karrot/locale -f'
print(co... | yunity/foodsaving-backend | karrot/management/commands/compilemessages.py | Python | agpl-3.0 | 391 |
# pylint: skip-file
# -*- coding: utf-8 -*-
# Module: KodiHelper
# Created on: 13.01.2017
import re
import json
import base64
import hashlib
from os import remove
from uuid import uuid4
from urllib import urlencode
import AddonSignals
import xbmc
import xbmcgui
import xbmcplugin
import inputstreamhelper
from resources... | mrquim/mrquimrepo | repo/plugin.video.netflix/resources/lib/KodiHelper.py | Python | gpl-2.0 | 56,995 |
# -*- coding: utf-8 -*-
#
# This file is part of EventGhost.
# Copyright © 2005-2020 EventGhost Project <http://www.eventghost.net/>
#
# EventGhost 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 versio... | tfroehlich82/EventGhost | eg/Classes/PersistentData.py | Python | gpl-2.0 | 1,281 |
import datetime
import threading
import time
import serial
import local_config
from models import Bike
from vtk_bike import app, mongo
def action():
app.bikes = {0: Bike("bike1"), 1: Bike("bike2")}
ser = None
for i in range(2):
try:
ser = serial.Serial(local_config.address + str(i), ... | FKint/loveleuven-bike-web | utilities/__init__.py | Python | mit | 2,840 |
# functions used by multiple algos
from sysdata.data_blob import dataBlob
from sysproduction.data.broker import dataBroker
from syscore.genutils import quickTimer
from sysexecution.order_stacks.broker_order_stack import orderWithControls
# how often do algos talk
MESSAGING_FREQUENCY = 30
# how long to cancel an orde... | robcarver17/pysystemtrade | sysexecution/algos/common_functions.py | Python | gpl-3.0 | 3,854 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: POGOProtos/Settings/Master/PokemonUpgradeSettings.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from g... | DenL/pogom-webhook | pogom/pgoapi/protos/POGOProtos/Settings/Master/PokemonUpgradeSettings_pb2.py | Python | mit | 3,581 |
# Sample Python/Pygame Programs
# Simpson College Computer Science
# http://cs.simpson.edu
import pygame
# Define some colors
black = ( 0, 0, 0)
white = ( 255, 255, 255)
green = ( 0, 255, 0)
red = ( 255, 0, 0)
pygame.init()
# Set the height and width of the screen
size=[700,500]
screen=... | tapomayukh/projects_in_python | sandbox_tapo/src/refs/Python Examples_Pygame/Python Examples/pygame_base_template.py | Python | mit | 1,067 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
External inventory script for Abiquo
====================================
Shamelessly copied from an existing inventory script.
This script generates an inventory that Ansible can understand by making API requests to Abiquo API
Requires some python libraries, ensure ... | Russell-IO/ansible | contrib/inventory/abiquo.py | Python | gpl-3.0 | 8,834 |
"""
Author: vakhet at gmail.com
Script converts Sprite ID to Sprite Constant, i.e. 8_F_GIRL -> 700
Place script and CONSTANT_FILE in Tools directory
Each line in CONSTANT_FILE should match regex '[A-Z0-9_]+'.
Before processing each file, backup is created in same dir.
Backup is deleted if there was 0 replaces.
S... | vakhet/rathena-utils | Tools/convert-sprite-id.py | Python | mit | 3,191 |
# -*- coding: utf-8 -*-
# coding:utf8
from scrapy.contrib.linkextractors import LinkExtractor
from scrapy.contrib.spiders import CrawlSpider, Rule
from pythonExercise.scrapy.fang.FangItem import FangItem, FangCommunity
class FangSpider(CrawlSpider) :
name = 'fangSearch'
allowed_domains = ['fang.com']
# ... | RishonLi/PythonExecise | pythonExercise/scrapy/fang/spiders/FangSpider.py | Python | apache-2.0 | 846 |
import mock
from django.contrib.contenttypes.models import ContentType
from django.utils import unittest
from dynamic_rules import models, rule_registry
__all__ = ('RuleManagerTests', 'RuleModelTests',)
class RuleManagerTests(unittest.TestCase):
def setUp(self):
self.model_one = mock.Mock()
@moc... | imtapps/django-dynamic-rules | dynamic_rules/tests/test_models.py | Python | bsd-2-clause | 3,462 |
# This file is part of Virtual Programming Lab.
#
# Virtual Programming Lab 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.
#
# Virtu... | buchuki/programming_lab | programming_lab/classlist/forms.py | Python | gpl-3.0 | 1,349 |
#
# Copyright (c) 2018 Bobby Noelte
#
# SPDX-License-Identifier: Apache-2.0
#
from copy import deepcopy
from extract.globals import *
from extract.directive import DTDirective
##
# @brief Manage reg directive.
#
class DTReg(DTDirective):
##
# @brief Extract reg directive info
#
# @param node_path Pat... | ldts/zephyr | scripts/dts/extract/reg.py | Python | apache-2.0 | 4,066 |
#! /usr/bin/python
# -*- encoding: utf-8 -*-
import os
import vim
import urllib2
import cookielib
import datetime
import subprocess
import MultipartPostHandler
def post():
cookies = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookies),
Multipar... | balloon-stat/komadori.vim | bin/gyazo.py | Python | mit | 988 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from elasticsearch import Elasticsearch
"""
Common operation of elasticsearch
"""
node_list = [{"host": "10.19.8.61", "port": 9200}]
index_name = "tinycell"
type_name = "page_data"
es = Elasticsearch(node_list)
doc = {
"author": "kimky",
"text": "Elasticsearch: co... | tiny-cell/tinycell | src/esmod.py | Python | mit | 770 |
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# Example demonstrates how to generate a 3D tetrahedra mesh from a volume
#
# Quadric definition
quadric = vtk.vtkQuadric()
quadric.SetCoefficients([.5,1,.2,0,.1,0,0,.2,0,0]... | hlzz/dotfiles | graphics/VTK-7.0.0/Filters/General/Testing/Python/clipVolume.py | Python | bsd-3-clause | 1,540 |
#!/usr/bin/env python
#coding: utf-8
import re
from pocsuite.net import req
from pocsuite.poc import Output, POCBase
from pocsuite.utils import register
class showSeebugSubmission(POCBase):
vulID = 'showSeebugSubmission'
version = 'showSeebugSubmission'
vulDate = '2016-01-04'
references = [' ']
na... | inno-jeremy/showSeebugSubmission | showSeebugSubmission.py | Python | gpl-2.0 | 2,670 |
# -*- coding: utf-8 -*-
#
# This file is part of INGInious. See the LICENSE and the COPYRIGHTS files for
# more information about the licensing of this file.
#
# Copyright (c) Steven Anderson, Joshua Bronson
#
# Imported from https://github.com/whilefalse/webpy-mongodb-sessions/.
""" Saves sessions in the database """
... | JuezUN/INGInious | inginious/frontend/session_mongodb.py | Python | agpl-3.0 | 3,541 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
# metadata
from __future__ import unicode_literals
import frappe, os
from frappe.model.meta import Meta
from frappe.modules import scrub, get_module_path, load_doctype_module
from frappe.model.workflow import get_workf... | bcornwellmott/frappe | frappe/desk/form/meta.py | Python | mit | 7,204 |
# -*- coding: utf-8 -*-
"""Page model for Cloud Intel / Reports / Dashboards"""
from navmazing import NavigateToAttribute, NavigateToSibling
from widgetastic.widget import Text, Checkbox
from widgetastic_manageiq import SummaryFormItem, DashboardWidgetsPicker
from widgetastic_patternfly import Button, Input
from utils... | dajohnso/cfme_tests | cfme/intelligence/reports/dashboards.py | Python | gpl-2.0 | 10,188 |
# -*- coding: utf-8 -*-
"""
InaSAFE Disaster risk assessment tool developed by AusAid and World Bank
- **Functionality related to shake events.**
Contact : ole.moller.nielsen@gmail.com
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public Lice... | danylaksono/inasafe | realtime/shake_event.py | Python | gpl-3.0 | 100,354 |
import os
import unittest
from vsg.rules import block
from vsg import vhdlFile
from vsg.tests import utils
sTestDir = os.path.dirname(__file__)
lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir,'rule_101_test_input.vhd'))
lExpected = []
lExpected.append('')
utils.read_file(os.path.join(sTestDir, 'r... | jeremiah-c-leary/vhdl-style-guide | vsg/tests/block/test_rule_101.py | Python | gpl-3.0 | 1,146 |
from Tribler.Core.Category.FamilyFilter import XXXFilter
from Tribler.Test.test_as_server import AbstractServer
class TriblerCategoryTestFamilyFilter(AbstractServer):
def setUp(self, annotate=True):
super(TriblerCategoryTestFamilyFilter, self).setUp(annotate=annotate)
self.family_filter = XXXFilt... | vandenheuvel/tribler | Tribler/Test/Core/Category/test_family_filter.py | Python | lgpl-3.0 | 1,520 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | balajikris/autorest | src/generator/AutoRest.Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/models/__init__.py | Python | mit | 713 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2011 Yesudeep Mangalapilly <yesudeep@gmail.com>
# Copyright 2012 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 ... | gorakhargosh/mom | tools/dump_primes.py | Python | apache-2.0 | 1,680 |
smilies = [["16", "16", "frown.gif", "Frown", ":("],
["16", "16", "mad.gif", "Mad", ":mad:"],
["16", "16", "tongue.gif", "Stick Out Tongue", ":p"],
["16", "16", "wink.gif", "Wink", ";)"],
["16", "16", "biggrin.gif", "Big Grin", ":D"],
["16", "16", "redface.g... | Der-Eddy/pyepvp | pyepvp/icons.py | Python | mit | 2,197 |
# proxy module
from __future__ import absolute_import
from envisage.developer.developer_plugin import *
| enthought/etsproxy | enthought/envisage/developer/developer_plugin.py | Python | bsd-3-clause | 104 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import logging
from lib import initialize_tasknode_logger
from .app import (
websight_app,
)
logger = logging.getLogger(__name__)
initialize_tasknode_logger(logger)
| lavalamp-/ws-backend-community | tasknode/__init__.py | Python | gpl-3.0 | 236 |
import tensorflow as tf
from tensorflow.python.ops import rnn_cell
from tensorflow.python.ops import seq2seq
import numpy as np
class Model():
def __init__(self, args, infer=False):
self.args = args
if infer:
args.batch_size = 1
args.seq_length = 1
if args.model ==... | bahmanh/word-rnn-tensorflow | model.py | Python | mit | 4,046 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2012:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can redis... | wbsavage/shinken | shinken/modules/livestatus_broker/livestatus_constraints.py | Python | agpl-3.0 | 1,201 |
###############################################################################
# ilastik: interactive learning and segmentation toolkit
#
# Copyright (C) 2011-2014, the ilastik developers
# <team@ilastik.org>
#
# This program is free software; you can redistribute it and/or
# mod... | ilastikdev/ilastik | ilastik/applets/featureSelection/opFeatureSelection.py | Python | gpl-3.0 | 12,335 |
#
# Copyright 2011-2015 Universidad Complutense de Madrid
#
# This file is part of Megara DRP
#
# Megara DRP 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 optio... | Pica4x6/megaradrp | megaradrp/recipes/calibration/dark.py | Python | gpl-3.0 | 1,657 |
import simplejson as json
class GettError(Exception):
"""
Base error class
**Attributes**
- ``http_status`` The HTTP status code from the remote server
- ``endpoint`` The URI to which a request was attempted
- ``error`` A message describing the error
"""
def __init__(self,... | mrallen1/pygett | pygett/exceptions.py | Python | mit | 810 |
# 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... | MangoMangoDevelopment/neptune | lib/genpy-0.5.8/src/genpy/rostime.py | Python | bsd-3-clause | 14,357 |
#!/usr/bin/env python
import glob
import math
import os
import sys
from optparse import OptionParser
from PIL import Image, ImageFont, ImageDraw
import settings
def debug(s):
sys.stderr.write('%s\n' % s)
def makeCollage( listFiles = [], *args):
# List of input files.
infiles = listFiles
debug('... | Comp4710AprioriTextIllustrator/TextIllustrator | collage/collage.py | Python | mit | 2,136 |
import gevent
import gevent.pool
import uuid
import logging
def get_trace(greenlet=None):
greenlet = greenlet or gevent.getcurrent()
if not hasattr(greenlet, '_iris_trace'):
greenlet._iris_trace = {}
return greenlet._iris_trace
def spawn(*args, **kwargs):
greenlet = gevent.Greenlet(*args, **... | kpanic/lymph | iris/core/trace.py | Python | apache-2.0 | 983 |
from __future__ import absolute_import
from torch import nn
import torch.nn.functional as F
class SoftCrossEntropyLoss(nn.Module):
def __init__(self, weight=None, size_average=True, reduce=True):
super(SoftCrossEntropyLoss, self).__init__()
self.reduce = reduce
def forward(self, inputs, targ... | Flowerfan524/TriClustering | reid/loss/soft_cross_entropy_loss.py | Python | mit | 596 |
# This file is part of xrayutilities.
#
# xrayutilities is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed... | dkriegner/xrayutilities | examples/xrayutilities_read_spec.py | Python | gpl-2.0 | 6,137 |
#!/usr/bin/python
import os
import signal
import sys
import subprocess
import socket
import time
def wrapper ():
#This is a simple python wrapper for the data aquisition script
#The aim of the wrapper is to redirect standart output and error to
#files, to save information about pid and to handle SIGTERM signal
#for t... | arabusov/bredsivojkobyly | test.py | Python | gpl-3.0 | 5,327 |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... | JoseALermaIII/python-tutorials | docs/source/conf.py | Python | mit | 6,850 |
# Generated by Django 2.0.13 on 2021-04-22 11:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("ddcz", "0066_mentat_fix_autoincrement"),
]
operations = [
migrations.AlterField(
model_name="mentatnewbie",
name="d... | dracidoupe/graveyard | ddcz/migrations/0067_field_fix.py | Python | mit | 621 |
import re
from skf.api.chatbot.scripts import entity_reco
vulndict=entity_reco.entity_data()
vulndict = {k.lower(): v for k, v in vulndict.items()}
punctuations = '''!()-[]{};:'"\,<>./?@#$%^&*_~'''
def entity_recognizer(sentence):
listofWords = re.findall(r"[\w']+|[.,!?;]", sentence)
copyofWords=[... | blabla1337/skf-flask | skf/api/chatbot/scripts/entity_classifier1.py | Python | agpl-3.0 | 1,927 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.