code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- 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 i... | HarHar/Futaam | futaam/futaam.py | Python | gpl-3.0 | 6,673 |
"""
Text files to Pandas
"""
import pandas
def txt_to_pandas(csvFile, _delimiter, encoding_='utf8'):
"""
Text file to Pandas Dataframe
"""
return pandas.read_csv(
csvFile, sep=_delimiter, low_memory=False,
#encoding=encoding_
)
| JoaquimPatriarca/senpy-for-gis | gasp/fromtxt/pnd.py | Python | gpl-3.0 | 272 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
import time, posix, daily
data = daily.load("ottawa")
class FloatValue():
__slots__ = ()
def __init__(self, field):
self.fieldIndex = field.index
def __call__(self, fields):
r = fields[self.fieldIndex]
... | endlisnis/weather-records | maxtemp.py | Python | gpl-3.0 | 3,298 |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import json
from datetime import time, timedelta
import dateutil.parser
import pytz
from flask import ses... | DirkHoffmann/indico | indico/web/forms/fields/datetime.py | Python | gpl-3.0 | 14,389 |
# dirtool.py - diff tool for directories
# Copyright (C) 2018 Ingo Ruhnke <grumbel@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 your opt... | Grumbel/dirtool | dirtools/extractor.py | Python | gpl-3.0 | 2,353 |
# Copyright (c) 2014-2015, The Monero Project
#
# All rights reserved.
# This plugin is licensed under the GPL v3 license (see the LICENSE file in the base of
# the project source code). The Monero Project reserves the right to change this license
# in future to match or be compliant with any relicense of the Electru... | Kefkius/scallop | plugins/openalias.py | Python | gpl-3.0 | 9,510 |
import lxml.etree as ET
from GEMEditor.model.classes.cobra import Model, Metabolite, Compartment
from GEMEditor.rw import *
from GEMEditor.rw.compartment import add_compartments, parse_compartments
from GEMEditor.rw.test.ex_compartment import valid_compartment_list
from lxml.etree import Element
def test_parse_compar... | JuBra/GEMEditor | GEMEditor/rw/test/test_compartment_rw.py | Python | gpl-3.0 | 2,169 |
"""
File: algorithms.py
Algorithms configured for profiling.
"""
from profiler import Profiler
def selectionSort(lyst, profiler):
i = 0
while i < len(lyst) - 1: # Do n - 1 searches
minIndex = i # for the largest
j = i + 1
while j < len(lyst)... | gregpuzzles1/Sandbox | Example Programs/Ch_11_Student_Files/Case Study/algorithms.py | Python | gpl-3.0 | 1,983 |
# -*- coding: utf-8 -*-
#
# This file is part of the jabber.at homepage (https://github.com/jabber-at/hp).
#
# This project 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 (... | debalance/hp | hp/core/formfields.py | Python | gpl-3.0 | 5,099 |
import numpy as np
from subprocess import check_output
import os
import subprocess
from subprocess import Popen, PIPE
from Sky_Patch import Coverage
from params import *
#LIST OF LOCATIONS CONSIDERED
for i in range (0, len(obsName)):
tCoverage = []
for dirpath, dirname, files in os.walk(folddir):
for filename in ... | emvarun/followup-and-location | Loop_SkyPatch.py | Python | gpl-3.0 | 681 |
# Given a set of distinct integers, nums, return all possible subsets.
# Note: The solution set must not contain duplicate subsets.
# For example,
# If nums = [1,2,3], a solution is:
# [
# [3],
# [1],
# [2],
# [1,2,3],
# [1,3],
# [2,3],
# [1,2],
# []
# ]
# O(2**n)
def subsets(nums):
res = []
backtrack(re... | marcosfede/algorithms | backtrack/subsets.py | Python | gpl-3.0 | 1,049 |
import unittest
from numpy import array, int8
from numpy.testing import assert_array_equal
import pypuf_helper as ph
class TestTransformID(unittest.TestCase):
def test_01(self):
k = 3
input_test = array([
[1, -1, 1, 1],
[-1, -1, 1, 1]
], dtype=int8)
r... | taudor/pypuf_helper | test/test_transform_id.py | Python | gpl-3.0 | 677 |
import pygame
import src.graphics as graphics
import src.colours as colours
import src.config as config
import src.scenes.scenebase as scene_base
from src.minigames.hunt.input_handler import InputHandler
from src.gui.clickable import Clickable
from src.resolution_asset_sizer import ResolutionAssetSizer
from src.tiled_m... | joereynolds/Mr-Figs | src/minigames/hunt/game.py | Python | gpl-3.0 | 2,622 |
# -*- coding: UTF-8 -*-
"""
Database utilities.
@author: Aurélien Gâteau <aurelien.gateau@free.fr>
@author: Sébastien Renard <sebastien.renard@digitalfox.org>
@license: GPL v3 or later
"""
from datetime import datetime, timedelta
import os
from sqlobject.dberrors import DuplicateEntryError
from sqlobject import SQLOb... | digitalfox/yokadi | yokadi/core/dbutils.py | Python | gpl-3.0 | 6,503 |
from django.shortcuts import render
from django.http import Http404
def index(request):
return render(request, 'map/index.html')
| BrendonKing32/Traffic-Assistant | map/views.py | Python | gpl-3.0 | 135 |
# -*- coding: utf-8 -*-
"""Working with UTM and Lat/Long coordinates
Based on http://home.hiwaay.net/~taylorc/toolbox/geography/geoutm.html
"""
from math import sin, cos, sqrt, tan, pi, floor
__author__ = "P. Tute, C. Taylor"
__maintainer__ = "B. Henne"
__contact__ = "henne@dcsec.uni-hannover.de"
__copyright__ = "(... | bhenne/MoSP | mosp/geo/utm.py | Python | gpl-3.0 | 10,100 |
"""
Given a nested list of integers represented as a string, implement a parser to deserialize it.
Each element is either an integer, or a list -- whose elements may also be integers or other lists.
Note: You may assume that the string is well-formed:
String is non-empty.
String does not contain white spaces.
String... | dichen001/Go4Jobs | JackChen/string/385. Mini Parser.py | Python | gpl-3.0 | 2,721 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2020 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 the h... | ubuntu-core/snapcraft | tests/unit/plugins/v2/test_go.py | Python | gpl-3.0 | 3,433 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Dipl.Tzt. Enno Deimel <ennodotvetatgmxdotnet>
#
# This file is part of gnuvet, published under the GNU General Public License
# version 3 or later (GPLv3+ in short). See the file LICENSE for information.
# Initially created: Fri Apr 23 00:02:26 2010 by: PyQt4 UI code gene... | gnuvet/gnuvet | options_ui.py | Python | gpl-3.0 | 1,879 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : Omero RT
Description : Omero plugin
Date : August 15, 2010
copyright : (C) 2010 by Giuseppe Sucameli (Faunalia)
email : sucameli@faunalia.i... | faunalia/rt_geosisma_offline | Utils.py | Python | gpl-3.0 | 8,122 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
from django.utils.timezone import utc
import translate.storage.base
import pootle_store.fields
import pootle.core.mixins.treeitem
import pootle.core.storage
from django.conf import settings
class ... | Yelp/pootle | pootle/apps/pootle_store/migrations/0001_initial.py | Python | gpl-3.0 | 7,129 |
# Copyright (C) 2009-2010 Alexander Cherniuk <ts33kr@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 your option) any later version.
#
# T... | jabber-at/gajim | src/command_system/framework.py | Python | gpl-3.0 | 12,291 |
from xmlrpc.client import ServerProxy
import sys
def help():
print("Usage : remote_finger [-lmsp] user..")
if __name__ == '__main__':
sys.argv = sys.argv[1:]
if len(sys.argv) == 0:
help()
sys.exit(1)
client = ServerProxy('http://localhost:8000')
print(client.finger(sys.argv))
... | NileshPS/OS-and-Networking-programs | 7_rpc/client.py | Python | gpl-3.0 | 331 |
from django.db import models
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
class Story(models.Model):
title = models.CharField(max_length=256)
created_by = models.ForeignKey(User)
root = models.ForeignKey('StoryNode', related_name='+', null=True)
def get_abs... | yihuang/storymaker | story/models.py | Python | gpl-3.0 | 837 |
#!/usr/bin/env python
import fnmatch
import os
from pathlib import Path
import re
import shlex
import shutil
import subprocess
import sys
import tempfile
import time
from concurrent.futures import ThreadPoolExecutor
from contextlib import contextmanager
from typing import Optional
import click
import git
import typer
... | DIRACGrid/DIRAC | integration_tests.py | Python | gpl-3.0 | 24,355 |
from django.contrib.auth.decorators import user_passes_test
from django.utils.decorators import method_decorator
from django.views.generic.base import TemplateView
def in_students_group(user):
if user:
return user.groups.filter(name='Alumnos').exists()
return False
def in_teachers_group(user):
i... | Videoclases/videoclases | quality_control/views/control_views.py | Python | gpl-3.0 | 1,076 |
# -*- coding: utf-8 -*-
# Copyright 2014-2015 Michael Helmling
#
# 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 module contains classes and helper functions for non-binary cod... | supermihi/lpdec | lpdec/codes/nonbinary.py | Python | gpl-3.0 | 4,273 |
from __future__ import absolute_import
import struct
import logging
from twisted.internet.protocol import Protocol, ServerFactory
from .. import util
class GamespyAuth(Protocol):
def connectionMade(self):
self.log = util.getLogger('gamespy.auth', self)
def dataReceived(self, data):
hdrFmt = '!4s4... | teknogods/eaEmu | eaEmu/gamespy/auth.py | Python | gpl-3.0 | 944 |
import libtcodpy as libtcod
import consts
def find_closest_target(caster, entities, range):
closest_target = None
closest_dist = range + 1
for obj in entities:
if obj.fighter and obj != caster:
dist = caster.distance_to(obj)
if dist < closest_dist:
closest_... | MykeMcG/SummerRoguelike | src/utils.py | Python | gpl-3.0 | 2,363 |
from collections import Counter
def is_subplay(moves, play):
play_counter = Counter()
for m in play[0]:
play_counter[m] += 1
moves_counter = Counter()
for m in moves:
moves_counter[m] += 1
for m, c in moves_counter.items():
if m not in play_counter.keys():
ret... | nimily/backgammon-ai | backgammon/utils.py | Python | gpl-3.0 | 878 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2015 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://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, eithe... | mablae/weblate | weblate/trans/tests/test_machine.py | Python | gpl-3.0 | 10,441 |
# abcpmc 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.
#
# abcpmc is distributed in the hope that it will be useful,
# but WITHOUT A... | jakeret/abcpmc | abcpmc/sampler.py | Python | gpl-3.0 | 11,199 |
import pyxel
from pyxel.ui import Widget
from .constants import OCTAVE_BAR_BACKGROUND_COLOR, OCTAVE_BAR_COLOR
class OctaveBar(Widget):
def __init__(self, parent, x, y):
super().__init__(parent, x, y, 4, 123)
self.add_event_handler("mouse_down", self.__on_mouse_down)
self.add_event_handle... | ferriman/SSandSP | pyxel-test/venv/lib/python3.8/site-packages/pyxel/editor/octave_bar.py | Python | gpl-3.0 | 1,129 |
# -*- coding: utf-8 -*-
# Copyright (C) 2005 Osmo Salomaa
#
# 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 pr... | otsaloma/gaupol | gaupol/agents/format.py | Python | gpl-3.0 | 2,965 |
# coding=utf-8
import unittest
"""414. Third Maximum Number
https://leetcode.com/problems/third-maximum-number/description/
Given a **non-empty** array of integers, return the **third** maximum number
in this array. If it does not exist, return the maximum number. The time
complexity must be in O(n).
**Example 1:** ... | openqt/algorithms | leetcode/python/lc414-third-maximum-number.py | Python | gpl-3.0 | 1,193 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# metalink.py
#
# Code from pm2ml Copyright (C) 2012-2013 Xyne
# Copyright © 2013-2016 Antergos
#
# This file is part of Cnchi.
#
# Cnchi is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#... | Wyn10/Cnchi | cnchi/installation/download/metalink.py | Python | gpl-3.0 | 16,922 |
"""!
@brief Integration-tests for ROCK algorithm.
@authors Andrei Novikov (pyclustering@yandex.ru)
@date 2014-2020
@copyright BSD-3-Clause
"""
import unittest;
import matplotlib;
matplotlib.use('Agg');
from pyclustering.cluster.tests.rock_templates import RockTestTemplates;
from pyclustering.clu... | annoviko/pyclustering | pyclustering/cluster/tests/integration/it_rock.py | Python | gpl-3.0 | 2,770 |
import numpy as np
import h5py
import matplotlib.pyplot as plt
import pyfftw
import bfps
import bfps.tools
import os
from bfps._fluid_base import _fluid_particle_base
class TestField(_fluid_particle_base):
def __init__(
self,
name = 'TestField-v' + bfps.__version__,
work_dir =... | chichilalescu/bfps | tests/test_field_class.py | Python | gpl-3.0 | 6,948 |
# 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 +
from __future__ import (absolute_import, divi... | mganeva/mantid | scripts/Diffraction/isis_powder/routines/run_details.py | Python | gpl-3.0 | 5,875 |
# Copyright (C) 2014 Ivan Koster
#
# This file is part of SublimeYouCompleteMe.
#
# SublimeYouCompleteMe 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 ... | ivankoster/SublimeYouCompleteMe | plugin/settings.py | Python | gpl-3.0 | 1,137 |
while True:
temp = float(input("Un valor valido? "))
if temp > 50 and temp <52:
print("Numero correcto")
print("Intenta nuevamente!") | xbash/LabUNAB | 01_Introduccion/temp3.py | Python | gpl-3.0 | 142 |
from __future__ import print_function, unicode_literals, division, absolute_import
import os
import sys
import string
import random
import hashlib
import logging
import subprocess
from io import StringIO
import config
def valid_path(path):
"""
Returns an expanded, absolute path, or None if the path does not ... | hwkns/macguffin | files/utils.py | Python | gpl-3.0 | 5,724 |
#!/usr/bin/env python3
# Version 1.0
# Author Alexis Blanchet-Cohen
# Date: 09/06/2014
import argparse
import glob
import os
import subprocess
import util
# Read the command line arguments.
parser = argparse.ArgumentParser(description="Generates stringtie scripts.")
parser.add_argument("-s", "--scriptsDirectory", he... | blancha/abcngspipelines | rnaseq/stringtie.py | Python | gpl-3.0 | 3,086 |
import lie_group_diffeo as lgd
import odl
import numpy as np
# Select space and interpolation
space = odl.uniform_discr([-1, -1], [1, 1], [200, 200], interp='linear')
# Select template and target as gaussians
template = space.element(lambda x: np.exp(-(5 * x[0]**2 + x[1]**2) / 0.4**2))
target = space.element(lambda x... | adler-j/lie_grp_diffeo | examples/deformation_closest_pt_2d.py | Python | gpl-3.0 | 3,110 |
import os
import json
from SiteFab.SiteFab import SiteFab
from SiteFab import files
from SiteFab.Plugins import SiteRendering
class JSPosts(SiteRendering):
#@profile
def process(self, unused, site, config):
plugin_name = "js_posts"
js_filename = "js_posts.js"
# configuration
... | ebursztein/SiteFab | plugins/site/rendering/js_post/js_posts.py | Python | gpl-3.0 | 2,312 |
import json
from pprint import pprint
class Event:
"""Event class"""
def __init__(self, time, station, action):
if action not in self.supported_actions:
raise ValueError("unknown action: " + action)
self.time = time
self.station = station
self.action = action
d... | MatthieuMichon/densim | densim/service.py | Python | gpl-3.0 | 2,446 |
print('In submodule.')
x = 3
| zwegner/pythonc | tests/import/submodule.py | Python | gpl-3.0 | 30 |
# Colors
DARKBGCOLOR = tuple([93, 93, 93])
MEDBGCOLOR = tuple([73, 73, 73])
MAYABGCOLOR = tuple([68, 68, 68])
# DPI
DEFAULT_DPI = 96
# Pixel Size is not handled by dpi, use utils.dpiScale()
MARGINS = (2, 2, 2, 2) # default margins left, top, right, bottom
SPACING = 2
SSML = 4 # the regular spacing of each widget, ... | dsparrow27/zoocore | zoo/libs/pyqt/uiconstants.py | Python | gpl-3.0 | 1,709 |
#!/bin/env python2.7
# -*- coding: utf-8 -*-
# This file is part of AT-Platform.
#
# AT-Platform 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 late... | BrainTech/pre-pisak | modules/radio.py | Python | gpl-3.0 | 19,479 |
# -*- coding: utf-8 -*-
#-----------------------------------------------------------------------------
# (C) British Crown Copyright 2012-5 Met Office.
#
# This file is part of Rose, a framework for meteorological suites.
#
# Rose is free software: you can redistribute it and/or modify
# it under the terms of the GNU G... | ScottWales/rose | lib/python/rose/upgrade.py | Python | gpl-3.0 | 26,666 |
try:from scipy.io.numpyio import *
except ImportError: from extra.numpyio import *
import os
from time import strftime
import shutil
class getpoints:
def __init__(self, elfile):
datetime = strftime("%Y-%m-%d %H:%M:%S").replace(' ', '_')
self.elfile = elfile
if os.path.isfile(elfile) == Tru... | badbytes/pymeg | pdf2py/el.py | Python | gpl-3.0 | 2,695 |
# $Id: VerifyType.py,v 1.4 2005/11/02 22:26:08 tavis_rudd Exp $
"""Functions to verify an argument's type
Meta-Data
================================================================================
Author: Mike Orr <iron@mso.oz.net>
License: This software is released for unlimited distribution under the
terms ... | mikel-egana-aranguren/SADI-Galaxy-Docker | galaxy-dist/eggs/Cheetah-2.2.2-py2.7-linux-x86_64-ucs4.egg/Cheetah/Utils/VerifyType.py | Python | gpl-3.0 | 2,938 |
from turtle import *
from math import *
from os import system
def save():
getcanvas().postscript(file=name+".ps")
system("ps2pdf "+name+".ps "+name+".pdf")
def quit():
Screen().bye()
def hypotrochoid(R, r, d, iteration):
x, y, up = 0, 0, 1
penup(); fillcolor("green")
while iteration:
theta = iteration/... | YufeiZhang/Principles-of-Programming-Python-3 | Labs/lab2/cycloidal_curves.py | Python | gpl-3.0 | 1,590 |
# Python 2 and 3:
try:
# Python 3 only:
from urllib.parse import urlencode, urlsplit, parse_qs, unquote
except ImportError:
# Python 2 only:
from urlparse import parse_qs, urlsplit
from urllib import urlencode, unquote
| fasihahmad/django-rest-framework-related-views | rest_framework_related/py2_3.py | Python | gpl-3.0 | 239 |
#!/usr/bin/env python
# -*- coding: Latin-1 -*-
"""
@file ParamEffectsOLD.py
@author Sascha Krieg
@author Daniel Krajzewicz
@author Michael Behrisch
@date 2008-07-26
@version $Id: ParamEffectsOLD.py 22608 2017-01-17 06:28:54Z behrisch $
Creates files with a comparison of speeds for each edge between the taxis... | 702nADOS/sumo | tools/projects/TaxiFCD_Krieg/src/fcdQuality/ParamEffectsOLD.py | Python | gpl-3.0 | 7,647 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-06-20 18:43
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('posgradmin', '0034_auto_20190620_1333'),
]
operations = [
migrations.Remov... | sostenibilidad-unam/posgrado | posgradmin/posgradmin/migrations/0035_auto_20190620_1343.py | Python | gpl-3.0 | 1,049 |
'''
Created on May 26, 2016
@author: Jonathan Muckell, Ph.D.
@license: GNU General Public License v3.0
Users are encouraged to use, modify and extend this work under the GNU GPLv3 license.
Please cite the following paper to provide credit to this work:
Jonathan Muckell, Yuchi Young, and Mitch Leventhal.... | jonmuckell/Motion-Tracking-Data-Parser | XYZ.py | Python | gpl-3.0 | 2,996 |
# Copyright (C) 2015 Jan Blechta
#
# This file is part of dolfin-tape.
#
# dolfin-tape 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
# (at your option) any later ve... | blechta/dolfin-tape | dolfintape/demo_problems/StokesVortices.py | Python | gpl-3.0 | 2,060 |
from django.core.files.storage import default_storage
from django.forms import widgets
from django.urls import reverse
from repanier.const import EMPTY_STRING
from repanier.picture.const import SIZE_M
from repanier.tools import get_repanier_template_name
class RepanierPictureWidget(widgets.TextInput):
template_n... | pcolmant/repanier | repanier/widget/picture.py | Python | gpl-3.0 | 1,573 |
from pypers.core.step import Step
from pypers.steps.mothur import Mothur
import os
import json
import re
import glob
class MothurSummarySeqs(Mothur):
"""
Summarizes the quality of sequences in an unaligned or aligned fasta-formatted sequence file.
"""
spec = {
'name' : 'MothurSummarySeqs',
... | frankosan/pypers | pypers/steps/mothur/MothurSummarySeqs.py | Python | gpl-3.0 | 3,305 |
#!/usr/bin/python3
#
# By Reynaldo R. Martinez P.
# Sept 09 2016
# TigerLinux AT Gmail DOT Com
# Sa sample with some operations including usage of
# a library import and some operations
#
#
#
# Here, weproceed to import the "SYS" library
import sys
# Next, we print the "sys.platform" information. Th... | tigerlinux/tigerlinux-extra-recipes | recipes/misc/python-learning/CORE/0002-Print-and-Import-and-some-operations/print-and-import.py | Python | gpl-3.0 | 1,618 |
# -*- coding: utf-8 -*-
import os
"""Clock for VPython - Complex (cx@cx.hu) 2003. - Licence: Python
Usage:
from visual import *
from cxvp_clock import *
clk=Clock3D()
while 1:
rate(1)
clk.update()
See doc strings for more.
Run this module to test clocks.
TODO: More types of clocks, such as 3D digital,
ch... | NicovincX2/Python-3.5 | Divers/draw_a_clock_vpython.py | Python | gpl-3.0 | 6,444 |
from __future__ import absolute_import
from builtins import object
from .error import CreateFolderError, FileNotWritableError, RemoveFolderError
import grace.py27.pyjsdoc
import os
from shutil import rmtree
class Doc(object):
def __init__(self, config):
self._cwd = os.getcwd()
self._config = confi... | mdiener/grace | grace/doc.py | Python | gpl-3.0 | 2,343 |
# ***** 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 distributed ... | cschenck/blender_sim | fluid_sim_deps/blender-2.69/2.69/scripts/modules/bl_i18n_utils/bl_extract_messages.py | Python | gpl-3.0 | 39,687 |
import copy
import re
import semver
import glob
import os
import re
def parse_version(version_str):
intel_version_style = re.search(r'^(\d+)\.(\d+)\.(\d+)\.(\d+)$', version_str)
major_minor_style = re.search(r'^(\d+)\.(\d+)$', version_str)
if intel_version_style:
major = intel_version_style.group(... | eth-cscs/production | spack/reframe/src/spack_util/spacklib.py | Python | gpl-3.0 | 10,153 |
import logging
import socket
import ssl
import struct
import warnings
import zlib
import io
import os
import platform
from functools import wraps
from threading import local as thread_local
from .rencode import dumps, loads
DEFAULT_LINUX_CONFIG_DIR_PATH = '~/.config/deluge'
RPC_RESPONSE = 1
RPC_ERROR = 2
RPC_EVENT = ... | pymedusa/Medusa | ext/deluge_client/client.py | Python | gpl-3.0 | 12,558 |
import struct
import warnings
import numpy as np
import array as arr
from time import sleep, localtime
from io import BytesIO
from qcodes import VisaInstrument, validators as vals
from pyvisa.errors import VisaIOError
class Tektronix_AWG700002A(VisaInstrument):
def __init__(self, name, address, **kwargs):
... | qdev-dk/Majorana | AWG570002Adavid.py | Python | gpl-3.0 | 5,224 |
import FWCore.ParameterSet.Config as cms
process = cms.Process("Demo")
process.load("FWCore.MessageService.MessageLogger_cfi")
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )
process.source = cms.Source("PoolSource",
# replace 'myfile.root' with the source file you want to use
file... | jlrodrig/MyAnalysis | MiniAnalyzer/python/ConfFile_cfg.py | Python | gpl-3.0 | 471 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
"""
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Title: uploader
Author: David Leclerc
Version: 0.1
Date: 01.07.2017
License: GNU General Public License, Version 3
(http://www.gnu.org/licens... | mm22dl/MeinKPS | uploader.py | Python | gpl-3.0 | 3,745 |
import tkinter as tk
from .convertwidget import ConvertWidget
class SpeedWidget(ConvertWidget):
"""Widget used to convert weight and mass units
Attributes:
root The Frame parent of the widget.
"""
def __init__(self, root):
super(SpeedWidget, self).__init__(root)
sel... | NicolasBi/super_converter | sconv/lib/gui/convertwidget/speed.py | Python | gpl-3.0 | 631 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCU... | ATIX-AG/ansible | lib/ansible/modules/cloud/ovirt/ovirt_vms.py | Python | gpl-3.0 | 93,016 |
# -*- coding: utf-8 -*-
import yaml
import os
from fabric.api import run, env, cd
class DeployToolKit(object):
"""
Класс реализует методы для управления проектом удаленном сервере:
создание и удаление директорий, установка зависимостей, публикация новых
изменений и откат к старым релизам.
"""
... | mrslow/DeployToolKit | deploytoolkit/deploytoolkit.py | Python | gpl-3.0 | 4,885 |
import io,pycurl,sys,os,time
class idctest:
def __init__(self):
self.contents = ''
def body_callback(self,buf):
self.contents = self.contents + buf
def test_gzip(input_url):
t = idctest()
#gzip_test = file("gzip_test.txt", 'w')
c = pycurl.Curl()
c.setopt(pycurl.WRITEFUNCT... | jinzekid/codehub | python/test_web_speed.py | Python | gpl-3.0 | 1,603 |
# -*- coding: utf-8 -*-
"""
gdown.modules.crocko
~~~~~~~~~~~~~~~~~~~
This module contains handlers for crocko.
"""
import re
from datetime import datetime
from ..module import browser, acc_info_template
def getApikey(username, passwd):
r = browser()
content = re.search('<content type="text">(.+)</content... | oczkers/gdown | gdown/modules/crocko.py | Python | gpl-3.0 | 1,644 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-09-21 19:30
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 = [
('cerimonial', '0025_auto_2018... | interlegis/saap | saap/cerimonial/migrations/0026_auto_20180921_1630.py | Python | gpl-3.0 | 1,720 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import re
import task_classes
from task_classes import QsubAnalysisTask
class DemoQsubAnalysisTask(QsubAnalysisTask):
"""
Demo task that will submit a single qsub job for the analysis
"""
def __init__(self, analysis, taskname = 'DemoQs... | NYU-Molecular-Pathology/snsxt | snsxt/sns_tasks/DemoQsubAnalysisTask.py | Python | gpl-3.0 | 2,720 |
# -*- coding: utf-8 -*-
"""
Eggholder test function for design optimization
xOpt = []
fOpt = 0.0
"""
from DesOptPy import OptimizationProblem
import numpy as np
class Eggholder:
z = [1, 1]
def SysEq(self):
x = self.z[0]
y = self.z[1]
self.f = -(y + 47.0) * np.sin(
np.sqrt... | e-dub/DesOptPy | examples/TestProblemsUnconstrained/Eggholder.py | Python | gpl-3.0 | 695 |
#!/usr/bin/env python
#
# Copyright 2007 Doug Hellmann.
#
#
# All Rights Reserved
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose and without fee is hereby
# granted, provided that the above copyright notice appear in all
# copies and tha... | qilicun/python | python2/PyMOTW-1.132/PyMOTW/shlex/shlex_source.py | Python | gpl-3.0 | 1,405 |
# Python/NLTK implementation of algorithm to detect similarity between
# short sentences described in the paper - "Sentence Similarity based
# on Semantic Nets and Corpus Statistics" by Li, et al.
# Results achieved are NOT identical to that reported in the paper, but
# this is very likely due to the differences in the... | joshtechnologygroup/dark-engine | engine/dark_matter/search_engine/similarity_checker.py | Python | gpl-3.0 | 9,843 |
import logging, os, json
import search.archive
class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
logging.info('**** new Singleton instance')
retur... | gauthiier/mailinglists | www/archives.py | Python | gpl-3.0 | 1,896 |
from pygame import K_UP, K_DOWN, K_LEFT, K_RIGHT
from Caracter import Caracter
class CommandHandler(object):
#0 1 2 3 4 5 6 7 8 9 10 11 12 13
_automata_transitions= [[11,11,0, 4, 0, 0, 11,11,0, 11,0, 11,13,0],#up
[9, 2, 0, 0, 0, 0, 9, 9, 0, 0, 0, 1... | r0qs/chubby | Fonte/Command.py | Python | gpl-3.0 | 1,775 |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# streamondemand.- XBMC Plugin
# Canal para piratestreaming
# http://blog.tvalacarta.info/plugin-xbmc/streamondemand.
# ------------------------------------------------------------
import re
import sys
import urlparse
from core impo... | orione7/Italorione | channels/guardarefilm.py | Python | gpl-3.0 | 11,213 |
#!/usr/bin/env python
'''
Copyright (C) 2015 The Regents of the University of California.
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 late... | Alexhuszagh/Lan-Huang-Scripts | python/make_decoys.py | Python | gpl-3.0 | 4,946 |
"""
Copyright (C) 2016 ECHO Wizard : Modded by TeamGREEN
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 v... | OptimusGREEN/repo67beta | OGT Installer/plugin.program.ogtools/downloader.py | Python | gpl-3.0 | 2,845 |
import glob
import serial
import logging
class serialPort():
""" Serial port wrapper """
port = '/dev/ttyACM0'
coms = None
connected = False
def isOpen(self):
return self.connected
def connect(self, port='/tmp/ttyS11'):
self.port = port
try:
self.coms = se... | olymk2/serJax | serjax/connect.py | Python | gpl-3.0 | 1,798 |
import datetime
import pytz
def to_dt(dt):
"""
Convert a naive date or datetime to a tz-aware datetime.
"""
if type(dt) == 'datetime.date' or not hasattr(dt, 'hour'):
dt = datetime.datetime(dt.year, dt.month, dt.day, 0, 0, 0, 0)
else:
if dt.tzinfo == None:
return d... | detrout/pykolab | pykolab/xml/utils.py | Python | gpl-3.0 | 386 |
# -*- coding: utf-8 -*-
import decimal
def isNum(value): # Einai to value arithmos, i den einai ?
"""
use: Returns False if value is not a number , True otherwise
input parameters :
1.value : the value to check against.
output: True or False
"""
try:
float(value)
... | tedlaz/pyted | pykoin17/numtable.py | Python | gpl-3.0 | 4,379 |
import logging
from shapely.geometry import *
from lib.raster import Raster
import numpy as np
from os import path
import sys
sys.path.append(path.abspath(path.join(path.dirname(__file__), "../../..")))
from lib.shapefileloader import Shapefile
from lib.exception import DataException, MissingException
from lib.metrics ... | SouthForkResearch/CHaMP_Metrics | tools/topometrics/methods/thalweg.py | Python | gpl-3.0 | 6,178 |
# -*- coding: utf-8 -*-
from PyQt4 import QtCore, QtGui
from ui_exp_om import Ui_Dialog
class ExpOmDialog(QtGui.QDialog):
def __init__(self):
QtGui.QDialog.__init__(self)
# Set up the user interface from Designer.
# After setupUI you can access any designer object by doing
... | daviderill/expedients | src/exp_om_dialog.py | Python | gpl-3.0 | 661 |
# These tests do not currently do much to verify the correct implementation
# of the openid/oauth protocols, they just exercise the major code paths
# and ensure that it doesn't blow up (e.g. with unicode/bytes issues in
# python 3)
from __future__ import absolute_import, division, with_statement
from tornado.auth im... | norus/procstat-json | tornado/test/auth_test.py | Python | gpl-3.0 | 10,876 |
#!/usr/bin/env python2
# vim: set fileencoding=utf-8
import tkinter
from . import gui
def main(*arglist,**argkeys):
root = tkinter.Tk()
root.title("Astro Observability Planner")
myGui = gui.Gui(root)
root.mainloop()
if __name__ == "__main__":
main()
| jhugon/astroobsplanner | astroobsplanner/app.py | Python | gpl-3.0 | 269 |
# 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/collector/linux/FileHashCollector.py | Python | gpl-3.0 | 1,930 |
import decor
from flask import Blueprint, redirect, request, url_for
import os, json
def construct_bp(gcal, JSON_DENT):
ALLOWED_ORIGIN = "*"
# JSON_DENT = 4
gcal_api = Blueprint('gcal_api', __name__, url_prefix="/gcal")
# GOOGLE CALENDAR API Routes
# Authenication routes
@gcal_api.route('... | Techblogogy/magic-mirror-base | server/routes/gcal.py | Python | gpl-3.0 | 2,343 |
#! /usr/bin/env python
# -*- coding: Latin-1 -*-
def changeCar(ch, ca1, ca2, debut =0, fin =-1):
"Remplace tous les caractères ca1 par des ca2 dans la chaîne ch"
if fin == -1:
fin = len(ch)
nch, i = "", 0 # nch : nouvelle chaîne à construire
while i < len(ch) :
if i >= debut ... | widowild/messcripts | exercice/python2/solutions/exercice_7_16.py | Python | gpl-3.0 | 664 |
# This file is part of ranger, the console file manager.
# License: GNU GPL version 3, see the file "AUTHORS" for details.
"""The titlebar is the widget at the top, giving you broad overview.
It displays the current path among other things.
"""
from __future__ import (absolute_import, division, print_function)
from... | ranger/ranger | ranger/gui/widgets/titlebar.py | Python | gpl-3.0 | 5,450 |
from setuptools import setup
setup(
name='push2clip',
version='0.1',
py_modules=
['push2clip'],
install_requires=[
'Click',
'requests',
],
entry_points='''
[console_scripts]
push2clip=... | kf5grd/push2clip | setup.py | Python | gpl-3.0 | 357 |
import click
from cenotes import create_app, db, models
@click.command()
@click.option('--cleanup', is_flag=True, default=False,
help="Cleanup expired notes")
@click.option('--settings', show_default=True, type=click.Choice(
["Production", "Development", "Testing"]), default="Production")
@click.opt... | ioparaskev/cenotes | cenotes/cli.py | Python | gpl-3.0 | 798 |
# -----------------------------------------------------------------------
# Copyright: 2010-2022, imec Vision Lab, University of Antwerp
# 2013-2022, CWI, Amsterdam
#
# Contact: astra@astra-toolbox.com
# Website: http://www.astra-toolbox.com/
#
# This file is part of the ASTRA Toolbox.
#
#
# The ASTRA Toolbo... | astra-toolbox/astra-toolbox | python/astra/plugins/cgls.py | Python | gpl-3.0 | 2,821 |
import cv2
import numpy
import Tool
class HueEqualiser(Tool.Tool):
def on_init(self):
self.id = "hueequaliser"
self.name = "Hue Equaliser"
self.icon_path = "ui/PF2_Icons/HueEqualiser.png"
self.properties = [
Tool.Property("header", "Hue Equaliser", "Header", None, has_t... | Tilo15/PhotoFiddle2 | PF2/Tools/HueEqualiser.py | Python | gpl-3.0 | 5,526 |
import scipy.io
import scipy.signal
import os
import sys
import matplotlib
import pandas as pd
import numpy as np
import random
# Load a matlab file into a data panel
# subject = Patient_N or Dog_N
# segment_type = interictal, ictal, or test
# downsample = True or False
# train_fraction = 0 < # <1, fraction of data to... | DryRun/seizures | code/dataIO.py | Python | gpl-3.0 | 3,438 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.