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 |
|---|---|---|---|---|---|
# coding=utf-8
import signal
import sys
from os import path
from platform import system
from PyQt5.QtCore import (QSize, QtFatalMsg, QtCriticalMsg, QtWarningMsg, QtInfoMsg,
qInstallMessageHandler, QtDebugMsg)
from PyQt5.QtCore import QTimer
from PyQt5.QtCore import QUrl
from PyQt5.QtGui impor... | thejoeejoee/VUT-FIT-IFJ-2017-toolkit | ifj2017/ide/main.py | Python | gpl-3.0 | 4,076 |
import limp.tokens as Tokens
import limp.syntax as Syntax
from limp.parsing.shared import *
def node(tokens):
if tokens[0].contents != Syntax.CONDITIONAL:
return
if len(tokens) < 5:
return
condition_tokens = tokens[1:]
opener = Tokens.Types.OpenCurlyBrace
closer = Tokens.Types.C... | byxor/limp | limp/parsing/conditional.py | Python | gpl-3.0 | 952 |
from serial import *
import serial.tools.list_ports
import time
ports = sorted(serial.tools.list_ports.comports())
i = 1
for elem in ports:
print i, " - " + elem[0]
i = i + 1
selectedPort = input("Select COM port option: ")
comPort = ports[selectedPort - 1][0]
serialPort = Serial(comPort, 57600, timeout=0, writeT... | thingbits/iot | src/receiver/receiverPython/receiver.py | Python | gpl-3.0 | 735 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import datetime
import dateutil
import logging
import os
import time
from pytz import timezone
import odoo
from odoo import api, fields, models, tools, workflow, _
from odoo.exceptions import MissingError, UserError, Va... | ayepezv/GAD_ERP | openerp/addons/base/ir/ir_actions.py | Python | gpl-3.0 | 55,793 |
from misc import db
from sqlalchemy import exc as SQLexc
from misc.uuid import UUID
import uuid
import datetime as dt
class Vote(db.Model):
__tablename__ = 'vote'
user_id = db.Column(
UUID(), db.ForeignKey('user.user_id', ondelete='CASCADE'),
nullable=False, primary_key=True)
idea_id =... | Ideabin/Ideabin | server/votes/models.py | Python | gpl-3.0 | 1,043 |
# -*- coding: utf-8 -*-
class UserSettingsError(Exception):
pass
| heldergg/dre | dre_django/settingsapp/exceptions.py | Python | gpl-3.0 | 70 |
from django.contrib import messages
from django.core.serializers.python import Serializer
from django.core.urlresolvers import reverse_lazy
from django.views.generic import ListView, CreateView, DeleteView, UpdateView
from limited_paginator.limitpaging import LimitedPaginator
from .forms import ConvertForm
from .models... | valentine20xx/portal | converter/views_convert.py | Python | gpl-3.0 | 8,473 |
from profiles.models import *
from django.contrib.gis import admin
class UserProfileAdmin(admin.OSMGeoAdmin):
list_display = ('user', 'primary_language', 'active')
admin.site.register(UserProfile, UserProfileAdmin)
class PhoneNumberAdmin(admin.OSMGeoAdmin):
list_display = ('value', 'profile', 'priority', '... | audaciouscode/SMSBot | smsbot_django/profiles/admin.py | Python | gpl-3.0 | 394 |
# ----------------------------------------------------------------------
# Copyright (C) 2014, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This program is free software: you can redistribute it and/or mo... | chetan51/NAB | nab/lib/running.py | Python | gpl-3.0 | 6,049 |
class Solution(object):
def removeDuplicateLetters(self, s):
"""
:type s: str
:rtype: str
"""
# @lixx2100
counter = collections.defaultdict(int)
for c in s:
counter[c] += 1
visited = set()
candidates = []
for c in s:
... | zqfan/leetcode | algorithms/316. Remove Duplicate Letters/solution.py | Python | gpl-3.0 | 732 |
# -*- coding: utf-8 -*-
# StreetSign Digital Signage Project
# (C) Copyright 2013 Daniel Fairhead
#
# StreetSign 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... | danthedeckie/streetsign | streetsign_server/post_types/external_webpage/__init__.py | Python | gpl-3.0 | 1,782 |
"""Control objects for surface calculations."""
from fsc.export import export
from ..line._control import _create_line_controls
from .._control import (
ControlContainer, DataControl, ConvergenceControl, StatefulControl,
IterationControl, SurfaceControl, LineControl
)
from .._utils import _get_max_move
@exp... | Z2PackDev/Z2Pack | z2pack/surface/_control.py | Python | gpl-3.0 | 2,647 |
#!/usr/bin/env python2
#! -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
from gi.repository import GObject, Gtk, Gdk, GtkClutter, Clutter, GdkPixbuf, Cogl, WebKit
import cairo
import sys
import os
def get_texture(img):
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(img, 800, 600, True)
... | peterlevi/ojo | tests/experiments/clutter_experiment.py | Python | gpl-3.0 | 4,707 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2015-2018 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in ... | mvo5/snapcraft | tests/unit/lifecycle/__init__.py | Python | gpl-3.0 | 1,728 |
import logging
import os
import shutil
from envs.monkey_zoo.blackbox.log_handlers.monkey_log_parser import MonkeyLogParser
from envs.monkey_zoo.blackbox.log_handlers.monkey_logs_downloader import MonkeyLogsDownloader
LOG_DIR_NAME = "logs"
LOGGER = logging.getLogger(__name__)
class TestLogsHandler(object):
def _... | guardicore/monkey | envs/monkey_zoo/blackbox/log_handlers/test_logs_handler.py | Python | gpl-3.0 | 1,735 |
# -*- coding: utf-8 -*- vim:fileencoding=utf-8:
# Copyright (C) 2010-2014 GRNET S.A.
#
# 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 ... | sunweaver/ganetimgr | auditlog/models.py | Python | gpl-3.0 | 1,475 |
#!/usr/bin/env python
import math
import sys
import cairo
import gtk as Gtk
class NdukoGrid(Gtk.Table):
'''A square grid of size n^2 containing NdukoItems'''
def __init__(self, n):
super(NdukoGrid,self).__init__()
self._items = []
for x in range(n):
for y in range(n):
... | kragniz/nduko | gui/widgets.py | Python | gpl-3.0 | 5,658 |
import threading # za vzporedno izvajanje
import logging
from alfabeta import *
######################################################################
## Igralec računalnik
class Racunalnik():
def __init__(self, gui, algoritem):
self.gui = gui
self.algoritem = algoritem # Algoritem, ki izračuna ... | inessovdat/stiri-v-vrsto | racunalnik.py | Python | gpl-3.0 | 1,905 |
#! /usr/bin/env python
class Solution(object):
def searchRange(self, nums, target):
self.target = target
return self.find_target(0, len(nums) - 1, nums)
def find_target(self, start, end, nums):
target = self.target
if not nums:
return [-1, -1]
if start == ... | cosven/pat_play | leetcode/034.py | Python | gpl-3.0 | 2,441 |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base.version import Version
from twilio.rest.events.v1.sink import SinkList
from twilio.rest.events.v1.subscription import SubscriptionList
class V1(Version):
def __init__(self, do... | Vagab0nd/SiCKRAGE | lib3/twilio/rest/events/v1/__init__.py | Python | gpl-3.0 | 1,288 |
#!/usr/bin/env python3
from setuptools import setup
setup(
name = 'dockbot',
version = '0.2.1',
description =
'A continuous integration system which uses Docker and Buildbot',
long_description = open('README.md', 'rt').read(),
author = 'Joseph Coffland',
author_email = 'joseph@cauldrondeve... | CauldronDevelopmentLLC/dockbot | setup.py | Python | gpl-3.0 | 822 |
#!/usr/bin/python
# script to test cross correlating saved blocks containing only coherent noise
import sys
import math
import cmath
#import matplotlib.pyplot as plt
import numpy as np
from scipy import signal
def main():
# files having only one received block
files = ["rtla.dat", "rtlb.dat", "rtlc.dat", "rtld.dat"... | jakapoor/AMRUPT | Firmware/Ground_nodes/Pi_DOA/Summer 2018/UDP/cross-correlate.py | Python | gpl-3.0 | 897 |
# generated from catkin/cmake/template/order_packages.context.py.in
source_root_dir = "/home/pi/Documents/robomagellan/Codigos/Raspberry/ROS/catkin_Bauchspiess/src"
whitelisted_packages = "".split(';') if "" != "" else []
blacklisted_packages = "".split(';') if "" != "" else []
underlay_workspaces = "/home/pi/Documents... | UnbDroid/robomagellan | Codigos/Raspberry/ROS/catkin_Bauchspiess/build/catkin_generated/order_packages.py | Python | gpl-3.0 | 1,137 |
import typing
import numpy as np
import xarray as xr
import glotaran
from glotaran.parameter import ParameterGroup
from glotaran.builtin.models.kinetic_image.irf import IrfGaussian
from glotaran.builtin.models.kinetic_image.kinetic_image_result import \
retrieve_species_assocatiated_data, retrieve_decay_assoca... | glotaran/glotaran | glotaran/builtin/models/kinetic_spectrum/kinetic_spectrum_result.py | Python | gpl-3.0 | 4,559 |
""" This is the guy that you should use when you develop a script that interacts with DIRAC
And don't forget to call parseCommandLine()
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
__RCSID__ = "$Id$"
import sys
import os.path
import inspect
fro... | yujikato/DIRAC | src/DIRAC/Core/Base/Script.py | Python | gpl-3.0 | 5,603 |
import cv2
import opencv
import dscc
import time
import argparse
import sys
from random import randint
if __name__ == "__main__":
print("OpenCV version : {0}".format(cv2.__version__))
gray = cv2.imread('./test/cai.png', cv2.IMREAD_GRAYSCALE)
if gray is None:
print("document d... | fdalforno/OpenCvTests | testdscc.py | Python | gpl-3.0 | 632 |
from collections import OrderedDict
from operator import attrgetter
from pyparsing import Suppress, Word, alphas, alphanums, Group, \
OneOrMore, ZeroOrMore, Optional, cppStyleComment, Literal, CharsNotIn
from dsl_parsers.dsl_parser_abstract import DSLParserTemplate
from dsl_parsers.parsing_utils import generate_r... | Kmayankkr/robocomp | tools/robocompdsl/dsl_parsers/specific_parsers/idsl_parser.py | Python | gpl-3.0 | 8,406 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-11-02 03:11
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('vocabulary', '0006_auto_20161031_1601'),
]
operations ... | hamasho/endojo | apps/games/vocabulary/migrations/0007_auto_20161102_0311.py | Python | gpl-3.0 | 671 |
# Import the module with the global variables and the macro base class.
import qtmacs.qte_global as qte_global
from PyQt4 import QtCore, QtGui, QtWebKit
from qtmacs.base_applet import QtmacsApplet
# Get a reference to the main instance of Qtmacs.
qteMain = qte_global.qteMain
class Worker(QtCore.QObject):
"""
... | olitheolix/qtmacs | doc/source/code_snippets/tut_4_2.py | Python | gpl-3.0 | 2,203 |
from commontest import DummyBlockchainInterface
import pytest
from jmbase import utxostr_to_utxo, hextobin
from jmclient import (load_test_config, jm_single, BTC_P2WPKH)
from jmclient.commitment_utils import get_utxo_info, validate_utxo_data
from jmbitcoin import select_chain_params
def test_get_utxo_info():
load... | JoinMarket-Org/joinmarket-clientserver | jmclient/test/test_commitment_utils.py | Python | gpl-3.0 | 2,453 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# This is a Python 3 script!
from pymongo import MongoClient
import sys
client = MongoClient()
try:
db = client.gima
coll = db.geboorte
coll.drop()
count = 0
doc = ''
f = open('data/geboorte.txt', 'r')
for line in f:
if le... | tomtor/GIMA | load_mongo.py | Python | gpl-3.0 | 803 |
# -*- coding: utf-8 -*-
#
# gPodder - A media aggregator and podcast client
# Copyright (c) 2005-2010 Thomas Perl and the gPodder Team
#
# gPodder 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... | M4rtinK/mieru | platforms/maemo5_autorotation.py | Python | gpl-3.0 | 8,791 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2015-2016 Simone Donadello
#
# 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) an... | simondona/exp-control-bec-tn | libraries/board.py | Python | gpl-3.0 | 3,659 |
#
# Copyright © 2012 - 2021 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.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 version 3 of the Lice... | phw/weblate | weblate/addons/cdn.py | Python | gpl-3.0 | 5,069 |
################################################################################
#
# Copyright (C) 2012-2013 Eric Conte, Benjamin Fuks
# The MadAnalysis development team, email: <ma5team@iphc.cnrs.fr>
#
# This file is part of MadAnalysis 5.
# Official website: <https://launchpad.net/madanalysis5>
#
# MadAnal... | Lana-B/Pheno4T | madanalysis/layout/histogram_frequency_core.py | Python | gpl-3.0 | 1,585 |
import os
import datetime
import arrow
import discord
import yaml
import aiohttp
from config import Prefix, MongoAddress, MongoPort, MongoAuth, MongoUser, MongoPass, DiscordListToken, DevMode
from config import UseCachet, CachetToken, CachetURL
from .plugman import PluginManager
from .database import Database
from .m... | valeth/apex-sigma | sigma/core/sigma.py | Python | gpl-3.0 | 9,713 |
from turbustat.statistics import pca, vca
from astropy.table import Table
import numpy as np
from astropy.table import Table, Column
import scipy.stats as ss
import matplotlib.pyplot as plt
import astropy.units as u
import astropy.constants as con
import os
from astropy.io import fits
from astropy import wcs
from spect... | low-sky/cohrscld | cohrs_pca.py | Python | gpl-3.0 | 4,461 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2016 by the GFDRR / World Bank
#
# This file is part of ThinkHazard.
#
# ThinkHazard 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... | GFDRR/thinkhazard | thinkhazard/views/api.py | Python | gpl-3.0 | 2,450 |
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext as _
from django.contrib.auth.models import User
from taggit.managers import TaggableManager
from apps.thecarib.models import Country
@python_2_unicode_compatible
class Category(mod... | owatte/thecaribfos | apps/thecalendar/models.py | Python | gpl-3.0 | 3,435 |
import os
import requests
from utils import State
from .people import INPersonScraper
from .bills import INBillScraper
# from .committees import INCommitteeScraper
class Indiana(State):
scrapers = {
"people": INPersonScraper,
# 'committees': INCommitteeScraper,
"bills": INBillScraper,
... | hiteshgarg14/openstates | scrapers/in/__init__.py | Python | gpl-3.0 | 4,897 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author Jonas Ohrstrom <jonas@digris.ch>
"""
Python part of radio playout (bcmon)
This function acts as a gateway between liquidsoap and the obp-api.
Mainliy used to tell the plattform what bcmon/LS does.
Main case:
- whenever LS starts playing a new track, its on_me... | hzlf/openbroadcast | services/bcmon/orig_bcmon_notify.py | Python | gpl-3.0 | 4,729 |
from .main import gks
def start():
return gks()
config = [{
'name': 'gks',
'groups': [
{
'tab': 'searcher',
'subtab': 'providers',
'list': 'torrent_providers',
'name': 'gks',
'description': 'See <a href="https://gks.gs/">Gks</a>',
... | lmyrefelt/CouchPotatoServer | couchpotato/core/providers/torrent/gks/__init__.py | Python | gpl-3.0 | 1,044 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2020-12-03 22:19
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import smart_selects.db_fields
class Migration(migrations.Migration):
dependencies = [
('core', '0025_auto_20201105_1... | interlegis/saap | saap/core/migrations/0026_auto_20201203_1919.py | Python | gpl-3.0 | 2,398 |
#!/usr/bin/env python
import fnmatch
import os
import sys
import string
fuzzysearch = True
try:
from fuzzywuzzy import process
except:
fuzzysearch = False
QUERY = sys.argv[1]
HOME = os.environ['HOME']
PASS_DIR = os.environ.get('PASSWORD_STORE_DIR',os.path.join(HOME, '.password-store/'))
# TODO: list_passw... | CGenie/alfred-pass | pass-filter.py | Python | gpl-3.0 | 2,373 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Poll'
db.create_table(u'poll_poll', (
(u'id',... | G3-jang/rice-interactive-python | poll/migrations/0001_initial.py | Python | gpl-3.0 | 3,136 |
from db import db
# from Model.Author_Relationships import Author_Relationships
from model import *
import uuid
class Authors(db.Model):
__tablename__ = 'authors'
author_id = db.Column(db.String(100), primary_key=True)
github_id = db.Column(db.String(200))
name = db.Column(db.String(6... | CMPUT404-Fall2016/cmput404-project | Model/Authors.py | Python | gpl-3.0 | 4,672 |
"""
Email related settings
"""
from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import LOGIN_USERS_COMMUNICATION
from askbot.deps import livesettings
from askbot import const
from django.utils.translation import ugettext_lazy as _
from django.conf import settings as django_settings
EMAIL... | jesonyang001/qarepo | askbot/conf/email.py | Python | gpl-3.0 | 10,122 |
from django.db import models
class Estado(models.Model):
nome = models.CharField(max_length=256)
sigla = models.CharField(max_length=2)
class Municipio(models.Model):
nome = models.CharField(max_length=256)
estado = models.ForeignKey(Estado, related_name='municipios')
class Usuario(models.Model):
... | ops-org/sistema-ops-backend | base/models.py | Python | gpl-3.0 | 627 |
class Solution(object):
def findDiagonalOrder(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: List[int]
"""
if not matrix: return []
ans = []
mode = 0 #0-up 1-down
num = len(matrix) * len(matrix[0])
row, col = 0, 0
for i in ... | YiqunPeng/Leetcode-pyq | solutions/498DiagonalTraverse.py | Python | gpl-3.0 | 1,139 |
def to_oct(string):
try:
return int(string, base=8)
except ValueError:
return 0
def convert_all(n_str):
return to_oct(n_str), int(n_str), int(n_str,base=16)
def main():
for _ in range(int(input())):
a,b = input().split()
print(a,*convert_all(b))
if __name__ == "__... | JonSteinn/Kattis-Solutions | src/Which Base is it Anyway/Python 3/main.py | Python | gpl-3.0 | 339 |
import hashlib
import json
import cv2
from ims.descriptors import DescriptorConfig
from ims.util import crop_image
class DBConfig(object):
def __init__(self, output_path, db_stats_aggregator=None, db_normalization=None):
self.db_stats_aggregator = db_stats_aggregator
self.db_normalization = db_n... | deathnik/img-search | ims/core/db.py | Python | gpl-3.0 | 3,656 |
"""
Sometimes use of floats may lead to undesirable results, e.g.
int(2.3 / 0.1) = 22.
We cannot afford to use different number representations (e.g. representations
provided by decimal or fraction modules), thus consequences are worked around by
this module.
"""
import math
import sys
# As we will be rounding num... | blitzmann/Pyfa | eos/utils/float.py | Python | gpl-3.0 | 920 |
#!/usr/bin/env python
#coding:utf-8
from datetime import datetime
def printText(obj,textColor='',backgroundColor='',style='',logFile=None,color=True,debug=4):
'''
:param obj: print object
:param textColors: default='' <class str|'red','yellow','green','blue','cyan','purple','black','white'>
:param bac... | doupengs/dpspider | dpspider/color.py | Python | gpl-3.0 | 4,975 |
from all_pycco.pycco import main as m
# Comment here
def main():
m.process("/Users/brianb/workspace/cheatsheet/instagram/simple_likebot.py",
outdir="/Users/brianb/workspace/cheatsheet/output",
language="python",
encoding="latin-1")
main()
| brianbelljr/cheatsheet | instagram/app.py | Python | gpl-3.0 | 289 |
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else []
PROJECT_CATKIN_DEPENDS = "".replace(';', ' ')
PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else []
PROJECT_NAME = "roboteq_motor"
PROJECT_SPACE_DIR = "/... | clubcapra/Ibex | src/roboteq_motor/catkin_generated/pkg.develspace.context.pc.py | Python | gpl-3.0 | 373 |
"""
https://leetcode.com/problems/remove-duplicates-from-sorted-array/
date: 03/21/19
"""
def new_arr(arr):
idx = 0
mov = idx+1
while mov < len(arr):
data = arr[idx]
while data == arr[mov]:
mov +=1
if mov>=len(arr):
break
if mov < len(ar... | entrepidea/projects | python/tutorials/algo/leetcode_easy/remove_dup_from_sorted_array.py | Python | gpl-3.0 | 591 |
from modb import TestB
import logging
class ModuleAPlugin:
def __init__(self):
self.log = logging.getLogger('moda.ModuleAPlugin')
def activate(self):
self.log.info('Module A Plugin activated')
def deactivate(self):
self.log.info('Module A Plugin deactivated')
def o... | smokorg/termite-platform | tests/import/plugins/a/moda.py | Python | gpl-3.0 | 420 |
# -*- coding: utf-8 -*-
import pynmea2
import sys
f = open("/dev/ttyMFD1")
streamreader = pynmea2.NMEAStreamReader(f)
while 1:
try:
for msg in streamreader.next():
Lat = int(msg.lat[:2]) + float(msg.lat[2:])/60
Lon = int(msg.lon[:3]) + float(msg.lon[3:])/60
print "%.4f%s,%.4f%s vs %s%s, %s%s" % (Lat, ... | Nickiler531/NEGRAV_implemetation | src/GPS.py | Python | gpl-3.0 | 470 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2017 by the GFDRR / World Bank
#
# This file is part of ThinkHazard.
#
# ThinkHazard 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... | pgiraud/thinkhazard | thinkhazard/tests/views/__init__.py | Python | gpl-3.0 | 12,517 |
#!/usr/bin/env python
transliter = dict()
for i in range(2**8):
for j in range(2**8):
transliter[bytes([i, j])] = "."
for i in range(2**8):
for j in range(ord('z')-ord('a')+1):
transliter[bytes([i, j+0x01])] = chr(ord('a')+j)
for i in range(2**8):
for j in range(ord('z')-ord('a')+1):
... | Sebelino/pyromhackit | pyromhackit/roms/persona1usa/hexmap.py | Python | gpl-3.0 | 432 |
import numpy as np
import scipy.sparse
def average_2xFarEdge(grid_size, design_bounds):
"""
Start with 2D versions of each grid and later just use repmat to
make the S-matrix for the full 3D grid. The 2D version of Sz
consists of a bunch of 0-rows above and below a block-diagonal
matrix. The bl... | stanfordnqp/spins-b | spins/invdes/problem/selection_matrix.py | Python | gpl-3.0 | 7,289 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# chat.py - chat area
#
# Copyright (C) 2011-2013 Sebastien Helleu <flashcode@flashtux.org>
#
# This file is part of QWeeChat, a Qt remote GUI for WeeChat.
#
# QWeeChat is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public Lice... | howaboutudance/qweechat | src/qweechat/chat.py | Python | gpl-3.0 | 4,891 |
# -*- coding: utf-8 -*-
# django-mcadmin
# mcadmin/models/permissions/group.py
from typing import List
from django.db import models
from django.conf import settings
from django.utils.translation import gettext_lazy as _
__all__: List[str] = [
"CommandGroupPermission",
]
class CommandGroupPermission(models.M... | vint21h/django-mcadmin | mcadmin/models/permissions/group.py | Python | gpl-3.0 | 1,799 |
#!/usr/bin/env python-sirius
"""Unittest module for currinfo.py."""
from unittest import TestCase
from siriuspy import util
from siriuspy.currinfo import csdev
from siriuspy.currinfo.csdev import \
get_currinfo_database, \
get_lifetime_database
PUB_INTERFACE = (
'ETypes',
'Const',
'ge... | lnls-sirius/dev-packages | siriuspy/tests/currinfo/test_csdev.py | Python | gpl-3.0 | 6,495 |
# This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (a... | nop33/indico | indico/__init__.py | Python | gpl-3.0 | 841 |
# oppia/content/views.py
import hashlib
import math
import os
import subprocess
import urllib
import uuid
import oppia.content
from django import forms
from django.conf import settings
from django.shortcuts import render
from django.template import RequestContext
from django.utils.translation import ugettext_lazy as _... | DigitalCampus/django-nurhi-oppia | oppia/content/views.py | Python | gpl-3.0 | 5,550 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 distrib... | zeffii/SoundPetal | nodes/envelopes/line.py | Python | gpl-3.0 | 1,314 |
# Copyright 2006-2009 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of co... | chriskmanx/qmole | QMOLEDEV/node/deps/v8/src/macros.py | Python | gpl-3.0 | 7,531 |
'''
GPG RQ worker settings.
Copyright 2014-2016 GoodCrypto
Last modified: 2016-10-26
This file is open source, licensed under GPLv3 <http://www.gnu.org/licenses/>.
'''
#from goodcrypto.utils.constants import REDIS_HOST
REDIS_PORT = 6381
#REDIS_URL = 'http://{}:{}'.format(REDIS_HOST, REDIS_PORT)
GPG_... | goodcrypto/goodcrypto-oce | python/goodcrypto/oce/gpg_queue_settings.py | Python | gpl-3.0 | 810 |
import sys
for i in range(int(input())):
n = int(input())
vecA = sorted(list(map(int, input().split())))
vecB = sorted(list(map(int, input().split())))[::-1]
total = 0
for j in range(len(vecA)):
total += vecA[j]*vecB[j]
print("Case #%d: %d" % (i+1, total))
| SirDavidLudwig/KattisSolutions | problems/minimumscalar/minimumscalar.py | Python | gpl-3.0 | 266 |
"""Implements bridge connection between Sugar/GTK and Pygame"""
import os
import sys
import logging
log = logging.getLogger( 'olpcgames.canvas' )
##log.setLevel( logging.DEBUG )
import threading
from pprint import pprint
import pygtk
pygtk.require('2.0')
import gtk
import gobject
import pygame
from olpcgames import g... | rparrapy/maze | olpcgames/canvas.py | Python | gpl-3.0 | 6,498 |
import numpy as np
from keras.optimizers import SGD
from models.CNN_CIFAR import cnn_cifar_small_batchnormalisation_class_scale
from models.DataLoader import DataLoader
from keras.models import load_model
from scripts.progress_bar import printProgress
from time import time, localtime
# this is a predefined dataloader
l... | stevenwudi/Kernelized_Correlation_Filter | CNN_training_with_scale.py | Python | gpl-3.0 | 5,654 |
#! /usr/bin/env python
from __future__ import absolute_import
'''Some helper functions for testing'''
import sys
import os
import time
import binascii
import random
import subprocess
import platform
from decimal import Decimal
data_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.insert(0, ... | AdamISZ/CoinSwapCS | test/commontest.py | Python | gpl-3.0 | 4,116 |
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from tuxemon.client import LocalPygameClient
from tuxemon.player import Player
class Session:
"""
Contains Client, World, and Player.
Eventually this will be extended to support network sessions.
"""
... | Tuxemon/Tuxemon | tuxemon/session.py | Python | gpl-3.0 | 718 |
#!/usr/bin/env python
#
###############################################################################
# Copyright (C) 2016 Cortney T. Buffington, N0MJS <n0mjs@me.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
... | n0mjs710/DMRlink | Retired/record.py | Python | gpl-3.0 | 6,801 |
#!/usr/bin/python -tt
# -*- coding: utf-8 -*-
# aggr.py - aggr - aggregate CSV-data and print on the standard output
#
# Copyright (C) 2010, Stefan Schramm <mail@stefanschramm.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publish... | stefanschramm/aggr | aggr.py | Python | gpl-3.0 | 6,175 |
from typing import List
class Solution:
def merge(self, nums1: List[int], m: int, nums2: List[int],
n: int) -> None:
"""
Do not return anything, modify nums1 in-place instead.
"""
idx1 = 0
while nums2:
num1 = nums1[idx1]
num2 = nums2[0]... | 1337/yesterday-i-learned | leetcode/88.py | Python | gpl-3.0 | 942 |
import webapp2
import urlparse
import logging
class TransparentProxy(webapp2.RequestHandler):
"""Transparent forward all request to Twitter"""
def get(self):
self.do_proxy('GET')
def post(self):
self.do_proxy('POST')
def do_proxy(self, method):
# parse requested path and quer... | DSakura1987/ptap | transparent.py | Python | gpl-3.0 | 2,226 |
# -*- coding: utf-8 -*-
import unittest
import os
import tempfile
from nive.utils.utils import MakeListItems, ConvertHTMLToText, ConvertToDateTime
class UtilsTest(unittest.TestCase):
def test_makelistitems1(self):
l = ["1","2","3"]
li = MakeListItems(l)
self.assertTrue(len(li)==3)... | nive/nive | nive/utils/tests/test_utils.py | Python | gpl-3.0 | 2,778 |
class TerminalResizeListener(object):
_instance = None
def __new__(cls):
if TerminalResizeListener._instance is None:
TerminalResizeListener._instance = object.__new__(cls)
return TerminalResizeListener._instance
def __init__(self):
self._listeners = list()
s... | rmonico/itask | itask/terminal_resize_listener.py | Python | gpl-3.0 | 749 |
import pytest
from pysisyphus.benchmarks import Benchmark
from pysisyphus.calculators.PySCF import PySCF
# from pysisyphus.helpers_pure import filter_fixture_store
from pysisyphus.optimizers.RFOptimizer import RFOptimizer
from pysisyphus.testing import using
def calc_getter(charge, mult):
return PySCF(basis="sto... | eljost/pysisyphus | tests/test_baker/test_baker.py | Python | gpl-3.0 | 1,721 |
# o programa calcula se os valores informados podem ser um triângulo e,
# se for, qual tipo de triângulo é
print("O programa calcula se os valores informados pode ser um triângulo e")
print("identica qual tipo de triângulo é: equilátero, isósceles ou escaleno.")
lado1 = float(input("Informe o primeiro lado: "))
lado2... | luis-fonseca/python_para_zumbis | lista_2/questao01.py | Python | gpl-3.0 | 1,225 |
import random
import copy
import Perceptron as percept
from GameTree import Node
import time
def BuildGameTree():
b=Board()
b.board=[[0,0,0],[0,0,0],[0,0,0]]
p = Node(element = [[0,0,0],[0,0,0],[0,0,0]])
Display(p.element)
BuildValidMoves(p)
def BuildValidMoves(p): # build the valid chil... | Wheelspawn/Python-Neural-Networks | Board.py | Python | gpl-3.0 | 10,134 |
mcinif='mcini_weiher'
runname='gen_test3122k'
mcpick='gen_test3.pickle'
pathdir='/beegfs/work/ka_oj4748/echoRD'
wdir='/beegfs/work/ka_oj4748/gen_tests'
update_prec=0.06
update_mf='07moist.dat'
update_part=100
import sys
sys.path.append(pathdir)
import run_echoRD as rE
rE.echoRD_job(mcinif=mcinif,mcpick=mcpick,runname... | cojacoo/testcases_echoRD | gen_test3122k.py | Python | gpl-3.0 | 439 |
import subprocess
import sys
def run_program(program_path, args=None):
""" run program runs a program as it is called from commandline
"""
if args is None:
args = []
default_args = [sys.executable, program_path]
process = subprocess.Popen(
default_args + args,
stdout=subpro... | jeroendecroos/pronunciation_master | pronunciation_master/tests/testlib/testrun.py | Python | gpl-3.0 | 454 |
#!/usr/bin/env python
"""
Get the list of all the user files.
Example:
$ dirac-dms-user-lfns
/formation/user/v/vhamar: 14 files, 6 sub-directories
/formation/user/v/vhamar/newDir2: 0 files, 0 sub-directories
/formation/user/v/vhamar/testDir: 0 files, 0 sub-directories
/formation/user/v/vhamar/0: 0 files, 6 s... | yujikato/DIRAC | src/DIRAC/DataManagementSystem/scripts/dirac_dms_user_lfns.py | Python | gpl-3.0 | 5,945 |
"""
URLs for about
"""
from django.conf.urls import patterns, url
urlpatterns = patterns(
'hypermeet.views',
url(r'^$', 'index', name="index"),
)
| ahockersten/lierogbg | hypermeet/urls.py | Python | gpl-3.0 | 156 |
"""
Copyright (C) 2016 Quinn D Granfor <spootdev@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful... | MediaKraken/MediaKraken_Deployment | source/metadata/metadata_general.py | Python | gpl-3.0 | 21,036 |
import numpy as np
import pandas as pd
from functools import lru_cache
from gsee.gsee import brl_model, pv
from D3HRE.core.dataframe_utility import full_day_cut
from D3HRE.core.battery_models import Battery
from D3HRE.core.weather_data_download import resource_df_download_and_process
from D3HRE.core.wind_turbine_mod... | tsaoyu/D3HRE | D3HRE/simulation.py | Python | gpl-3.0 | 13,783 |
import os
import httplib2
import time
from apiclient.discovery import build
from oauth2client import tools
from oauth2client.client import flow_from_clientsecrets, OAuth2WebServerFlow, Storage
from oauth2client.service_account import ServiceAccountCredentials
class GooglePlayApi:
"""
This class is a simplifi... | nassendelft/google-play-cli | google_play_api.py | Python | gpl-3.0 | 9,616 |
from rasa_nlu.model import Interpreter
import json, os, requests
interpreter = Interpreter.load("./models/current/nlu")
responses = ["Mi spiace non ho trovato risutati", "il risultato è {}"]
params = {}
def do_convert(params):
curr_from = params.get("from", "EUR")
curr_to = params.get("to","BTC")
curr_... | Ventrosky/python-scripts | nlp-scripts/crypto-converter/handler.py | Python | gpl-3.0 | 1,828 |
from unittest import TestCase
from hamcrest import *
from array_util import get_random_array
from chapter02.exercise2_1_2 import nonincreasing_insertion_sort
from datastructures.array import Array
class TestExercise2_1_2(TestCase):
def test_nonincreasing_insertion_sort(self):
array, elements = get_rand... | wojtask/CormenPy | test/test_chapter02/test_exercise2_1_2.py | Python | gpl-3.0 | 498 |
# -*- coding: utf-8 -*-
from main_func import main
main('./datos_filtrados/albanella/1',1000,1.8)
main('./datos_filtrados/albanella/2',500,0.5)
#main('./datos_filtrados/Erithacus rubecula_Robin',300,2)
| gabrevaya/Canto5 | prueba.py | Python | gpl-3.0 | 206 |
#!/usr/bin/env python
# Pandigital Multiples:
# n * 1, n * 2, n*... concatenated include all digits 1..9
# Find the largest one...
def is_prime(n):
if(n==2 or n==3): return True
if(n % 2 == 0): return False
if(n % 3 == 0): return False
if(n < 2): return False
if(n < 9): return True
maxpossible = int(n**0.5)
f... | nayrbnayrb/projecteuler | 0038/0038.py | Python | gpl-3.0 | 1,565 |
#!/usr/bin/env python
# -*- coding:Utf-8 -*-
# cxm - Clustered Xen Management API and tools
# Copyleft 2010-2012 - Nicolas AGIUS <nicolas.agius@lps-it.fr>
###########################################################################
#
# This file is part of cxm.
#
# cxm is free software: you can redistribute it and/or ... | nagius/cxm | tests/metrics_test.py | Python | gpl-3.0 | 17,586 |
#!/usr/bin/env python
''' pickelIterator '''
# (C)opyrights 2008 - 2015 by Albert Weichselbraun <albert@weichselbraun.net>
#
# 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... | weblyzard/ewrt | src/eWRT/util/pickleIterator.py | Python | gpl-3.0 | 2,781 |
'''
Created on 14 ago 2015
Rev 3.0
@author: Righetz,M
'''
import glob
import json
import os
class Engine():
'''
File saving,file loading,file deletion
'''
path = 'data/'
def get_payloads(self):
'''
get current file list from default directory and return payload list
'''
... | mes3hacklab/payload-manager | src/Engine.py | Python | gpl-3.0 | 1,954 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('game', '0004_auto_20150227_1059'),
]
operations = [
migrations.RemoveField(
model_name='goal',
... | gnunixon/sport-news-writer | writer/game/migrations/0005_auto_20150227_1100.py | Python | gpl-3.0 | 595 |
# __author__ = 'huqinghua'
import os
import Dui4Win
from Dui4Win import *
def PyAppLaunch():
Dui4Win.Run()
if __name__ == "__main__":
PyAppLaunch()
| huqinghua/pyui4win | Tamplate/AppLaunch.py | Python | gpl-3.0 | 177 |
"""This package provides helpers for use in tests.
In addition to the contents of the root module, there are three other
modules in this package:
* randomize - helpers for randomize testing
* example_data - example data for use in tests
* feed - helpers for working with feeds
"""
from ironblogger.app impo... | zenhack/iron-blogger2 | tests/util/__init__.py | Python | gpl-3.0 | 1,000 |