repo_name stringlengths 5 104 | path stringlengths 4 248 | content stringlengths 102 99.9k |
|---|---|---|
rhatdan/selinux | policycoreutils/gui/fcontextPage.py | ## fcontextPage.py - show selinux mappings
## Copyright (C) 2006 Red Hat, Inc.
## 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 lat... |
nosemeocurrenada/StupidClip | TideStupidClip/Resources/py/MessageManager.py | class MessageManager():
def __init__(self):
self.messages = []
self.index = 0
def add (self, message):
from Message import Message
if not isinstance(message, Message):
raise TypeError("message parameter (1) should be instance of Message")
# print ... |
ptesarik/crash-python | crash/subsystem/storage/device_mapper.py | # -*- coding: utf-8 -*-
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import gdb
import sys
if sys.version_info.major >= 3:
long = int
from crash.infra import CrashBaseClass
from crash.sub... |
arrow-/simQuad | ground_station/at_talk.py | '''
xbee pinouts:
1.Vcc = 3.3V
2.DOUT (Tx of XBee) connect to RX of arduino
3.DIN (Rx of Xbee) connect to TX of...
10.GND
l to r vcc gnd scl sda dash dash ad0 int
'''
import serial, random
def longToBytes(long_number):
"""
converts long_number into list of <8-bit> bytes
Result Format:
[hi - mid - ... - lo]
... |
splice/rhic-serve | selinux_setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright © 2012 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this soft... |
Euphe/dungeon_bot | dungeon_bot/dungeon_bot.py | #!/usr/bin/env python3
from .persistence import PersistenceController
from .creatures import Player
from .bot_events import *
from .util import *
from .level_perks import *
from telegram import ReplyKeyboardMarkup, ReplyKeyboardHide
import logging
import datetime
import random
import gc
persistence_con... |
bibi21000/RasPy | src/raspy/servers/core.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
__license__ = """
This file is part of RasPy.
RasPy is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your opti... |
rsfreitas/shellbber | shellber/app/core.py |
#
# Copyright (C) 2016 Rodrigo Freitas
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distribute... |
CityGenerator/Megacosm-Generator | megacosm/generators/sect.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" A Sect is an unusual following of a deity."""
import logging
import random
from megacosm.generators.generator import Generator
from megacosm.generators.name import Name
#from megacosm.generators import deity
import deity
class Sect(Generator):
""" A group of reli... |
panStamp/python_tools | swapdmt-cmd/swapdmt.py | #!/usr/bin/env python
#########################################################################
#
# Copyright (c) 2014 Daniel Berenguer <dberenguer@usapiens.com>
#
# This file is part of the lagarto project.
#
# lagarto is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Pub... |
arelenglish/rolodex | back_end_rolodex.py | #!/usr/bin/env python3
"""Accepts a file of addresses and returns a formatted JSON output.
Usage:
python3 back_end_rolodex.py
"""
import re
import json
import sys
from collections import OrderedDict
def filter_addresses(address_file):
addresses = []
errors = []
phone_num_re = re.compile('(\+0... |
unho/translate | translate/storage/statistics.py | # -*- coding: utf-8 -*-
#
# Copyright 2007 Zuza Software Foundation
#
# This file is part of translate.
#
# translate 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 y... |
yshen4/ICU4C | aws/develop/exercise7/FlaskApp/application.py | # Copyright 2017 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
#
# https://aws.amazon.com/apache-2-0/
#
# or in the "license" file accompa... |
BackupTheBerlios/pixies-svn | pixies/reportlab/lib/sequencer.py | #Copyright ReportLab Europe Ltd. 2000-2004
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/sequencer.py
__version__=''' $Id$ '''
"""This module defines a single public class, Sequencer, which aids in
numbering and formatting lists."""
#
#... |
tgrosch/bacnet | bacnet/settings.py | # pylint: disable=
"""
BACnet Settings Module
----------------------
This module contains general settings for the BACnet system.
"""
import os
# set data path
DATA_PATH = 'run/'
# set sandbox path
SANDBOX_PATH = 'bacnet/sandbox/'
# set sandbox temp path
SANDBOX_TMP = os.path.join(SANDBOX_PATH, 'tmp')
# set int... |
pjotrp/sambamba | test/test_depth.py | import msgpack
import subprocess
import os.path
import random
import tempfile
import csv
sambamba = os.path.join(os.path.abspath(os.path.dirname(__file__)), '../build/sambamba')
def referenceSequences(bam_fn):
header = subprocess.check_output([sambamba, "view", "-H", bam_fn,
... |
seewindcn/tortoisehg | src/hgext/relink.py | # Mercurial extension to provide 'hg relink' command
#
# Copyright (C) 2007 Brendan Cully <brendan@kublai.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
"""recreates hardlinks between repository clones"""
from mercurial imp... |
pjryan126/solid-start-careers | store/api/zillow/venv/lib/python2.7/site-packages/pandas/tests/series/test_alter_axes.py | # coding=utf-8
# pylint: disable-msg=E1101,W0612
import numpy as np
import pandas as pd
from pandas import Index, Series
from pandas.core.index import MultiIndex, RangeIndex
from pandas.compat import lrange, range, zip
from pandas.util.testing import assert_series_equal, assert_frame_equal
import pandas.util.testing... |
mrhubbs/WiiTouch | tests/vectorStretch.py | import sys
import math
import pygame
import time
import subprocess
CASE0 = 0 # A -> A'
CASE1 = 1 # A -> B'
CASE2 = 2 # A -> C'
CASE3 = 3 # A -> D'
mapCase = CASE0
class Vector(object):
def __init__(self, x, y):
self.x = float(x)
self.y = float(y)
def getSlope(self):
return self.y / self.x
# this can be o... |
izrik/wodehouse | tests/functions/str/w_join_tests.py | from unittest import TestCase
from functions.eval import eval_str
from functions.str import w_join
from modules.builtins import create_builtins_module
from wtypes.list import WList
from wtypes.string import WString
class JoinTest(TestCase):
def test_joins_strings_with_delimiter(self):
# when
res... |
malak33/google | logpuzzle.py | #!/usr/bin/python
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
import os
import re
import sys
import urllib
"""Logpuzzle exercise
Given an apache logfile, ... |
buaase/Phylab-Web | PythonExperimentDataHandle/test/P1082.py | import phylab
from math import sqrt
def BiprismSodium(lx,bmin,bmax,loc):
tenx = phylab.DWM(lx)
delta_x = []
for a in tenx:
delta_x.append(a/10.0)
delta_x.append(sum(delta_x)/len(delta_x))
ua_x = phylab.Ua(delta_x, delta_x[len(delta_x)-1], len(delta_x)-1)
ub_x = 0.005/sqrt(3)
u_x = ... |
1905410/Misago | misago/core/migrationutils.py | from .cache import cache as default_cache
from .cachebuster import CACHE_KEY
def _CacheVersion(apps):
return apps.get_model('misago_core', 'CacheVersion')
def cachebuster_register_cache(apps, cache):
_CacheVersion(apps).objects.create(cache=cache)
def cachebuster_unregister_cache(apps, cache):
CacheVe... |
cash/zombie | zombie/game.py | from random import Random
class Board(object):
"""Board dimensions"""
# directions enum
N = 'n'
S = 's'
E = 'e'
W = 'w'
def __init__(self, x_dim, y_dim):
self.x_dim = x_dim
self.y_dim = y_dim
class Position(object):
"""0 based position on the board with origin in SW... |
coremind-oss/ttasm-web-server | allauth/account/views.py | from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.sites.shortcuts import get_current_site
from django.http import (
Http404,
HttpResponsePermanentRedirect,
HttpResponseRedirect,
)
from django.shortcuts import redirect
from django.utils.decorato... |
3dfxsoftware/cbss-addons | report_aeroo/report.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2014 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... |
libo/Enigma2 | lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py | # -*- coding: iso-8859-1 -*-
from enigma import eConsoleAppContainer
from Components.Console import Console
from Components.About import about
from Components.DreamInfoHandler import DreamInfoHandler
from Components.Language import language
from Components.Sources.List import List
from Components.Ipkg import IpkgCompon... |
stevemarple/AuroraWatchNet | software/server/aurorawatchnet/message.py | # -*- coding: iso-8859-15 -*-
# import datetime
from datetime import datetime
import hmac
import math
import six
import struct
import time
import aurorawatchnet.eeprom as eeprom
__all__ = ['validate_packet']
SECONDS_PER_AVG_YEAR = (365 * 86400) + (86400/4) # 365.25 days
default_magic = 'AW'
default_version = 1
he... |
ANR-COMPASS/shesha | data/par/par4bench/scao_sh_64x64_8pix.py | import shesha.config as conf
simul_name = "bench_scao_sh_64x64_8pix"
# loop
p_loop = conf.Param_loop()
p_loop.set_niter(5000)
p_loop.set_ittime(0.002) # =1/500
# geom
p_geom = conf.Param_geom()
p_geom.set_zenithangle(0.)
# tel
p_tel = conf.Param_tel()
p_tel.set_diam(32.0)
p_tel.set_cobs(0.12)
# atmos
p_atmos =... |
vdrhtc/Measurement-automation | lib/script_qubit_2tone.py |
from measurements import parametric_sweep as ps
try:
pna.set_average(True)
pna.set_bandwidth(100)
pna.set_averages(3)
pna.set_nop(1)
pna.set_power(-35)
pna.get_all()
pna.set_centerfreq(5.2682e9)
pna.set_span(1e6)
lo.set_power(-5)
lo.set_status(1)
#lo.set_frequenc... |
Ictp/indico | indico/MaKaC/webinterface/materialFactories.py | # -*- coding: utf-8 -*-
##
##
## This file is part of Indico.
## Copyright (C) 2002 - 2014 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; eith... |
entrepidea/projects | python/lab/bigdata/twitter_spark_client.py | from pyspark import SparkConf, SparkContext
from pyspark.streaming import StreamingContext
from pyspark.sql import Row, SQLContext
import sys
import requests
def get_sql_context_instance(spark_context):
if ('sqlContextSingletonInstance' not in globals()):
globals()['sqlContextSingletonInstance'] = SQLCont... |
alirizakeles/tendenci | docs/source/conf.py | # -*- coding: utf-8 -*-
#
# Tendenci documentation build configuration file, created by
# sphinx-quickstart on Thu Apr 5 08:47:04 2012.
#
# 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
# autogenerated file.
#
# Al... |
HIGHWAY99/plugin.video.theanimehighway | videolinks2.py | ### ############################################################################################################
### #
### # Project: # videolinks - by The Highway 2013.
### # Author: # The Highway
### # Version: # 2.x (ever changing)
### # Description: # My collection of tools for metadata and video url ... |
Lujeni/ansible | lib/ansible/modules/cloud/amazon/aws_direct_connect_virtual_interface.py | #!/usr/bin/python
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['pre... |
ArteliaTelemac/PostTelemac | tests/caduc/swwparsertest.py | # -*- coding: utf-8 -*-
"""
/***************************************************************************
PostTelemac
A QGIS plugin
Post Traitment or Telemac
-------------------
begin : 2015-07-07
git sha : $For... |
thcrock/map-matching-visualizer | core/matchers/base.py | import abc
class BaseMatcher(object):
__metaclass__ = abc.ABCMeta
_output = None
_nodes = None
def __init__(self, raw_coords, radiuses=None):
self.raw_coords = raw_coords
self.radiuses = radiuses
@property
def nodes(self):
self._nodes = self._nodes or self._generate_n... |
erudit/zenon | eruditorg/apps/userspace/journal/views.py | import mimetypes
import os
from collections import defaultdict
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.core.exceptions import PermissionDenied
from django.urls import reverse
from django.http import HttpResponse, Http404
from django.views.generic import Redire... |
hknyldz/pisitools | pisilinux/pisilinux/signalhandler.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2006, TUBITAK/UEKAE
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# Plea... |
Ventrosky/python-scripts | nlp-scripts/ngram.py | # -*- coding: utf-8 -*-
from pprint import pprint
import sys, nltk, codecs, json
from nltk.tokenize import TweetTokenizer
def estraiTokens(frasi):
tokensTOT = []
lenMedia = 0
for frase in frasi:
tokens = nltk.word_tokenize(frase)
tokensTOT = tokensTOT + tokens
lenMedia = lenMedia ... |
kdhansen/roburoc4 | viconToGps/nodes/listener.py | #!/usr/bin/env python
import roslib; roslib.load_manifest('viconToGps')
import rospy
from std_msgs.msg import String # this has to go
from sensor_msgs.msg import NavSatFix
from sensor_msgs.msg import NavSatStatus
#baga subscriberu in talker si you're done with it, fara spin si alte prostii. :D
def callback(data):
... |
dylanbstorey/angreal | angreal/compat.py | """
angreal.compat
~~~~~~~~~~~~~~
Utilities for checking compatibility between an angreal template and the executor
"""
import os
import semver
import angreal
from angreal.utils import get_angreal_path
def is_compat(template_semver):
"""
Compare a sematic version against `angeral.__version__`... |
WillBickerstaff/pycycle | lib/ui/app.py | #! /usr/bin/env python
# Copyright 2010 Will Bickerstaff
# This file is part of PyCycle.
#
# PyCycle 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 la... |
pwalch/football-stats | code/api/match_definitions.py | # Actual match API
from enum import Enum
import json
from datetime import date
class Minute:
def __init__(self, minuteObject):
self._normal = minuteObject['normal']
self._added = minuteObject['added']
def getNormal(self):
return self._normal
def getAdded(self):
return sel... |
miracle2k/vandelay | src/vandelib/nodes.py | class Node(object):
"""The mother of all nodes.
"""
# The name of the node.
name = None
# Simple builtin argument validation for nodes.
valid_keys = None
valid_args = None
allow_children = False
@classmethod
def configure(self, values):
"""Run once the first time a nod... |
MarcJenningsUK/SensorPlatform | python/Sensor.py | import time
import decimal
import RPi.GPIO as GPIO
import Adafruit_SSD1306
import urllib2
import HTU21DF
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
RST = 4
disp = Adafruit_SSD1306.SSD1306_128_64(rst=RST, i2c_address=0x3d)
disp.begin()
width = disp.width
height = disp.height
buttonpin = ... |
roman-dvorak/SolarForecast | realTimeAnalyser/src/gui.py | import sys
import LiveSJ
try:
import pygtk
pygtk.require("2.0")
import gtk
except:
print "Error: PyGTK and GTK 2.xx must be installed to run this application. Exiting"
sys.exit(1)
class prvni_okno(gtk.Window):
def __init__(self):
gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
#... |
kalyi/TexWithPython | src/texpy/latexdocument.py | #!/usr/bin/env python3
# -*- coding: utf8; -*-
#
# Copyright (C) 2016 : Kathrin Hanauer
#
# This file is part of texpy (TexWithPython).
#
# 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... |
pcolmant/repanier | repanier/rest/lut.py | from django.http import HttpResponse, JsonResponse
from django.views.decorators.csrf import csrf_exempt
from repanier.models.lut import LUT_DepartmentForCustomer
from rest_framework import serializers
class DepartmentForCustomerSerializer(serializers.ModelSerializer):
class Meta:
model = LUT_DepartmentFor... |
cbitstech/Purple-Robot-Django | formatters/builtin_applicationlaunchprobe.py | # pylint: disable=line-too-long, unused-argument
import json
def format_reading(probe_name, json_payload):
item = json.loads(json_payload)
app = item['CURRENT_APP_NAME']
category = item['CURRENT_CATEGORY']
return app + ' (' + category + ')'
def visualize(probe_name, readings):
return ''
#
# ... |
zhanglab/psamm | psamm/commands/psammotate.py | # This file is part of PSAMM.
#
# PSAMM 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.
#
# PSAMM is distributed in the hope that it wi... |
Eveler/libs | __Python__/ufms_blanks/appy3/shared/sap.py | '''This module allows to call RFC functions exposed by a distant SAP system.
It requires the "pysap" module available at http://pysaprfc.sourceforge.net
and the library librfccm.so that one can download from the "SAP MarketPlace",
a website by SAP requiring a login/password.'''
# -----------------------------... |
danieldmm/minerva | evaluation_runs/thesis_chapter5_test_aac.py | # Reimplementation of the equivalent ACL14 experiments for Chapter 3 of thesis
#
# Copyright: (c) Daniel Duma 2016-18
# Author: Daniel Duma <danielduma@gmail.com>
# For license information, see LICENSE.TXT
from __future__ import print_function
from __future__ import absolute_import
from evaluation.experiment imp... |
kakaiu/codeTracker | git/user/Get_Info/main.py | import json
import os
import time
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from Get_Info import get_info_git as gt
from Get_Info import get_info_stackoverflow as st
Info_path = sys.path[0] + "/Info"
print(Info_path)
if not os.path.exists(Info_path):
os.mkdir(Info_pa... |
larsks/cloud-init | cloudinit/config/cc_rh_subscription.py | # Copyright (C) 2015 Red Hat, Inc.
#
# Author: Brent Baude <bbaude@redhat.com>
#
# This file is part of cloud-init. See LICENSE file for license information.
"""
RedHat Subscription
-------------------
**Summary:** register red hat enterprise linux based system
Register a RedHat system either by username and password... |
superdachs/libroary | libroary/inventory/migrations/0007_auto_20160612_0224.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-12 02:24
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('inventory', '0006_auto_20160611_1535'),
]
operations = [
migrations.RemoveFi... |
warwick-one-metre/opsd | warwick/observatory/operations/schedule.py | #
# This file is part of opsd.
#
# opsd 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.
#
# opsd is distributed in the hope that it wil... |
guardicore/monkey | monkey/monkey_island/cc/services/attack/technique_reports/__init__.py | import abc
import logging
from typing import Dict, List
from common.utils.attack_utils import ScanStatus
from common.utils.code_utils import abstractstatic
from monkey_island.cc.database import mongo
from monkey_island.cc.models.attack.attack_mitigations import AttackMitigations
from monkey_island.cc.services.config_s... |
DomDomPow/snapventure | snapventure-backend/snapventure/migrations/0020_journey_slug.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-22 11:40
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('snapventure', '0019_auto_20161221_2033'),
]
operations... |
catmaid/CATMAID | django/applications/catmaid/control/project.py | # -*- coding: utf-8 -*-
import json
from typing import Any, Dict, List, Optional, Tuple
import yaml
from typing import Set
from guardian.shortcuts import (assign_perm, get_objects_for_user, get_perms_for_model)
from django.db import connection
from django.db.models import Exists, OuterRef
from django.http import Htt... |
KaviMD/Quantum | Quantum-Computation/QuantumGates.py | # Quantum Gates Library
# Import necessary libraries
import math
import cmath
import random
import numpy as np
# Function to flip a bit
def flipBit(num, bit):
# num -- the number whose bit gets flipped
# bit -- the bit that gets flipped
mask = 1 << (bit) # generate a mask for bit
return num ^ mask # XOR the mask ... |
PetrPPetrov/beautiful-capi | source/ParseRoot.py | #!/usr/bin/env python
#
# Beautiful Capi generates beautiful C API wrappers for your C++ classes
# Copyright (C) 2016 Petr Petrovich Petrov
#
# This file is part of Beautiful Capi.
#
# Beautiful Capi is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publis... |
arcoslab/arcospyu | lib/arcospyu/dprint/dprint.py | # -*- coding: utf-8 -*-
# Copyright (c) 2013 Federico Ruiz-Ugalde
# Author: Federico Ruiz Ugalde <memeruiz at gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the... |
lizardsystem/lizard-rijnmond | lizard_rijnmond/layers.py | # (c) Nelen & Schuurmans. GPL licensed, see LICENSE.txt.
import logging
from django.conf import settings
from django.contrib.gis.geos import Point
from django.contrib.gis.measure import D
from lizard_map import coordinates
from lizard_map.workspace import WorkspaceItemAdapter
import mapnik
from lizard_rijnmond.model... |
sumanthjamadagni/OZ_Examples | DPD_attractive/Get_Spinodal.py | import pyoz as oz
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from scipy.optimize import newton
import sys
from scipy.integrate import simps
#My own module
import Functions
FS = 15
matplotlib.rc('xtick', labelsize=FS)
matplotlib.rc('ytick', labelsize=FS)
dpd_att = oz.System()
r = dpd_att.r
k ... |
UCSD-AUVSI/Heimdall | Recognition/ColorClassifier/PythonColorClassifier/ColorClassifier/Python/get_add_random.py | from PIL import Image, ImageTk
import cv2
import math
import numpy as np
import pickle
import sys
COLOR_TO_NUMBER = {"White":1,"Black":2,"Red":3,"Orange":4,"Yellow":5,"Blue":6,"Green":7,"Purple":8,"Pink":9,"Brown":10,"Grey":11,"Teal":12}
def bgr_to_lab(bgr):
#create blank image 1x1 pixel
blank_image=np.zeros((1,1,3... |
Diacamma2/financial | diacamma/accounting/tools_reports.py | # -*- coding: utf-8 -*-
'''
Describe report accounting viewer for Django
@author: Laurent GAY
@organization: sd-libre.fr
@contact: info@sd-libre.fr
@copyright: 2015 sd-libre.fr
@license: This file is part of Lucterios.
Lucterios is free software: you can redistribute it and/or modify
it under the terms of the GNU Gen... |
freehal/boinc-freehal | py/Boinc/db_base.py | ## $Id: db_base.py 18258 2009-06-02 04:07:53Z davea $
# quarl 2003-10-16 initial version based on conglomeration of
# coursesurvey/database.py and boinc/database.py
# quarl 2003-10-16 implemented lazy lookups
# DB_BASE - an awesome view of an SQL database in Python. All relational
# objects are laz... |
2014c2g5/2014cadp | wsgi/local_data/brython_programs/sorted1.py | '''Python 3 串列資料(List)的應用
1. 了解何謂串列資料 (List)
[1, 2, 3] 以中括號圈起, 逗點隔開的群組資料, 就是串列資料
[1, 2, 3, "資料"] 也是串列資料
若 變數 = [1, 2, 3] 則 變數[0] = 1, 變數[1] = 2,
表示串列的序號由 0 開始
串列資料的次序可以重新排列, 也可以排序.
>>> sorted([3, 1, 2])
[1, 2, 3]
也可以反向排序
>>> sorted([3, 1, 2], reverse=True)
[3, 2, 1]
有關串列 (List) 的用法, 請參照 python3教材_2.pdf,
第 4 頁~第 ... |
anonion0/nsec3map | johnify.py | #!/usr/bin/env python
import sys
import os
from n3map import log
from n3map import rrfile
from n3map import util
from n3map.exception import N3MapError
def usage(argv):
sys.stderr.write("usage: " + os.path.basename(argv[0]) + " file [outfile]\n")
sys.exit(2)
def main(argv):
log.logger = log.Logger()
... |
KelSolaar/Foundations | utilities/sanitizer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
**sanitizer.py**
**Platform:**
Windows, Linux, Mac Os X.
**Description:**
Sanitizes python module file. :func:`bleach` definition is called by **Oncilla** package.
**Others:**
"""
from __future__ import unicode_literals
import re
import foundations.verbo... |
ganga-devs/ganga | ganga/GangaCore/old_test/Internals/TestShell/kill_test.py | #!/usr/bin/env python
import sys
import signal
import time
duration = int(sys.argv[1])
ignore_term = bool(int(sys.argv[2]))
print('duration %s, ignore SIGTERM %s' % (duration, ignore_term))
if ignore_term:
def handler(signum, frame):
print('Signal handler called with signal', signum)
# just ingore... |
gsvaldes/tequio | contacts/models.py | import uuid
from django.db import models
from users.models import TequioUser
class Address(models.Model):
"""Address"""
address = models.CharField(max_length=100, blank=True)
city = models.CharField(max_length=100, blank=True)
state = models.CharField(max_length=100, blank=True)
zip_code = models... |
jackey-qiu/genx_pc_qiu | scripts/genx_script_standard_RAXS_CTR_beta2.py | import models.sxrd_new1 as model
import models.raxs as model2
from models.utils import UserVars
from datetime import datetime
import numpy as np
import sys,pickle,__main__,os
import batchfile.locate_path as batch_path
import dump_files.locate_path as output_path
import models.domain_creator as domain_creator
i... |
yujikato/DIRAC | src/DIRAC/ResourceStatusSystem/Agent/SummarizeLogsAgent.py | """ SummarizeLogsAgent module
This agents scans all the log tables (SiteLog, ResourceLog and NodeLog) on the
ResourceStatusDB and summarizes them. The results are stored on the History
tables (SiteHistory, ResourceHistory and NodeHistory) and the Log tables
cleared.
In order to summarize the logs, all entri... |
lypnol/adventofcode-2016 | day-18/part-1/ayoub.py | from submission import Submission
class AyoubSubmission(Submission):
def author(self):
return 'Ayoub'
def run(self, s):
s = s.rstrip()
N = 40
row = s
def is_safe(x, y, z):
if x == '^' and y == '.' and z == '.':
return False
if ... |
kfoltman/calfbox | jack_api_example.py | from calfbox import cbox
import time
def cmd_dumper(cmd, fb, args):
print ("%s(%s)" % (cmd, ",".join(list(map(repr,args)))))
cbox.init_engine()
cbox.Config.add_section("drumpattern:pat1", """
title=Straight - Verse
beats=4
track1=bd
track2=sd
track3=hh
track4=ho
bd_note=c1
sd_note=d1
hh_note=f#1
ho_note=a#1
bd_t... |
arashzamani/lstm_nlg_ver1 | test_cases/structure_generation.py | import collections
import numpy
import sys
from keras.layers import Embedding, Input, Dropout, Dense, Merge, Activation
from keras.layers.wrappers import TimeDistributed
from keras.layers.recurrent import GRU, LSTM
from keras.layers.core import RepeatVector
from keras.models import Sequential
from keras.utils import n... |
virtualnobi/MediaFiler | Model/MediaOrganization/OrganizationByName.py | # -*- coding: latin-1 -*-
"""(c) by nobisoft 2015-
"""
# Imports
## Standard
import copy
import re
import os.path
import glob
#import StringIO
import logging
import gettext
from collections import OrderedDict
import functools
## Contributed
#import wx
import wx.lib.masked
## nobi
from nobi.wx.Menu import Menu
from n... |
diffdibb/diffdibb | diffdibb/config.py | # -*- coding: utf-8 -*-
#
# diffdibb : tools to audit databases.
#
# Copyright (C) 2015, diffdibb
# https://github.com/diffdibb
#
# 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... |
kmiernik/Pyspectr | Pyspectr/decay_fitter.py | #!/usr/bin/env python3
"""K. Miernik 2012
k.a.miernik@gmail.com
Distributed under GNU General Public Licence v3
This module provides class to fit grow-in/decay functions
(Bateman equation solution and more)
"""
import math
import numpy
from lmfit import minimize, Parameters, report_errors
class DecayFitter:
d... |
Ebag333/Pyfa | gui/sfBrowserItem.py | import wx
import gui.utils.drawUtils as drawUtils
SB_ITEM_NORMAL = 0
SB_ITEM_SELECTED = 1
SB_ITEM_HIGHLIGHTED = 2
SB_ITEM_DISABLED = 4
BTN_NORMAL = 1
BTN_PRESSED = 2
BTN_HOVER = 4
BTN_DISABLED = 8
class PFBaseButton(object):
def __init__(self, normalBitmap=wx.NullBitmap, label="", callback=None, hoverBitmap=Non... |
Iconik/eve-suite | src/model/static/inv/meta_type.py | from model.flyweight import Flyweight
from model.static.database import database
class MetaType(Flyweight):
def __init__(self,type_id):
#prevents reinitializing
if "_inited" in self.__dict__:
return
self._inited = None
#prevents reinitializing
self.type_id = typ... |
ijat/Hotspot-PUTRA-Auto-login | PyInstaller-3.2/tests/functional/test_path_encodings.py | # -*- coding: utf-8 -*-
#-----------------------------------------------------------------------------
# Copyright (c) 2005-2016, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt,... |
Shureed/mimircache | mimircache/cache/MRU.py | import sys
import os
import abc
from collections import deque
from mimircache.cache.abstractCache import cache
class MRU(cache):
def __init__(self, cache_size=1000):
super(MRU, self).__init__(cache_size)
self.cacheDict = dict()
self.last_element = None
def checkElement(self, element)... |
MachineLearningControl/OpenMLC-Python | MLC/GUI/mlc_gui.py | # -*- coding: utf-8 -*-
# MLC (Machine Learning Control): A genetic algorithm library to solve chaotic problems
# Copyright (C) 2015-2017, Thomas Duriez (thomas.duriez@gmail.com)
# Copyright (C) 2015, Adrian Durán (adrianmdu@gmail.com)
# Copyright (C) 2015-2017, Ezequiel Torres Feyuk (ezequiel.torresfeyuk@gmail.com)
# ... |
martinling/libsigrokdecode | decoders/rtc8564/pd.py | ##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2012 Uwe Hermann <uwe@hermann-uwe.de>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the Li... |
adamdempsey90/fargo3d | scripts/make.py | #!/usr/bin/env python
import re
import sys
import os
"""
Warning: Do not forget to include all the new flags in the .defaulflags file.
"""
BIN = "bin"
try:
os.chdir(BIN) #We are in the bin Folder. All references are from here.
except OSError:
os.system("mkdir bin")
os.chdir(B... |
adrianschroeter/kiwi | kiwi/tasks/system_build.py | # Copyright (c) 2015 SUSE Linux GmbH. All rights reserved.
#
# This file is part of kiwi.
#
# kiwi 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 la... |
lucamassarelli/AMFC-BRCT | core/AndroidToolInterface.py | #Copyright (C) 2017 Luca Massarelli
#
#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
# any later version.
#This program is distributed in the hope that it wil... |
mmgen/mmgen | mmgen/crypto.py | #!/usr/bin/env python3
#
# mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution
# Copyright (C)2013-2022 The MMGen Project <mmgen@tuta.io>
#
# 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 Softwa... |
alexellis/explorerrobot | part4/follow_light/follow.py | import explorerhat
import time
from ultrasonic import *
dm = distanceMeasure(6, 23)
dm.setup()
def evade(cm):
while(cm < 20):
explorerhat.motor.two.backwards(0.5*100)
explorerhat.motor.one.backwards(0.5*100)
time.sleep(0.6)
explorerhat.motor.two.forwards(0.5*100)
exp... |
wolfram2012/nimo | perception/ros_track_ssd/scripts/pyvision/types/img.py | # PyVision License
#
# Copyright (c) 2006-2009 David S. Bolme
# 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
# notice, thi... |
ArteliaTelemac/PostTelemac | PostTelemac/meshlayerparsers/libs_telemac/utilstelemac/partitioning.py | """@author Sebastien E. Bourban
"""
"""@note ... this work is based on a collaborative effort between
.________. ,--.
| | . ( (
|,-. / HR Wallingford EDF - LNHE / \_... |
hgsoft/hgsoft-addons | custom_invoice_eletronic_v11/models/invoice_eletronic.py | # -*- coding: utf-8 -*-
from odoo.exceptions import UserError
from odoo import models, fields, api
import logging
class customInvoiceEletronic(models.Model):
_inherit = 'invoice.eletronic'
cfop_code = fields.Char('cfop_code')
@api.multi
def create(self, vals):
new_invoice_eletro... |
burakbayramli/kod | nomadicterrain/sql/tst5.py | import json, sqlite3, os
import numpy as np
import pandas as pd
SROWS = 40000
connmain = sqlite3.connect('/media/burak/Seagate Backup Plus Drive/archive/data/campdata/elev.db')
conn1 = sqlite3.connect('/home/burak/Downloads/campdata/elev4.db')
longmin,latmin,longmax,latmax = 16.967,45.5,26.5,49.85
print (longmin,la... |
lcastrol/ale_dqn_two_players | q_network.py | """
Code for deep Q-learning as described in:
Playing Atari with Deep Reinforcement Learning
NIPS Deep Learning Workshop 2013
and
Human-level control through deep reinforcement learning.
Nature, 518(7540):529-533, February 2015
Author of Lasagne port: Nissan Pow
Modifications: Nathan Sprague
"""
import lasagne
imp... |
KevinOConnor/klipper | klippy/extras/tuning_tower.py | # Helper script to adjust parameters based on Z level
#
# Copyright (C) 2019 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import math, logging
CANCEL_Z_DELTA=2.0
class TuningTower:
def __init__(self, config):
self.printer = config.get_prin... |
YUNZHONGTAN/MY_Python_script | test/socket/socket_server.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
import time
import socket
def Server():
SOCKET_FAMILY = socket.AF_INET
SOCKET_TYPE = socket.SOCK_STREAM
sockServer = socket.socket(SOCKET_FAMILY, SOCKET_TYPE)
sockServer.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
sockServer.bi... |
olethanh/django-phpbb | phpbb/bbcode_unittest.py | # -*- coding: utf-8 -*-
# This file is part of django-phpbb, integration between Django and phpBB
# Copyright (C) 2007-2008 Maciej Bliziński
#
# django-phpbb 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; e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.