code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# originally from
# http://code.google.com/p/django-syncr/source/browse/trunk/app/delicious.py
# supousse django-syncr should be installed as external app and this code
# inherit from that, but django-syncr have not a setup.py file (so can't be
# added in src/pinax/requirements/external_apps.txt) and is not migrate... | duy/pinax-syncr-delicious | delicious/delicious.py | Python | gpl-3.0 | 8,100 |
"""
Module to handle distortions in diffraction patterns.
"""
import numpy as np
import scipy.optimize
def filter_ring(points, center, rminmax):
"""Filter points to be in a certain radial distance range from center.
Parameters
----------
points : np.ndarray
Candidate points.
... | ercius/openNCEM | ncempy/algo/distortion.py | Python | gpl-3.0 | 8,278 |
#!/usr/bin/env python
# coding=utf-8
import flask
from flask import flash
from flask_login import login_required
from rpress.models import SiteSetting
from rpress.database import db
from rpress.runtimes.rpadmin.template import render_template, navbar
from rpress.runtimes.current_session import get_current_site, get_... | rexzhang/rpress | rpress/views/rpadmin/settings.py | Python | gpl-3.0 | 1,428 |
from __future__ import unicode_literals
from __future__ import absolute_import
from django.views.generic.base import TemplateResponseMixin
from wiki.core.plugins import registry
from wiki.conf import settings
class ArticleMixin(TemplateResponseMixin):
"""A mixin that receives an article object as a parameter (u... | Infernion/django-wiki | wiki/views/mixins.py | Python | gpl-3.0 | 1,668 |
import game as game
import pytest
import sys
sys.path.insert(0, '..')
def trim_board(ascii_board):
return '\n'.join([i.strip() for i in ascii_board.splitlines()])
t = trim_board
def test_new_board():
game.Board(3,3).ascii() == t("""
...
...
...
""")
game.Board(4,3).ascii() == t("""
.... | fweidemann14/x-gewinnt | game/test_game.py | Python | gpl-3.0 | 3,095 |
"""
A mode for working with Circuit Python boards.
Copyright (c) 2015-2017 Nicholas H.Tollervey and others (see the AUTHORS file).
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... | carlosperate/mu | mu/modes/circuitpython.py | Python | gpl-3.0 | 10,028 |
import os
from collections import defaultdict
from django.conf import settings
from django.contrib import messages
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from django.core.urlresolvers import reverse
from django.db.models import Count, Q
from django.http import HttpResponseRedirect, Http404... | mPowering/django-orb | orb/views.py | Python | gpl-3.0 | 30,008 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2012 Tuukka Turto
#
# This file is part of satin-python.
#
# pyherc 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 ... | tuturto/satin-python | satin/label.py | Python | gpl-3.0 | 2,211 |
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
from django.contrib.contenttypes.models import ContentType
from django.db import models
from base.models import ModelloSemplice
from base.tratti import ConMarcaTemporale
class Giudizio(ModelloSemplice, ConMarcaTemporale):
"""
R... | CroceRossaItaliana/jorvik | social/models.py | Python | gpl-3.0 | 4,591 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 Taifxx
#
# 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.... | Taifxx/xxtrep | context.addtolib/resources/lib/ext/li2_.py | Python | gpl-3.0 | 6,356 |
#!/usr/bin/env python
import argparse
from . import core
from . import gui
def main():
parser = argparse.ArgumentParser(
description="Track opponent's mulligan in the game of Hearthstone.")
parser.add_argument('--gui', action='store_true')
args = parser.parse_args()
if args.gui:
gui.m... | xor7486/mully | mully/__main__.py | Python | gpl-3.0 | 396 |
from api.callers.api_caller import ApiCaller
from exceptions import ResponseTextContentTypeError
from colors import Color
import os
from cli.arguments_builders.default_cli_arguments import DefaultCliArguments
import datetime
from cli.cli_file_writer import CliFileWriter
from cli.formatter.cli_json_formatter import CliJ... | PayloadSecurity/VxAPI | cli/wrappers/cli_caller.py | Python | gpl-3.0 | 6,741 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# 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 ... | mcldev/geonode | geonode/security/views.py | Python | gpl-3.0 | 9,784 |
from elasticsearch import Elasticsearch
from django.conf import settings
def get_es_client(silent=False):
"""
Returns the elasticsearch client which uses the configuration file
"""
es_client = Elasticsearch([settings.ELASTIC_SEARCH_HOST],
scheme='http',
... | fako/datascope | src/online_discourse/elastic.py | Python | gpl-3.0 | 1,813 |
#-------------------------------------------------------------------------------
# Name: MissingPersomForm.py
#
# Purpose: Create Missing Person Flyer from data stored in the Subject
# Information data layer within MapSAR
#
# Author: Don Ferguson
#
# Created: 12/12/2011
# Copyright: (... | dferguso/IGT4SAR | MissingPersonForm.py | Python | gpl-3.0 | 6,940 |
from kivy.lib import osc
from time import sleep
import pocketclient
from kivy.utils import platform as kivy_platform
SERVICE_PORT = 4000
def platform():
p = kivy_platform()
if p.lower() in ('linux', 'waindows', 'osx'):
return 'desktop'
else:
return p
class Service(object):
def __ini... | tshirtman/kpritz | service/main.py | Python | gpl-3.0 | 1,497 |
import cv2
import numpy as np
import datetime as dt
# constant
faceCascade = cv2.CascadeClassifier('haarcascade_frontalface_alt.xml')
OPENCV_METHODS = {
"Correlation": 0,
"Chi-Squared": 1,
"Intersection": 2,
"Hellinger": 3}
hist_limit = 0.6
ttl = 1 * 60
q_limit = 3
# init variables
total_count = 0
pre... | kvasnyj/face_counter | counter.py | Python | gpl-3.0 | 2,444 |
#!python
# log/urls.py
from django.conf.urls import url
from . import views
# We are adding a URL called /home
urlpatterns = [
url(r'^$', views.home, name='home'),
url(r'^clients/$', views.clients, name='clients'),
url(r'^clients/(?P<id>\d+)/$', views.client_detail, name='client_detail'),
url(r'^clie... | alexeyshulzhenko/OBDZ_Project | OnlineAgecy/urls.py | Python | gpl-3.0 | 3,927 |
from __future__ import division, print_function, absolute_import
import unittest
from .. import common
import tempfile
import os
import platform
import numpy as num
from pyrocko import util, model
from pyrocko.pile import make_pile
from pyrocko import config, trace
if common.have_gui(): # noqa
from pyrocko.gui.... | pyrocko/pyrocko | test/gui/test_gui.py | Python | gpl-3.0 | 15,550 |
#!/usr/bin/python
# bigcinemas
class InvalidAge(Exception):
def __init__(self,age):
self.age = age
def validate_age(age):
if age < 18:
raise InvalidAge(age)
else:
return "Welcome to the movies!!"
age = int(raw_input("please enter your age:"))
#print validate_age(age)
try:
validate_age(age)
# except Exc... | tuxfux-hlp-notes/python-batches | archieves/batch-64/14-oop/sixth.py | Python | gpl-3.0 | 462 |
# Copyright 2015 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... | dpaschall/test_TensorFlow | bin/cifar10test/cifar10_train.py | Python | gpl-3.0 | 4,167 |
from django.apps import AppConfig
class CirculoConfig(AppConfig):
name = 'circulo'
| jstitch/gift_circle | GiftCircle/circulo/apps.py | Python | gpl-3.0 | 89 |
# Generated by Django 2.2 on 2019-06-20 09:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('scoping', '0294_titlevecmodel'),
]
operations = [
migrations.AddField(
model_name='doc',
name='tslug',
fie... | mcallaghan/tmv | BasicBrowser/scoping/migrations/0295_doc_tslug.py | Python | gpl-3.0 | 369 |
# This Python file uses the following encoding: utf-8
"""autogenerated by genpy from tf2_msgs/FrameGraphRequest.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
class FrameGraphRequest(genpy.Message):
_md5sum = "d41d8cd98f00b204e9800998ecf8427e"
_... | UnbDroid/robomagellan | Codigos/Raspberry/desenvolvimentoRos/devel/lib/python2.7/dist-packages/tf2_msgs/srv/_FrameGraph.py | Python | gpl-3.0 | 7,187 |
import re
CJDNS_IP_REGEX = re.compile(r'^fc[0-9a-f]{2}(:[0-9a-f]{4}){7}$', re.IGNORECASE)
class Node(object):
def __init__(self, ip, version=None, label=None):
if not valid_cjdns_ip(ip):
raise ValueError('Invalid IP address')
if not valid_version(version):
raise ValueErro... | vdloo/raptiformica-map | raptiformica_map/graph.py | Python | gpl-3.0 | 1,111 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014-2016 Alberto Gacías <alberto@migasfree.org>
# Copyright (c) 2015-2016 Jose Antonio Chavarría <jachavar@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 publish... | migasfree/migasfree-launcher | migasfree_indicator/console.py | Python | gpl-3.0 | 2,190 |
import numpy as np
import matplotlib.pyplot as plt
import spm1d
#(0) Load dataset:
dataset = spm1d.data.mv1d.cca.Dorn2012()
y,x = dataset.get_data() #A:slow, B:fast
#(1) Conduct non-parametric test:
np.random.seed(0)
alpha = 0.05
two_tailed = False
snpm = spm1d.stats.nonparam.cca(y, x)... | 0todd0000/spm1d | spm1d/examples/nonparam/1d/ex_cca.py | Python | gpl-3.0 | 860 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Question.order'
db.add_column(u'survey_question', 'order',
self.gf('dj... | point97/hapifis | server/apps/survey/migrations/0020_auto__add_field_question_order.py | Python | gpl-3.0 | 4,857 |
#!/usr/bin/env python
##################################################
# Gnuradio Python Flow Graph
# Title: Clock offset corrector
# Author: Piotr Krysik
# Generated: Wed Nov 19 08:38:40 2014
##################################################
from gnuradio import blocks
from gnuradio import filter
from gnuradio imp... | martinjlowm/gr-gsm | python/misc_utils/clock_offset_corrector.py | Python | gpl-3.0 | 4,498 |
#!/usr/bin/python
import numpy as np
mdir = "mesh3d/"
fname = "out_p6-p4-p8"
####################
print "input mesh data file"
f1 = open(mdir+fname+".mesh", 'r')
for line in f1:
if line.startswith("Vertices"): break
pcount = int(f1.next())
xyz = np.empty((pcount, 3), dtype=np.float)
for t in range(pcount):
xyz... | jrugis/cell_mesh | mesh2vtk.py | Python | gpl-3.0 | 2,909 |
#
# GeoCoon - GIS data analysis library based on Pandas and Shapely
#
# Copyright (C) 2014 by Artur Wroblewski <wrobell@pld-linux.org>
#
# 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 ve... | wrobell/geocoon | geocoon/tests/test_sql.py | Python | gpl-3.0 | 1,771 |
import csv
import decimal
import os
import datetime
from stocker.common.events import EventStreamNew, EventStockOpen, EventStockClose
from stocker.common.orders import OrderBuy, OrderSell
from stocker.common.utils import Stream
class CompanyProcessor(object):
def __init__(self, dirname, company_id):
self.... | donpiekarz/Stocker | stocker/SEP/processor.py | Python | gpl-3.0 | 3,868 |
#! /usr/bin/python
import sys
sys.path.append('../')
from toolbox.hreaders import token_readers as reader
from toolbox.hreducers import list_reducer as reducer
SOLO_FACTURA = False
def reduction(x,y):
v1 = x.split(',')
v2 = y.split(',')
r = x if int(v1[1])>=int(v2[1]) else y
return r
_reader = reader... | xavi783/u-tad | Modulo4/ejercicio3/reducer.py | Python | gpl-3.0 | 915 |
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.rl_config import defaultPageSize
from reportlab.lib.units import cm
import operator
import os
import ConfigParser
import string
config = ConfigP... | andydrop/x17papertrail | abook2pdf.py | Python | gpl-3.0 | 3,106 |
# coding=utf8
r"""
csection.py -- Create a tree of contents, organized by sections and inside
sections the exercises unique_name.
AUTHOR:
- Pedro Cruz (2012-01): initial version
- Pedro Cruz (2016-03): improvment for smc
An exercise could contain um its %summary tag line a description of section
in form:... | jpedroan/megua | megua/csection.py | Python | gpl-3.0 | 10,442 |
# Copyright 2008 Dan Smith <dsmith@danplanet.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 ... | tylert/chirp.hg | chirp/drivers/icf.py | Python | gpl-3.0 | 23,992 |
#! /usr/bin/env python
# I found this file inside Super Mario Bros python
# written by HJ https://sourceforge.net/projects/supermariobrosp/
# the complete work is licensed under GPL3 although I can not determine# license of this file
# maybe this is the original author, we can contact him/her http://www.pygame.org/pro... | juanjosegzl/learningpygame | ezmenu.py | Python | gpl-3.0 | 2,298 |
"""
WSGI config for GoodDog 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.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETT... | sate-z/GoodDog | GoodDog/wsgi.py | Python | gpl-3.0 | 392 |
#! /usr/bin/env python
"""Keywords (from "graminit.c")
This file is automatically generated; please don't muck it up!
To update the symbols in this file, 'cd' to the top directory of
the python source tree after building the interpreter and run:
python Lib/keyword.py
"""
__all__ = ["iskeyword", "kw... | DarioGT/OMS-PluginXML | org.modelsphere.sms/lib/jython-2.2.1/Lib/keyword.py | Python | gpl-3.0 | 2,162 |
default_app_config = 'users.apps.UserConfig' | emoitzi/django-excel-viewer | users/__init__.py | Python | gpl-3.0 | 44 |
"""Calculate exact solutions for the zero dimensional LLG as given by
[Mallinson2000]
"""
from __future__ import division
from __future__ import absolute_import
from math import sin, cos, tan, log, atan2, acos, pi, sqrt
import scipy as sp
import matplotlib.pyplot as plt
import functools as ft
import simpleode.core.u... | davidshepherd7/Landau-Lifshitz-Gilbert-ODE-model | llg/mallinson.py | Python | gpl-3.0 | 4,251 |
class Sbs:
def __init__(self, sbsFilename, sbc_filename, newSbsFilename):
import xml.etree.ElementTree as ET
import Sbc
self.mySbc = Sbc.Sbc(sbc_filename)
self.sbsTree = ET.parse(sbsFilename)
self.sbsRoot = self.sbsTree.getroot()
self.XSI_TYPE = "{http://www.w3.or... | mccorkle/seds-utils | Sbs.py | Python | gpl-3.0 | 13,196 |
# A template for APSync process based modules
from multiprocessing import Process, Event
import threading
import time
import signal, select
import traceback
import setproctitle
from APSyncFramework.utils.common_utils import PeriodicEvent
from APSyncFramework.utils.json_utils import ping, json_wrap_with_target
from APSy... | SamuelDudley/APSyncWeb | APSyncFramework/modules/lib/APSync_module.py | Python | gpl-3.0 | 4,702 |
# -*- coding: utf-8 -*-
# Dioptas - GUI program for fast processing of 2D X-ray diffraction data
# Principal author: Clemens Prescher (clemens.prescher@gmail.com)
# Copyright (C) 2014-2019 GSECARS, University of Chicago, USA
# Copyright (C) 2015-2018 Institute for Geology and Mineralogy, University of Cologne, Germany
... | Dioptas/Dioptas | dioptas/controller/integration/phase/PhaseInCakeController.py | Python | gpl-3.0 | 5,615 |
# -*- coding: utf-8 -*-
#
# MAVProxy documentation build configuration file, created by
# sphinx-quickstart on Wed Aug 19 05:17:36 2015.
#
# 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.
#
# ... | Georacer/last_letter | documentation/source/conf.py | Python | gpl-3.0 | 11,461 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
An implementation of the time frequency phase misfit and adjoint source after
Fichtner et al. (2008).
:copyright:
Lion Krischer (krischer@geophysik.uni-muenchen.de), 2013
:license:
GNU General Public License, Version 3
(http://www.gnu.org/copyleft/gpl.html)... | Phlos/LASIF_scripts | lasif_code/ad_src_tf_phase_misfit.py | Python | gpl-3.0 | 13,183 |
import json
import random
import requests
from plugin import create_plugin
from message import SteelyMessage
HELP_STR = """
Request your favourite bible quotes, right to the chat.
Usage:
/bible - Random quote
/bible Genesis 1:3 - Specific verse
/bible help - This help text
Verses are specified in th... | sentriz/steely | steely/plugins/bible/main.py | Python | gpl-3.0 | 3,384 |
#!/usr/bin/env python
"""
This program decodes the Motorola SmartNet II trunking protocol from the control channel
Tune it to the control channel center freq, and it'll spit out the decoded packets.
In what format? Who knows.
Based on your AIS decoding software, which is in turn based on the gr-pager code and the... | bistromath/gr-smartnet | src/python/smartnet2decode.py | Python | gpl-3.0 | 13,591 |
# coding: utf-8
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.mixins import UserPassesTestMixin
from django.views.generic import ListView
from django.views import View
from django.db.models import Q
import posgradmin.models as models
from posgradmin import authorization as auth
from... | sostenibilidad-unam/posgrado | posgradmin/posgradmin/views_academico.py | Python | gpl-3.0 | 17,170 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'src/ui/mainwindow.ui'
#
# Created: Fri Feb 15 16:08:54 2013
# by: PyQt4 UI code generator 4.9.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
exce... | itarozzi/classerman | src/ui/mainwindow_ui.py | Python | gpl-3.0 | 16,000 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
import frappe
from frappe.model.document import Document
from frappe.website.utils import delete_page_cache
class Homepage(Document):
def validate(self):
if not self.description:
self.descrip... | mhbu50/erpnext | erpnext/portal/doctype/homepage/homepage.py | Python | gpl-3.0 | 801 |
# (void)walker hardware platform support
# Copyright (C) 2012-2013 David Holm <dholmster@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 License, or
# (at you... | dholm/voidwalker | voidwalker/framework/platform/cpu.py | Python | gpl-3.0 | 3,778 |
# Author: seedboy
# URL: https://github.com/seedboy
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any la... | bcorbet/SickRage | sickbeard/providers/iptorrents.py | Python | gpl-3.0 | 11,284 |
from collections import defaultdict
class Solution(object):
def minWindow(self, S, T):
"""
:type S: str
:type T: str
:rtype: str
"""
pre = defaultdict(list)
for i, c in enumerate(T, -1):
pre[c].append(i)
for val in pre.values():
... | wufangjie/leetcode | 727. Minimum Window Subsequence.py | Python | gpl-3.0 | 1,035 |
from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
url(r'^$', 'webinterface.view.dashboard.main'),
url(r'^dashboard/$', 'webinterface.view.dashboard.main'),
url(r'^login/$', 'webinterface.view.login.main'),
url(r'^login/ajax/$', 'webinterface.view.login.ajax'),
url(r'^s... | cynja/coffeenator | webinterface/urls.py | Python | gpl-3.0 | 551 |
import numpy
class DifferentialEvolutionAbstract:
amount_of_individuals = None
f = None
p = None
end_method = None
def __init__(self, min_element=-1, max_element=1):
self.min_element = min_element
self.max_element = max_element
self.f = 0.5
self.p = 0.9
se... | QuantumTechDevStudio/RUDNEVGAUSS | archive/solver/DifferentialEvolutionAbstract.py | Python | gpl-3.0 | 1,558 |
import pickle
from matplotlib import pyplot as plt
plt.style.use('classic')
import matplotlib as mpl
fs = 12.
fw = 'bold'
mpl.rc('lines', linewidth=2., color='k')
mpl.rc('font', size=fs, weight=fw, family='Arial')
mpl.rc('legend', fontsize='small')
import numpy
def grad( x, u ) :
return numpy.gradient(u) / nu... | matthewpklein/battsimpy | docs/extra_files/electrode_ocv_gen.py | Python | gpl-3.0 | 5,199 |
../../../../share/pyshared/jockey/xorg_driver.py | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/python2.7/dist-packages/jockey/xorg_driver.py | Python | gpl-3.0 | 48 |
"""Holds all pytee logic."""
| KonishchevDmitry/pytee | pytee/__init__.py | Python | gpl-3.0 | 29 |
#!/usr/bin/env python
"""
unit test for filters module
author: Michael Grupp
This file is part of evo (github.com/MichaelGrupp/evo).
evo 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 Li... | MichaelGrupp/evo | test/test_filters.py | Python | gpl-3.0 | 6,476 |
# PiTimer - Python Hardware Programming Education Project For Raspberry Pi
# Copyright (C) 2015 Jason Birch
#
# 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
... | BirchJD/RPiTimer | PiTimer_Step-8/UserInterface.py | Python | gpl-3.0 | 14,823 |
import sys,os
class Solution():
def reverse(self, x):
sign=1
if x<0:
sign=-1
x=x*-1
token=str(x)
str_rev=""
str_len=len(token)
for i in range(str_len):
str_rev+=token[str_len-i-1]
num_rev=int(str_rev)
if sign==1 and ... | urashima9616/Leetcode_Python | leet7.py | Python | gpl-3.0 | 491 |
# -*- coding: utf-8 -*-
__author__ = 'LIWEI240'
"""
Constants definition
"""
class Const(object):
class RetCode(object):
OK = 0
InvalidParam = -1
NotExist = -2
ParseError = -3 | lwldcr/keyboardman | common/const.py | Python | gpl-3.0 | 214 |
# -*- coding: utf-8 -*-
#----------------------------------------------------------------------------
# Menu for quickly adding waypoints when on move
#----------------------------------------------------------------------------
# Copyright 2007-2008, Oliver White
#
# This program is free software: you can redistribute... | ryfx/modrana | modules/_mod_clickMenu.py | Python | gpl-3.0 | 2,761 |
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 17 22:06:52 2017
Based on: print_MODFLOW_inputs_res_NWT.m
@author: gcng
"""
# print_MODFLOW_inputs
import numpy as np
import MODFLOW_NWT_lib as mf # functions to write individual MODFLOW files
import os # os functions
from ConfigParser import SafeConfigParser
parser ... | UMN-Hydro/GSFLOW_pre-processor | python_scripts/MODFLOW_scripts/print_MODFLOW_inputs_res_NWT.py | Python | gpl-3.0 | 3,667 |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2008 Doug Hellmann All rights reserved.
#
"""
"""
__version__ = "$Id$"
#end_pymotw_header
import EasyDialogs
valid_responses = { 1:'yes',
0:'no',
-1:'cancel',
}
response = EasyDialogs.AskYesNoCancel... | qilicun/python | python2/PyMOTW-1.132/PyMOTW/EasyDialogs/EasyDialogs_AskYesNoCancel.py | Python | gpl-3.0 | 390 |
# -----------------------------------------------------------------------------
# Getting Things GNOME! - a personal organizer for the GNOME desktop
# Copyright (c) 2008-2013 - Lionel Dricot & Bertrand Rousseau
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Gene... | getting-things-gnome/gtg | GTG/gtk/backends/backendstree.py | Python | gpl-3.0 | 10,617 |
#要注意 javascript 轉 python 語法差異
#document.getElementById -> doc[]
#module Math -> math
#Math.PI -> math.pi
#abs -> fabs
#array 可用 list代替
import math
import time
from browser import doc
import browser.timer
# 點類別
class Point(object):
# 起始方法
def __init__(self, x, y):
self.x = x
self.y = y
... | 2014c2g5/2014cadp | wsgi/local_data/brython_programs/brython_fourbar1.py | Python | gpl-3.0 | 11,960 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
timeformat='%H:%M:%S'
def begin_banner():
print ''
print '[*] swarm starting at '+time.strftime(timeformat,time.localtime())
print ''
def end_banner():
print ''
print '[*] swarm shutting down at '+time.strftime(timeformat,time.localtime()... | Arvin-X/swarm | lib/utils/banner.py | Python | gpl-3.0 | 334 |
#!/usr/bin/python -Wall
# -*- coding: utf-8 -*-
"""
<div id="content">
<div style="text-align:center;" class="print"><img src="images/print_page_logo.png" alt="projecteuler.net" style="border:none;" /></div>
<h2>Number letter counts</h2><div id="problem_info" class="info"><h3>Problem 17</h3><span>Published on Friday, 1... | beyoungwoo/C_glibc_Sample | _Algorithm/ProjectEuler_python/euler_17.py | Python | gpl-3.0 | 1,631 |
#! /usr/bin/env python
# ==========================================================================
# This scripts performs unit tests for the csiactobs script
#
# Copyright (C) 2016-2018 Juergen Knoedlseder
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General... | ctools/ctools | test/test_csiactobs.py | Python | gpl-3.0 | 13,064 |
# Copyright 2015 Matthew J. Aburn
#
# 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. See <http://www.gnu.org/licenses/>.
... | mattja/sdeint | sdeint/wiener.py | Python | gpl-3.0 | 10,384 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#--------------------------------------------------------------------
# Copyright (c) 2014 Eren Inan Canpolat
# Author: Eren Inan Canpolat <eren.canpolat@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General... | canpolat/bookbinder | bookbinder/templates.py | Python | gpl-3.0 | 2,011 |
# Copyright 2016 Casey Jaymes
# This file is part of PySCAP.
#
# PySCAP 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.
#
# PySCAP is ... | cjaymes/pyscap | src/scap/model/oval_5/defs/windows/Process58TestElement.py | Python | gpl-3.0 | 896 |
def main():
"""Instantiate a DockerStats object and collect stats."""
print('Docker Service Module')
if __name__ == '__main__':
main()
| gomex/docker-zabbix | docker_service/__init__.py | Python | gpl-3.0 | 148 |
# ScratchABit - interactive disassembler
#
# Copyright (c) 2018 Paul Sokolovsky
#
# 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... | pfalcon/ScratchABit | plugins/cpu/arm_32_arm_capstone.py | Python | gpl-3.0 | 891 |
#!/usr/bin/python
"""Perform preprocessing and generate raytrace exec scripts for one focal plane.
For documentation using the python_control for ImSim/PhoSim version <= v.3.0.x,
see README.v3.0.x.txt.
For documentation using the python_control for ImSim/PhoSim version == v.3.2.x,
see README.txt.
The behavior of th... | lsst-sims/sims_phosim_pythoncontrol | fullFocalplane.py | Python | gpl-3.0 | 11,426 |
# Example made by OssiLehtinen
#
from svgpathtools import svg2paths, wsvg
import numpy as np
import uArmRobot
import time
#Configure Serial Port
#serialport = "com3" # for windows
serialport = "/dev/ttyACM0" # for linux like system
# Connect to uArm
myRobot = uArmRobot.robot(serialport,0) # user 0 for ... | AnykeyNL/uArmProPython | svg_example.py | Python | gpl-3.0 | 1,467 |
# -*- coding: utf-8 -*-
# Author: Leo Vidarte <http://nerdlabs.com.ar>
#
# This file is part of lai-client.
#
# lai-client 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.
#
# lai-client is distribut... | lvidarte/lai-client | lai/db/mongo.py | Python | gpl-3.0 | 6,391 |
from matplotlib import pyplot as plt
path = "C:/Temp/mnisterrors/chunk" + str(input("chunk: ")) + ".txt"
with open(path, "r") as f:
errorhistory = [float(line.rstrip('\n')) for line in f]
plt.plot(errorhistory)
plt.show()
| jabumaho/MNIST-neural-network | plot_error.py | Python | gpl-3.0 | 235 |
# We calculate the flatness with the Roche model
# calculate omk knowing omc and vice-versa
from numpy import *
from scipy.optimize import root
# we have to solve a cubic equation a-J2*a**3=1+J2+0.5*omk**2
def eps(omk):
return omk**2/(2+omk**2)
def om_k(omc):
khi=arcsin(omc)
return sqrt(6*sin(khi/3)/omc-2)
omc... | ester-project/ester | postprocessing/Roche.py | Python | gpl-3.0 | 361 |
#!/usr/bin/env python
import sys
import os
output_dir = "erc2-chromatin15state-all-files"
if not os.path.exists(output_dir):
sys.stderr.write("Creating dir [%s]...\n" % (output_dir))
os.makedirs(output_dir)
prefix = "/home/cbreeze/for_Alex"
suffix = "_15_coreMarks_mnemonics.bed"
marks = [ '1_TssA',
... | charlesbreeze/eFORGE | docs/eforge-db-construction/construct_erc2-chromatin15state-all_files.py | Python | gpl-3.0 | 3,559 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2017 Stephen Bunn (stephen@bunn.io)
# GNU GPLv3 <https://www.gnu.org/licenses/gpl-3.0.en.html>
from ._common import *
from .rethinkdb import RethinkDBPipe
from .mongodb import MongoDBPipe
| ritashugisha/neat | neat/pipe/__init__.py | Python | gpl-3.0 | 255 |
import pandas as pd
from larray.core.array import Array
from larray.inout.pandas import from_frame
__all__ = ['read_stata']
def read_stata(filepath_or_buffer, index_col=None, sort_rows=False, sort_columns=False, **kwargs) -> Array:
r"""
Reads Stata .dta file and returns an Array with the contents
Param... | gdementen/larray | larray/inout/stata.py | Python | gpl-3.0 | 1,657 |
# ../gungame/core/messages/hooks.py
"""Provides a way to hook GunGame messages."""
# =============================================================================
# >> IMPORTS
# =============================================================================
# Source.Python
from core import AutoUnload
# GunGame
from .m... | GunGame-Dev-Team/GunGame-SP | addons/source-python/plugins/gungame/core/messages/hooks.py | Python | gpl-3.0 | 1,705 |
# coding=utf-8
""" NodeChains are sequential orders of :mod:`~pySPACE.missions.nodes`
.. image:: ../../graphics/node_chain.png
:width: 500
There are two main use cases:
* the application for :mod:`~pySPACE.run.launch_live` and the
:mod:`~pySPACE.environments.live` using the default
:class:`Nod... | Crespo911/pyspace | pySPACE/environments/chains/node_chain.py | Python | gpl-3.0 | 60,058 |
import pandas as pd
adv = pd.read_csv('Advertising.csv')
tv_budget_x = adv.TV.tolist()
print(tv_budget_x)
| akanuragkumar/tensorflow-basics | ex1.py | Python | gpl-3.0 | 110 |
from django.contrib import admin
#from .models import Tag
#import sys
#import importlib
#importlib.reload(sys)
#admin.site.register(Tag)
# Register your models here.
| summerzhangft/summer | tag/admin.py | Python | gpl-3.0 | 167 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 22 17:01:36 2019
@author: raf
"""
# IMPORT STUFF
from pdb import set_trace as stop
import copy
import numpy as np
from collections import OrderedDict
import string as st
import os
import pandas as pd
from vison.datamodel import cdp
from vison.supp... | ruymanengithub/vison | vison/metatests/chinj01.py | Python | gpl-3.0 | 34,380 |
"""
MagPy
IAGA02 input filter
Written by Roman Leonhardt June 2012
- contains test, read and write function
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
from __future__ import division
from io import open
from magpy.stream import *
#global va... | hschovanec-usgs/magpy | magpy/lib/format_iaga02.py | Python | gpl-3.0 | 20,820 |
class Solution:
def majorityElement(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
num1, cnt1 = 0, 0
num2, cnt2 = 1, 0
for num in nums:
if num == num1:
cnt1 += 1
elif num == num2:
c... | YiqunPeng/Leetcode-pyq | solutions/229MajorityElementII.py | Python | gpl-3.0 | 671 |
import pandas as pd
from sklearn.datasets import load_boston
from sklearn.linear_model import LinearRegression
from sklearn.tree import DecisionTreeRegressor
from sklearn.cross_validation import train_test_split
from sklearn.metrics import mean_squared_error
from .auto_segment_FEMPO import BasicSegmenter_FEMP... | bhanu-mnit/EvoML | evoml/subsampling/test_auto_segmentEG_FEMPO.py | Python | gpl-3.0 | 1,357 |
#!/usr/bin/env python
# Version 0.1
# NDVI automated acquisition and calculation by Vladyslav Popov
# Using landsat-util, source: https://github.com/developmentseed/landsat-util
# Uses Amazon Web Services Public Dataset (Lansat 8)
# Script should be run every day
from os.path import join, abspath, dirname, exis... | vladanti/ndvi_calc | ndvi.py | Python | gpl-3.0 | 4,318 |
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
import unittest, time, re
class DownloadEnteredDataTest(unittest.TestCase):
def setUp(self)... | kobotoolbox/kobo_selenium_tests | kobo_selenium_tests/selenium_ide_exported/download_entered_data_test.py | Python | gpl-3.0 | 3,987 |
########################################################################
# File : ARCComputingElement.py
# Author : A.T.
########################################################################
""" ARC Computing Element
"""
__RCSID__ = "58c42fc (2013-07-07 22:54:57 +0200) Andrei Tsaregorodtsev <atsareg@in2p3.fr>"
... | miloszz/DIRAC | Resources/Computing/ARCComputingElement.py | Python | gpl-3.0 | 10,864 |
#!/usr/bin/env python3
import re
a = [[0 for x in range(25)] for y in range(13)]
f=open("../distrib/spiral.txt","r")
s=f.readline().strip()
dx, dy = [0, 1, 0, -1], [1, 0, -1, 0]
x, y, c = 0, -1, 1
l=0
for i in range(13+13-1):
if i%2==0:
for j in range((25+25-i)//2):
x += dx[i % 4]
y ... | DISMGryphons/GryphonCTF2017-Challenges | challenges/misc/Spirals/solution/solution.py | Python | gpl-3.0 | 812 |
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
# This file is part of the mantidqt package
... | mganeva/mantid | qt/python/mantidqt/project/workspaceloader.py | Python | gpl-3.0 | 1,243 |
#!python
"""Script for plotting distributions of epitopes per site for two sets of sites.
Uses matplotlib. Designed to analyze output of epitopefinder_getepitopes.py.
Written by Jesse Bloom."""
import os
import sys
import random
import epitopefinder.io
import epitopefinder.plot
def main():
"""Main body of sc... | jbloom/epitopefinder | scripts/epitopefinder_plotdistributioncomparison.py | Python | gpl-3.0 | 3,447 |
mcinif='mcini_gen2'
runname='gen_test2111b'
mcpick='gen_test2b.pickle'
pathdir='/beegfs/work/ka_oj4748/echoRD'
wdir='/beegfs/work/ka_oj4748/gen_tests'
update_prec=0.04
update_mf=False
update_part=500
import sys
sys.path.append(pathdir)
import run_echoRD as rE
rE.echoRD_job(mcinif=mcinif,mcpick=mcpick,runname=runname,... | cojacoo/testcases_echoRD | gen_test2111b.py | Python | gpl-3.0 | 430 |
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 18 14:11:31 2015
@author: Martin Friedl
"""
from datetime import date
import numpy as np
from Patterns.GrowthTheoryCell import make_theory_cell
from Patterns.GrowthTheoryCell_100_3BranchDevices import make_theory_cell_3br
from Patterns.GrowthTheoryCell_100_4BranchDevic... | Martin09/E-BeamPatterns | 100 Wafers - 1cm Squares/Multi-Use Pattern/v1.2/MembraneDesign_100Wafer_v1.1.py | Python | gpl-3.0 | 17,018 |