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 |
|---|---|---|---|---|---|
import numpy as np
from dec.grid2 import Grid_2D, basis_fn
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d
g = Grid_2D.periodic(7, 7)
X = np.linspace(g.gx.xmin, g.gx.xmax, 100)
Y = np.linspace(g.gy.xmin, g.gy.xmax, 100)
X, Y = np.meshgrid(X, Y)
B = basis_fn(g.gx.dec.B, g.gy.dec.B)
fig = plt.fi... | drufat/dec | doc/plot/cheb/basis_forms_2d.py | Python | gpl-3.0 | 1,285 |
#!/usr/bin/env python
'''
kicad-footprint-generator 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.
kicad-footprint-generator is distribute... | SchrodingersGat/kicad-footprint-generator | scripts/Connector/Connector_Molex/conn_molex_micro-fit-3.0_tht_top_dual_row.py | Python | gpl-3.0 | 11,943 |
# encoding=utf-8
'''Document content post-processing.'''
import abc
import codecs
import gettext
import io
import logging
import os.path
import shutil
from wpull.backport.logging import BraceMessage as __
from wpull.database.base import NotFound
from wpull.document.htmlparse.element import Comment, Element, Doctype
fr... | bright-sparks/wpull | wpull/converter.py | Python | gpl-3.0 | 10,755 |
# -*- coding: utf-8 -*-
# This file is part of corvogame.
#
# corvogame 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.
... | igoralmeida/corvogame | client/games/wargame_client.py | Python | gpl-3.0 | 1,978 |
import pytest
import numpy as np
import matplotlib.pyplot as plt
from aneris.control.factory import InterfaceFactory
from dtocean_core.core import (AutoFileInput,
AutoFileOutput,
AutoPlot,
Core)
from dtocean_core.data import ... | DTOcean/dtocean-core | tests/test_data_definitions_xgrid2d.py | Python | gpl-3.0 | 4,013 |
from routes import API_PATH
from routes.base import BaseBlueprint
from routes.workers.worker import WorkersRoute, WorkerCheckinRoute
class Blueprint(BaseBlueprint):
def __init__(self):
super().__init__("workers", __name__, url_prefix=f"{API_PATH}/workers")
self.register_route(WorkersRoute())
... | openzim/zimfarm | dispatcher/backend/src/routes/workers/__init__.py | Python | gpl-3.0 | 366 |
# coding:utf-8
def test_1():
'''
1,2,3,4组成无重复的三位数
'''
for a in range(1, 5):
for b in range(1, 5):
for c in range(1, 5):
if (a!=b) and (b!=c) and (a!=c):
print(a,b,c)
print('\n------------test_1 END---------------\n')
def test_2()... | xiejian1985/Test | 100_Python.py | Python | gpl-3.0 | 2,354 |
# -*- coding: utf-8 -*-
## src/search_window.py
##
## Copyright (C) 2007 Stephan Erb <steve-e AT h3c.de>
## Copyright (C) 2007-2014 Yann Leboulanger <asterix AT lagaule.org>
##
## This file is part of Gajim.
##
## Gajim is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Pub... | lovetox/gajim | src/search_window.py | Python | gpl-3.0 | 9,270 |
"""
ex_compound_nomo_1.py
Compound nomograph: (A+B)/E=F/(CD)
Copyright (C) 2007-2009 Leif Roschier
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 L... | dbaynard/pynomo | examples/ex_compound_nomo_1.py | Python | gpl-3.0 | 4,466 |
from pyramid.response import Response
from pyramid.view import view_config, view_defaults
from sqlalchemy.exc import DBAPIError
from pyramid.httpexceptions import HTTPFound
from pyramid.security import Everyone, Authenticated
from .models import (
DBSession,
get_operator,
asdict,
alog,
)
import ... | stephanellis/netmanager | netmanager/views_settings.py | Python | gpl-3.0 | 2,305 |
import multiprocessing
bind = "unix:/run/www-sockets/www-ticketing/admin.sock"
pidfile = "/run/www-sockets/www-ticketing/admin.pid"
workers = 1
syslog = True
syslog_facility = "local5"
pythonpath = 'deploy'
| danielrichman/snowball-ticketing | deploy/gunicorn_config_admin.py | Python | gpl-3.0 | 208 |
#task_H
def dijkstra(start, graph):
n = len(graph)
D = [None] * n
D[start] = 0
index = 0
Q = [start]
while index < len(Q):
v = Q[index]
index += 1
for u in graph[v]:
if D[u] == None or D[v] + min(graph[v][u]) < D[u]:
D[u] = D[v] + min(graph[v][u])
Q.append(u)
return D
def reverse(graph):
n = l... | Senbjorn/mipt_lab_2016 | lab_19/task_H.py | Python | gpl-3.0 | 1,281 |
#!c:\users\montes\documents\github\fluid-designer\win64-vc\2.78\python\bin\python.exe
#
# The Python Imaging Library
# $Id$
#
# this demo script creates four windows containing an image and a slider.
# drag the slider to modify the image.
#
try:
from tkinter import Tk, Toplevel, Frame, Label, Scale, HORIZONTAL
exc... | Microvellum/Fluid-Designer | win64-vc/2.78/Python/Scripts/enhancer.py | Python | gpl-3.0 | 1,649 |
#!/usr/bin/python3
# Copyright (C) 2016 Harold Grovesteen
#
# This file is part of SATK.
#
# SATK 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 ... | s390guy/SATK | tools/bfp_float.py | Python | gpl-3.0 | 4,854 |
# -*- coding: utf-8 -*-
"""
anparser - an Open Source Android Artifact Parser
Copyright (C) 2015 Preston Miller
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
(a... | anparser/anparser | anparser/plugins/other_plugins/yara_parser.py | Python | gpl-3.0 | 3,312 |
# Generated by Django 2.0 on 2018-02-20 13:56
from django.db import migrations
def copy_owner_data(apps, schema_editor):
Secret = apps.get_model('secrets', 'Secret')
for secret in Secret.objects.all():
secret.allowed_groups.add(*list(secret.owner_groups.all()))
secret.allowed_users.add(*list(... | trehn/teamvault | teamvault/apps/secrets/migrations/0020_auto_20180220_1356.py | Python | gpl-3.0 | 752 |
#!/usr/bin/env python3
import random
"""
Map generating code using voronoi polygons.
Copyright (C) 2017 Alexander Walker Hinds
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, e... | DarkPurple141/Maps | MapGen/geom.py | Python | gpl-3.0 | 2,797 |
#!/usr/bin/env python3
'''
.train <train station>
get irish rail train state times
'''
import requests
import re
from operator import itemgetter
from xml.etree import ElementTree
from formatting import *
__author__ = 'izaakf'
COMMAND = 'train'
NAMESPACES = {'realtime': 'http://api.irishrail.ie/realtime/'}
REALTIME... | sentriz/steely | steely/plugins/train.py | Python | gpl-3.0 | 2,407 |
import click
from seaflowpy import seaflowfile
from seaflowpy import errors
@click.command()
@click.option('-v', '--verbose', is_flag=True,
help='Print 3 columns: input path, file name, day of year dir.')
@click.argument('files', nargs=-1, type=click.Path())
def dayofyear_cmd(verbose, files):
"""
Gets cal... | armbrustlab/seaflowpy | src/seaflowpy/cli/commands/dayofyear_cmd.py | Python | gpl-3.0 | 1,025 |
from test.classes.ball_detector.BallDetector import BallDetector
from test.classes.ball_detector.BounceCalculator import BounceCalculator
from test.classes.ball_detector.Extrapolator import Extrapolator
from test.classes.utils.Ball import Ball
from test.classes.utils.BallHistory import BallHistory
VERTICAL_THRESHOLD ... | Centre-Alt-Rendiment-Esportiu/att | src/python/test/classes/BallTracker.py | Python | gpl-3.0 | 2,078 |
""" This Modules allows to manage the blocked callers as an web application that can be access using the WSGI-Standard.
""" | synox/telewall | telewall/telewall/web/__init__.py | Python | gpl-3.0 | 123 |
# -*- coding: utf-8 -*-
from src.api.identityset import IdentitySet
from . import common
from . import errors
class LabelInfo(object):
"""Class describing label information"""
def __init__(self, label, addr, basic_block=None, position=0):
"""Stores the label name, the address counter into memory (ra... | boriel/zxbasic | src/arch/z80/optimizer/labelinfo.py | Python | gpl-3.0 | 704 |
# -*- coding: utf-8 -*-
"""
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 distributed in... | estaban/pyload | module/plugins/hoster/FilepostCom.py | Python | gpl-3.0 | 6,081 |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2008 Doug Hellmann All rights reserved.
#
"""Daemon vs. non-daemon threads.
"""
#end_pymotw_header
import threading
import time
import logging
logging.basicConfig(level=logging.DEBUG,
format='(%(threadName)-10s) %(message)s',
... | qilicun/python | python2/PyMOTW-1.132/PyMOTW/threading/threading_daemon.py | Python | gpl-3.0 | 649 |
#!/usr/bin/python
from sys import argv
from modules.helpers.wpdetector import WordpressDetector
from modules.net.scan import is_good_response
from modules.const import ERR, NO, OK, INFO
def main ():
if len (argv) > 1:
print INFO + 'Checking site...'
if not is_good_response (argv [1]):
print ERR + 'Site is ... | doctorrabb/badtheme | detector.py | Python | gpl-3.0 | 949 |
# -*- 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 'Cluster.image_user'
db.add_column(u'elasticluster_base_cluster', 'image_user',
... | gc3-uzh-ch/elasticluster-web | elasticluster_base/migrations/0012_auto__add_field_cluster_image_user.py | Python | gpl-3.0 | 8,212 |
# -*- mode: python; coding: utf-8 -*-
#
# Copyright 2011 Andrej A Antonov <polymorphm@gmail.com>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (... | polymorphm/php-miniprog-shell | lib_php_miniprog_shell_2011_12_17/main.py | Python | gpl-3.0 | 4,746 |
from .node import Node
class Function(Node):
def __init__(self, file, position, access, comments, name, children):
super(Function, self).__init__(file, position, access, comments, children)
self.name = name
| gfelbing/cppstyle | cppstyle/model/function.py | Python | gpl-3.0 | 229 |
from ecl import EclPrototype
def cmp_method(method):
def cmp_wrapper(self, other):
if not isinstance(other, Version):
other = Version(other[0], other[1], other[2])
return method(self, other)
return cmp_wrapper
class Version(object):
def __init__(self, major, minor, micro... | OPM/ResInsight | ThirdParty/Ert/python/ecl/util/util/version.py | Python | gpl-3.0 | 3,470 |
"""Classes to handle information from residue topology files"""
import _modeller
__docformat__ = "epytext en"
class Topology(object):
"""All information from a residue topology file. You should never need to
create a L{Topology} object yourself - one is created for you by the
L{environ} class, e.g.... | bjornwallner/proq2-server | apps/modeller9v8/modlib/modeller/topology.py | Python | gpl-3.0 | 2,065 |
class Solution(object):
def imageSmoother(self, M):
"""
:type M: List[List[int]]
:rtype: List[List[int]]
"""
row, col = len(M), len(M[0])
ans = [[0]*col for i in xrange(row)]
for i in xrange(row):
for j in xrange(col):
cnt = 0
... | YiqunPeng/Leetcode-pyq | solutions/661ImageSmoother.py | Python | gpl-3.0 | 684 |
import numpy as np
class SubstitutionMatrix():
def __init__(self):
pass
def __getitem__(self, tup):
y, x = tup
return self.matrix[self.alphabet.index(y)][self.alphabet.index(x)]
class Blosum62(SubstitutionMatrix):
def __init__(self):
SubstitutionMatrix.__init__(self)
... | glaunay/pyproteins | src/pyproteins/alignment/scoringMatrix.py | Python | gpl-3.0 | 3,051 |
"""
Copyright 2011 Marcus Fedarko
Contact Email: marcus.fedarko@gmail.com
This file is part of CAIP.
CAIP 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) ... | fedarko/CAIP | Code/LevelReader.py | Python | gpl-3.0 | 1,886 |
# Copyright 2010-2021 Richard Dymond (rjdymond@gmail.com)
#
# This file is part of SkoolKit.
#
# SkoolKit 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... | skoolkid/skoolkit | skoolkit/skoolctl.py | Python | gpl-3.0 | 29,525 |
###############################################################################
# ilastik: interactive learning and segmentation toolkit
#
# Copyright (C) 2011-2014, the ilastik developers
# <team@ilastik.org>
#
# This program is free software; you can redistribute it and/or
# mod... | ilastikdev/ilastik | ilastik/applets/counting/countingGui.py | Python | gpl-3.0 | 69,303 |
from datetime import datetime
from elasticsearch import Elasticsearch
es = Elasticsearch()
doc = {
'author': 'kimchy',
'text': 'Elasticsearch: cool. bonsai cool.',
'timestamp': datetime.now(),
}
res = es.index(index="test-index", doc_type='tweet', id=1, body=doc)
#print(res['created'])
res = es.get(index... | davidam/python-examples | elasticsearch/elasticsearch-example.py | Python | gpl-3.0 | 635 |
# coding=utf-8
"""TV base class."""
from __future__ import unicode_literals
import threading
from builtins import object
from medusa.indexers.config import INDEXER_TVDBV2
class Identifier(object):
"""Base identifier class."""
def __bool__(self):
"""Magic method."""
raise NotImplementedError... | pymedusa/Medusa | medusa/tv/base.py | Python | gpl-3.0 | 2,581 |
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import flt, nowdate
import erpnext
from erpnext.accounts.doctype.journal_entry.journal_entry import ge... | mhbu50/erpnext | erpnext/hr/doctype/employee_advance/employee_advance.py | Python | gpl-3.0 | 8,463 |
# -*- coding: utf-8 -*-
# Use this file to easily define all of your cron jobs.
#
# It's helpful to understand cron before proceeding.
# http://en.wikipedia.org/wiki/Cron
#
# Learn more: http://github.com/fengsp/plan
from plan import Plan
cron = Plan()
# register one command, script or module
# cron.command('comman... | supergis/git_notebook | other/schedule.py | Python | gpl-3.0 | 515 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# bioGUI documentation build configuration file, created by
# sphinx-quickstart on Wed Jan 11 11:08:00 2017.
#
# 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
# aut... | mjoppich/bioGUI | doc/conf.py | Python | gpl-3.0 | 4,734 |
from binary_tree_prototype import BinaryTreeNode
# @include
class BinarySearchTree:
def __init__(self):
self._root = None
# @exclude
def empty(self):
return self._root is None
# @include
def insert(self, key):
if self.empty():
self._root = BinaryTreeNode(key)... | meisamhe/GPLshared | Programming/MPI — AMath 483 583, Spring 2013 1.0 documentation_files/insertion_deletion_bst.py | Python | gpl-3.0 | 3,515 |
#!/usr/bin/python
import logging
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
import procgame.game, sys, os
import procgame.config
import random
import procgame.sound
sys.path.insert(0,os.path.pardir)
import bingo_emulator.common.units as units
import bingo_em... | bingopodcast/bingos | bingo_emulator/spelling_bee/game.py | Python | gpl-3.0 | 36,799 |
# -*- coding: utf-8 -*-
# Copyright (c) 2012 - 2014 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing a specialized line edit for entering IRC messages.
"""
from __future__ import unicode_literals
from PyQt5.QtCore import Qt, qVersion
from E5Gui.E5LineEdit import E5LineEdit, E5ClearableLineEdit... | davy39/eric | Network/IRC/IrcMessageEdit.py | Python | gpl-3.0 | 4,486 |
import warnings
from .file import File, open, read, create, write, CfitsioError
try:
from healpix import read_map, read_mask
except:
warnings.warn('Cannot import read_map and read_mask if healpy is not installed')
pass
| zonca/pycfitsio | pycfitsio/__init__.py | Python | gpl-3.0 | 234 |
from flask import render_template
from flask import url_for
from flask import redirect
from flask import request
from datetime import datetime
from flask_login import current_user, login_required
from classes.operations.person_operations import person_operations
from classes.operations.project_operations import project... | itucsdb1611/itucsdb1611 | templates_operations/personal/default.py | Python | gpl-3.0 | 8,587 |
#!/usr/bin/env python3
"""
Main NPF testie runner program
"""
import argparse
import errno
import sys
from npf import npf
from npf.regression import *
from npf.statistics import Statistics
from npf.testie import Testie, ScriptInitException
def main():
parser = argparse.ArgumentParser(description='NPF Testie run... | tbarbette/clickwatcher | npf_run.py | Python | gpl-3.0 | 11,804 |
from django.db import models
from jsonfield import JSONField
class Sensor(models.Model):
name = models.CharField(max_length=25)
activated = models.BooleanField(default=False)
type = models.CharField(max_length=10)
meta = JSONField()
| skitoo/chac | chac/sensors/models.py | Python | gpl-3.0 | 251 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
############## IMPORTS ##################
from __future__ import print_function
from os import path
from sys import argv, exit
from colorama import init as initColorama
from colorama import Fore, Style
from struct import pack
from binascii import unhexlify as unHex
#########... | sadboyzvone/8080py | bin/8080.py | Python | gpl-3.0 | 13,651 |
# -*- coding: utf-8 -*-
##############################################################################
##############################################################################
{
'name': 'Account Banking Netixis Direct Debit',
'summary': 'Create Natixis files for Direct Debit',
'version': '7.0.0.2.0',... | noemis-fr/custom | account_banking_natixis_direct_debit/__openerp__.py | Python | gpl-3.0 | 1,248 |
#
# Copyright (c) 2017, Paul Baker <paul@paulbaker.id.au>
#
# This file is part of Ansible
#
# Ansible 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... | tsdmgz/ansible | lib/ansible/module_utils/ironware.py | Python | gpl-3.0 | 3,511 |
import pygame
import src.colours as colours
import random
from pygame.math import Vector2
from src.entity import Entity
from src.game_object.particle import Particle
from src.game_object.particle_factory import ParticleFactory
class ParticleEmitter(Entity):
def __init__(self, x, y, level, emits):
Entity._... | joereynolds/Mr-Figs | src/game_object/particle_emitter.py | Python | gpl-3.0 | 1,025 |
"""Classify changes in Ansible code."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import collections
import os
import re
import time
from . import types as t
from .target import (
walk_module_targets,
walk_integration_targets,
walk_units_targets,
walk_com... | toshywoshy/ansible | test/lib/ansible_test/_internal/classification.py | Python | gpl-3.0 | 32,223 |
#######################################################################################################################
# Copyright (C) 2016 Regents of the University of California
#
# This is free software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License (GNU GPL) as publi... | ProjectIDA/ical | gui/analysis_progress_window.py | Python | gpl-3.0 | 4,458 |
#http://blog.dreamshire.com/project-euler-104-solution/
from projecteuler import is_pandigital
def top_digits(n):
t = n * 0.20898764024997873 + (-0.3494850021680094)
t = int((pow(10, t - int(t) + 8)))
return t
fk, f0, f1 = 2, 1, 1
while not is_pandigital(f1) or not is_pandigital(top_digits(fk)):
f0... | paulmcquad/projecteuler | 100-200/problem104.py | Python | gpl-3.0 | 400 |
import argparse
import numpy as np
import scipy.optimize as opt
from numpy import sqrt, pi, cos, sin, dot, cross, arccos, degrees
from numpy import float as nfl
from numpy.linalg import norm
def radius_of_gyr(traj):
N = len(traj)
diff=np.zeros((N**2))
count=0
for i in traj:
for j in traj:
... | fgrunewald/Martini_PolyPly | polyply/structure_tool/analysis_funtions.py | Python | gpl-3.0 | 529 |
# Copyright (c) 2014, Georgios Is. Detorakis (gdetor@gmail.com) and
# Nicolas P. Rougier (nicolas.rougier@inria.fr)
# 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. Redis... | gdetor/SI-RF-Structure | Statistics/weights-evo.py | Python | gpl-3.0 | 4,698 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
import json
HONEYPOT_CHANGES_PERCENTAGE = 11
def files_check():
try:
file1 = open(sys.argv[1], "rb").read()
except Exception as _:
sys.exit(print("cannot open the file, {0}".format(sys.argv[1])))
t... | Nettacker/Nettacker | lib/payload/scanner/ics_honeypot/changes_percentage.py | Python | gpl-3.0 | 1,608 |
import logging
import googleOAuth
#Map the specific provider functions to provider choices
# Additional providers must be added in here
ProviderAuthMap = {
"google": googleOAuth.SignIn
}
ProviderAccessMap = {
"google": googleOAuth.GetAccessToken
}
#------------------------------------------------------------------... | benfinkelcbt/OAuthLibrary | 2016-04-01/oauth.py | Python | gpl-3.0 | 1,891 |
#!/usr/bin/env python
#
# Copyright 2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your option)
# ... | stwunsch/volk-sfmt | gen/volk_sfmt_tmpl_utils.py | Python | gpl-3.0 | 2,435 |
from .oauth import BaseOAuth2
class EventbriteOAuth2(BaseOAuth2):
"""Eventbrite OAuth2 authentication backend"""
name = 'eventbrite'
AUTHORIZATION_URL = 'https://www.eventbrite.com/oauth/authorize'
ACCESS_TOKEN_URL = 'https://www.eventbrite.com/oauth/token'
METADATA_URL = 'https://www.eventbriteap... | abhikumar22/MYBLOG | blg/Lib/site-packages/social_core/backends/eventbrite.py | Python | gpl-3.0 | 1,055 |
# Python program for transitive closure using Floyd Warshall Algorithm
#Complexity : O(V^3)
# http://www.geeksforgeeks.org/transitive-closure-of-a-graph/
from collections import defaultdict
import sys
#Class to represent a graph
class Graph:
def __init__(self, vertices):
self.V = vertices
# A u... | tristan-hunt/UVaProblems | graph_theory/airline_comparison.py | Python | gpl-3.0 | 2,226 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013,2014 Rodolphe Quiédeville <rodolphe@quiedeville.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 ver... | rodo/django-perf | foo/loader/management/commands/import.py | Python | gpl-3.0 | 4,247 |
# Copyright (C) 2015-2020 East Asian Observatory
# All Rights Reserved.
#
# 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... | eaobservatory/hedwig | lib/hedwig/view/base.py | Python | gpl-3.0 | 2,453 |
import webbrowser
# keep in mind that it can also be used for the other queries like loggin into the particular websites.
# These all moduels are under progress,
# Development module will be started building after 30 november 2016, !
# TODO : Social Media Access like facebook , Instagram and others
class Socia... | shafaypro/PYSHA | _SocialMedia.py | Python | gpl-3.0 | 2,345 |
from __future__ import absolute_import, unicode_literals
import os
import re
import sys
from userpage.jieba1 import jieba
import pickle
from .._compat import *
from .viterbi import viterbi
PROB_START_P = "prob_start.p"
PROB_TRANS_P = "prob_trans.p"
PROB_EMIT_P = "prob_emit.p"
CHAR_STATE_TAB_P = "char_state_tab.p"
re_... | zzz14/LOST-FOUND | userpage/jieba1/jieba/posseg/__init__.py | Python | gpl-3.0 | 9,036 |
from __future__ import unicode_literals
import pytest
from mock import Mock
from django.utils import six
from nav.eventengine.config import EventEngineConfig
from nav.eventengine.engine import EventEngine
from nav.eventengine.plugin import UnsupportedEvent, EventHandler
from nav.eventengine.plugin import _find_package... | hmpf/nav | tests/unittests/eventengine/plugin_test.py | Python | gpl-3.0 | 2,039 |
from django.contrib import admin
from .models import Type_Of_Crime
admin.site.register(Type_Of_Crime)
# Register your models here.
| shudwi/CrimeMap | Type_Of_Crime/admin.py | Python | gpl-3.0 | 131 |
from django_assets import register
from django_eks.assets import actualis_css, actualis_js, actualis_js_min
from django.conf import settings
register('core_css', actualis_css)
if settings.DEBUG:
register('core_js', actualis_js)
else:
register('core_js', actualis_js_min)
| icelic/eks | py/eks/core/assets.py | Python | gpl-3.0 | 282 |
#!/usr/bin/env python3
"""
Given two Bibles all in one file (with books and verses in any order), with one
verse per line, with lines like this:
BOOK_chapter_verse{TAB}Text of verse goes here...
... print out which verses are present in the first Bible but missing in the
second, and vice-versa.
"""
import sys
impo... | alexrudnick/terere | bibletools/unify_bibles.py | Python | gpl-3.0 | 1,141 |
# -*- coding: utf-8 -*-
import re
from module.plugins.Account import Account
class UlozTo(Account):
__name__ = "UlozTo"
__version__ = "0.04"
__type__ = "account"
__description__ = """uloz.to account plugin"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
TRAFF... | Rusk85/pyload | module/plugins/accounts/UlozTo.py | Python | gpl-3.0 | 1,341 |
#!/usr/bin/env python
"""
Code to read a squid log file
Sample usage:
f = SquidLog('access.log.1.gz')
for l in f:
print l.ts, l.remhost, l.url
AJC Nov 2007
"""
import gzip
import time
import sys
import operator
# time format for pretty-printing log files
_time_format... | emmdim/guifiAnalyzer | lib/squidlog/squidlog.py | Python | gpl-3.0 | 4,111 |
# Copyright (C) 2013 Johnny Vestergaard <jkv@unixcluster.dk>
#
# 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 p... | honeynet/beeswarm | beeswarm/drones/client/baits/pop3.py | Python | gpl-3.0 | 3,174 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# put out the time (in seconds) before the medium-term signing Tor certs expires
# appropriate cron job:
# @daily let n="$(key-expires.py /var/lib/tor/data/keys/ed25519_signing_cert) / 86400"; [[ $n -lt 35 ]] && echo "Tor cert expires in less than $n day(s)"
import co... | toralf/torutils | key-expires.py | Python | gpl-3.0 | 610 |
from box_spring import init_prms, solve
from scitools.std import *
def plot_S(S, t, step):
first_plot_step = 10 # skip the first steps
if step < first_plot_step:
return
tcoor = linspace(0, t, step+1) # t = dt*step
S = array(S[:len(tcoor)])
Y = w(tcoor) - L - S - b/2.0 # (w, ... | qilicun/python | python3/src/box_spring/box_spring_plot.py | Python | gpl-3.0 | 1,944 |
# -*- coding: utf-8 -*-
"""
Comprehensive tests of loading data into a Minerva database.
"""
import datetime
from contextlib import closing
import pytz
from minerva.storage.inputdescriptor import InputDescriptor
from minerva.storage.trend.trendstorepart import TrendStorePart
from minerva.test import clear_database
fr... | hendrikx-itc/python-minerva | integration_tests/test_data_loading.py | Python | gpl-3.0 | 5,876 |
#!/usr/bin/env python
import numpy as np
from horton import *
# specify the even tempered basis set
alpha_low = 5e-3
alpha_high = 5e2
nbasis = 30
lnratio = (np.log(alpha_high) - np.log(alpha_low))/(nbasis-1)
# build a list of "contractions". These aren't real contractions as every
# contraction only contains one bas... | eustislab/horton | data/examples/hamiltonian/even_tempered_li.py | Python | gpl-3.0 | 725 |
# (c) 2015, Alice Ferrazzi <alice.ferrazzi@gmail.com>
#
# This file is part of Eisen
#
# Eisen 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 v... | eisen-dev/eisen_engine | core/mysql_config.py | Python | gpl-3.0 | 1,454 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2017/3/5
# @Author : Leon.Nie
# @Site :
# @File : formation.py
"""
Drones proceed in formation base on the algorithm Artificial Potential Field
"""
from geo_tools import *
import numpy as np
import logging
import logging.config
logging.config.fileConfi... | LeonNie52/dk-plus | formation.py | Python | gpl-3.0 | 20,767 |
def all_substr(string):
s = set()
length = len(string)
for i in range(length):
for j in range(i, length + 1):
s.add(string[i:j])
return s
def compr(string, substring):
l = len(substring)
c = string.count(substring)
return len(string) - c * (l-1) + l
def min_enc(string... | JonSteinn/Kattis-Solutions | src/Red Rover/Python 3/rr.py | Python | gpl-3.0 | 479 |
test = {
'name': 'Question 4',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
>>> rows7 = {('Joey', 7), ('Henry', 7)}
>>> rows6 = {('Ian', 6), ('Joyce', 6)}
>>> q4_answer[0] == ("John", 8)
True
>>> all([tuple(row) in rows7 fo... | DS-100/sp17-materials | sp17/labs/lab06/ok_tests/q4.py | Python | gpl-3.0 | 642 |
from django.test import TestCase, RequestFactory
from ddah_web.models import DDAHTemplate, DDAHInstanceWeb
from ddah_web import read_template_as_string
from ddah_web.views import MoustacheTemplateResponse
class InstanceTemplateTestCase(TestCase):
'''There is a template which contains the html to be represented us... | ciudadanointeligente/deldichoalhecho | ddah_web/tests/instance_template_tests.py | Python | gpl-3.0 | 3,123 |
import Tkinter as tk
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure
from matplotlib import pyplot as plt
import matplotlib.animation as animation
import datetime
import ttk
import threading
import time
import numpy as np
class lakeshore_measure_frame(tk.Fra... | Natetempid/nearfield | GUI_Layout_1/GUI_Layout_1/frame_lakeshore_measure.py | Python | gpl-3.0 | 16,681 |
#!/usr/bin/env python3
import apts
from distutils.core import setup
setup(
name = apts.__name__,
packages = [apts.__name__],
scripts = ['bin/apts'],
version = apts.__version__,
description = apts.__description__,
author = apts.__author__,
author_email = apts.__author_email__,
license ... | Ilias95/apts | setup.py | Python | gpl-3.0 | 1,102 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
================================================================================
mingus - Music theory Python package, Instrument module
Copyright (C) 2008-2009, Bart Spaans
This program is free software: you can redistribute it and/or modify
it under the... | edudobay/mingus | mingus/containers/Instrument.py | Python | gpl-3.0 | 7,067 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
## This file is part of the pyui generator project
#Copyright (C) 2012 by elmamyra
#
#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 ... | elmamyra/pyui-generator | pyuiGenerator_app/dialogAddMulti.py | Python | gpl-3.0 | 2,973 |
'''
Created on Jun 6, 2012
@author: vr274
'''
import numpy as np
from generic import TakestepSlice, TakestepInterface
from pele.utils import rotations
__all__ = ["RandomDisplacement", "UniformDisplacement",
"RotationalDisplacement", "RandomCluster"]
class RandomDisplacement(TakestepSlice):
'''Random... | js850/pele | pele/takestep/displace.py | Python | gpl-3.0 | 2,126 |
# import string
import random as std_random
from cloudbot import hook
try:
# noinspection PyUnresolvedReferences
from Crypto.Random import random
gen = random.StrongRandom()
except ImportError:
# Just use the regular random module, not the strong one
gen = std_random.SystemRandom()
with open("da... | paris-ci/CloudBot | plugins/password.py | Python | gpl-3.0 | 2,551 |
import datetime
from django.db import models
from django.db.models.signals import post_save, post_delete
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.dispatch import receiver
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _... | papedaniel/oioioi | oioioi/forum/models.py | Python | gpl-3.0 | 6,577 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Dead Parrot Scribe
An IRC note taker for those of us pining for the Fjords.
@author Craige McWhirter (craige@mcwhirter.io)
@copyright Copyright (c) 2014 Craige McWhirter
@License GPLv3
"""
import urllib2
from BeautifulSoup import BeautifulSoup
import re
import socket
im... | craigem/deadparrotscribe | DPScribe.py | Python | gpl-3.0 | 4,077 |
# Generated by Django 2.2.9 on 2020-04-03 05:33
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('siteconfig', '0003_auto_20200402_2218'),
]
operations = [
migrations.RenameField(
model_name='siteconfig',
old_name='hackers... | timberline-secondary/hackerspace | src/siteconfig/migrations/0004_auto_20200402_2233.py | Python | gpl-3.0 | 379 |
'''
Created on Oct 18, 2016
@author: Vitoc
'''
import copy
class undoModuleClass:
def __init__(self):
return
'''
Function that undos the operations that you have made
'''
def saveTheFunction(self,l,undo):
undo.append(copy.deepcopy(l))
... | valecs97/Contest | Contest/iteration_3/undoModule.py | Python | gpl-3.0 | 593 |
#!/usr/bin/env python2.6
import sys
import boto
from boto.s3.key import Key
if len(sys.argv) < 3:
print "Not enough arguments"
print "%s <bucket> <prefix>" % sys.argv[0]
sys.exit(1)
s3 = boto.connect_s3()
bucket = s3.get_bucket(sys.argv[1])
for k in bucket.list(sys.argv[2]):
if k.name not in [sys.ar... | markusd/gpgpu | aws/delete-s3-keys.py | Python | gpl-3.0 | 361 |
from PyQt5 import QtCore, QtWidgets
from ngspiceSimulation.pythonPlotting import plotWindow
from ngspiceSimulation.NgspiceWidget import NgspiceWidget
from configuration.Appconfig import Appconfig
from modelEditor.ModelEditor import ModelEditorclass
from subcircuit.Subcircuit import Subcircuit
from maker.makerchip impor... | FOSSEE/eSim | src/frontEnd/DockArea.py | Python | gpl-3.0 | 13,847 |
# 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 +
# pylint: disable=line-too-long, invalid-name... | mganeva/mantid | scripts/PyChop/PyChop2.py | Python | gpl-3.0 | 10,393 |
'''
Given a new mlst version or DB, update the container
'''
import pathlib
import click
import jinja2
import toml
import pendulum
import subprocess
import shlex
def load_template(name):
'''
Return the singularity recipe template as unicode text
'''
template = pathlib.Path(name).read_text()
retur... | MDU-PHL/meningotype | update_meningotype.py | Python | gpl-3.0 | 1,346 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright © 2016 Dominique Barton
#
# This file is part of Dominique Barton's CodeEval solutions.
#
# Dominique Barton's CodeEval solutions are free software: you can redistribute
# it and/or modify it under the terms of the GNU General Public License as
# published by ... | domibarton/CodeEval | number_of_ones.py | Python | gpl-3.0 | 1,060 |
import time
def a(t):
z = []
for x in range(len(t)):
for y in range(len(t[x])):
if t[x][y]==0:
z.append((x,y))
return z
def minimax(t,r=0):
time.sleep(0.5)
print t
print a(t)
return a(t) | Nitesh-the-genius/hahaha-supercomputer | tasks.py | Python | gpl-3.0 | 203 |
# -*- coding: utf-8 -*-
import os
import re
try:
import simplejson as json
except ImportError:
import json
from ToolBoxAssistant.app import AppFactory
from ToolBoxAssistant.helpers import get_svn_url, readfile, find_versionned_folders, yes_no, Color
from ToolBoxAssistant.log import logger
VERSION = '0.1'
cl... | mattoufoutu/ToolBoxAssistant | ToolBoxAssistant/__init__.py | Python | gpl-3.0 | 5,458 |
#
import common
__version__ = common.version
del common
import settings
| russell/slick | slick/__init__.py | Python | gpl-3.0 | 74 |
# -*- coding: utf-8 -*-
"""
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 distributed in... | estaban/pyload | module/plugins/accounts/BitshareCom.py | Python | gpl-3.0 | 1,729 |