code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
import socket
import argparse
import sys
import magic_ping
import os
import settings
import signal
import logging
import struct
logging.basicConfig(format=u'%(levelname)-8s [%(asctime)s] %(message)s', level=logging.DEBUG, filename=u'client.log')
# Обработка CTRL+C
def signal_handler(signal, frame):
print("\nSTOP... | byDimasik/Magic_Ping | client.py | Python | gpl-3.0 | 2,642 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleads/google-ads-python | google/ads/googleads/v10/enums/types/geo_targeting_restriction.py | Python | apache-2.0 | 1,205 |
from django.http import HttpResponse
from StringIO import StringIO
import qrcode
def render(request):
value = request.GET.get('v', '')
size = int(request.GET.get('s', 4))
border = int(request.GET.get('b', 2))
qr = qrcode.QRCode(box_size=size, border=border, error_correction=qrcode.constants.ERROR_COR... | thunsaker/cloudpebble | qr/views.py | Python | mit | 491 |
##############################################################################
# adaptiveMD: A Python Framework to Run Adaptive Molecular Dynamics (MD)
# Simulations on HPC Resources
# Copyright 2017 FU Berlin and the Authors
#
# Authors: Jan-Hendrik Prinz
# John Ossyra
# Contributors:
#
# `adaptiv... | markovmodel/adaptivemd | adaptivemd/engine/engine.py | Python | lgpl-2.1 | 16,299 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-08-14 07:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0014_auto_20170727_0618'),
]
operations = [
migrations.AddField(
... | vstconsulting/polemarch | polemarch/main/migrations/0015_auto_20170814_1731.py | Python | agpl-3.0 | 846 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-present Taiga Agile LLC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later ver... | taigaio/taiga-back | taiga/projects/contact/admin.py | Python | agpl-3.0 | 1,200 |
# -*- coding: utf-8 -*-
#*****************************************************************************
# Copyright (C) 2003-2006 Gary Bishop.
# Copyright (C) 2006 Jorgen Stenarson. <jorgen.stenarson@bostream.nu>
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYIN... | sburnett/seattle | seash/pyreadline/keysyms/common.py | Python | mit | 5,191 |
# Copyright NuoBiT Solutions, S.L. (<https://www.nuobit.com>)
# Eric Antones <eantones@nuobit.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
from odoo import models
class SaleOrder(models.Model):
_inherit = "sale.order"
def _prepare_invoice(self):
invoice_vals = super(SaleOrder,... | nuobit/odoo-addons | partner_default_journal/models/sale.py | Python | agpl-3.0 | 494 |
# -*- coding: utf-8 -*-
from ..utils import misc
class Charsets:
# http://www.iana.org/assignments/character-sets/character-sets.xhtml
us_ascii = 'US-ASCII'
iso_8859_1 = 'ISO-8859-1'
iso_8859_2 = 'ISO-8859-2'
iso_8859_3 = 'ISO-8859-3'
iso_8859_4 = 'ISO-8859-4'
iso_8859_5 = 'ISO-8859-5'
... | nitely/http-lazy-headers | http_lazy_headers/shared/values/charsets.py | Python | mit | 919 |
# This file is part of Checkbox.
#
# Copyright 2013 Canonical Ltd.
# Written by:
# Sylvain Pineau <sylvain.pineau@canonical.com>
# Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
#
# Checkbox is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publishe... | zyga/debian.plainbox | plainbox/impl/exporter/test_xml.py | Python | gpl-3.0 | 4,133 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
""" audiomunger: extract spectral features from audio input"""
import thread
import time
import pyaudio
import sys
from numpy import *
from numpy.fft import *
from struct import *
import traceback
chunk = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE =... | headrotor/pixelpusher | audiomunger.py | Python | mit | 5,722 |
from django.shortcuts import redirect
| hangarunderground/generic | generic/testproject/testapp/views.py | Python | gpl-2.0 | 39 |
import ConfigParser
class ConfigurationFile(object):
Instance = None
@classmethod
def instance(cls):
if cls.Instance is None: # IGNORE:E0203
cls.Instance = cls() # IGNORE:W0201
return cls.Instance
@classmethod
def clear(cls):
cls.Instance = None
def __i... | bobjects/google-spreadsheet-temperature-logger | configurationFile.py | Python | mit | 4,937 |
##############################################################################
#
# Copyright (c) 2004 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SO... | Donkyhotay/MoonPy | zope/app/publisher/browser/tests/support.py | Python | gpl-3.0 | 1,315 |
class CommentFile:
def __init__(self, f, commentstring="#"):
self.f = f
self.commentstring = commentstring
def next(self):
line = self.f.next()
while line.startswith(self.commentstring):
line = self.f.next()
return line
def __iter__(self):
retur... | alliance-genome/agr_prototype | indexer/src/files/comment_file.py | Python | mit | 327 |
"""
Genshi functions for basic template
"""
from genshi.builder import Element
def create_headers_html(level, content):
"""
Create internal headers of block (Heading 2 to Heading 10 in odt)
It uses h1 to h10 html headers
"""
return Element('h' + str(level-1))(content)
def remark_category_class(cat... | aoltra/mentor | templates/basic/python/mentor_genshi_functions.py | Python | lgpl-3.0 | 588 |
import analytics
import datetime
import anyjson
from channels import Group
from django.conf import settings
from django.utils.timezone import utc
from django.utils.translation import ugettext_lazy as _
from lily.api.fields import RegexDecimalField, SanitizedHtmlCharField
from lily.api.nested.mixins import RelatedSeri... | HelloLily/hellolily | lily/deals/api/serializers.py | Python | agpl-3.0 | 15,518 |
import pulse_actions.handlers.treeherder_buildbot as treeherder_buildbot
import pulse_actions.handlers.treeherder_resultset as treeherder_resultset
import pulse_actions.handlers.backfilling as backfilling
HANDLERS_BY_EXCHANGE = {
"exchange/treeherder/v1/job-actions": {
"manual_backfill": treeherder_buildb... | nikkisquared/pulse_actions | pulse_actions/handlers/config.py | Python | mpl-2.0 | 568 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... | SKIRT/PTS | modeling/analysis/run.py | Python | agpl-3.0 | 116,812 |
#!/usr/bin/env python2
# -*- coding=utf-8 -*-
## Amazon S3cmd - testsuite
## Author: Michal Ludvig <michal@logix.cz>
## http://www.logix.cz/michal
## License: GPL Version 2
## Copyright: TGRMN Software and contributors
import sys
import os
import re
import time
from subprocess import Popen, PIPE, STDOUT
impor... | tikonen/s3cmd | run-tests.py | Python | gpl-2.0 | 29,754 |
# Copyright (c) 2014 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the License);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... | miarmak/CloudFerry | cloudferrylib/scheduler/namespace.py | Python | apache-2.0 | 936 |
"""Project Euler Problem 2
By considering the terms in the Fibonacci sequence whose values do not exceed
four million, find the sum of the even-valued terms.
"""
below = 4000000
n1 = 0
n2 = 1
n = n1 + n2
result = 0
while n <= below:
# print n,
if n % 2 == 0:
result += n
# print "*",
n1 = ... | piit79/project-euler | problem02.py | Python | gpl-2.0 | 422 |
__version__ = '1.0.106'
| aml-development/ozp-backend | ozp/_version.py | Python | apache-2.0 | 24 |
# coding=utf-8
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: https://sickrage.github.io
# Git: https://github.com/SickRage/SickRage.git
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free... | kingmotley/SickRage | sickbeard/network_timezones.py | Python | gpl-3.0 | 5,166 |
print 1 == True
| cantora/pyc | p1tests/grader_tests/eq0.py | Python | gpl-3.0 | 16 |
#!/usr/bin/env python
"""
Download SciPy wheels from Anaconda staging area.
"""
import sys
import os
import re
import shutil
import argparse
import urllib
import urllib3
from bs4 import BeautifulSoup
__version__ = '0.1'
# Edit these for other projects.
STAGING_URL = 'https://anaconda.org/multibuild-wheels-staging/s... | WarrenWeckesser/scipy | tools/download-wheels.py | Python | bsd-3-clause | 2,967 |
from genshi.builder import tag
from trac.core import implements,Component
from trac.ticket.api import ITicketActionController
from trac.ticket.default_workflow import ConfigurableTicketWorkflow
from trac.perm import IPermissionRequestor
from trac.config import Option, ListOption
revision = "$Rev: 11490 $"
url = "$URL... | apache/bloodhound | trac/sample-plugins/workflow/CodeReview.py | Python | apache-2.0 | 4,686 |
#!/usr/bin/env python
# Based on previous work by
# Charles Menguy (see: http://stackoverflow.com/questions/10217067/implementing-a-full-python-unix-style-daemon-process)
# and Sander Marechal (see: http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/)
# Adapted by M.Hendrix [2015]
import sys,... | Mausy5043/ubundiagd | libdaemon.py | Python | mit | 3,590 |
import sublime
import sys
VERSION = int(sublime.version())
reloader = "improved_macros.reloader"
if VERSION > 3000:
reloader = 'ImprovedMacros.' + reloader
from imp import reload
# Make sure all dependencies are reloaded on upgrade
if reloader in sys.modules:
reload(sys.modules[reloader])
if VERSION >... | skuroda/ImprovedMacros | ImprovedMacros.py | Python | mit | 529 |
from board import Board, Position
from pieces import Knight, GameError
from verbose import Verbose
from move import Move
from trace import Trace
import time
class MoveError(Exception):
def __init__(self, position):
print "Knight can not move to", position, " as it has already been visited."
cla... | erikosmond/knights_tour | app/tour.py | Python | mit | 4,965 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of Radar.
Radar 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 version.... | lliendo/Radar | scripts/radar-server-config.py | Python | lgpl-3.0 | 845 |
from chimera.core.interface import Interface
from chimera.util.enum import Enum
AlignMode = Enum("ALT_AZ", "POLAR", "LAND")
SlewRate = Enum("GUIDE", "CENTER", "FIND", "MAX")
class Guider(Interface):
__config__ = {"telescope": "/Telescope/0",
"camera": "/Camera/0",
"guidercam... | agati/chimera | src/chimera/interfaces/guider.py | Python | gpl-2.0 | 710 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Created on March 06, 2013
@author: Jose Antonio Sal y Rosas Celi
@contact: arturo.jasyrc@gmail.com
'''
import optparse
from datetime import datetime
from components.upload.uploadingSCP import uploadingSCP
from lib.html.requestAPI import requestAPI
from lib.html.leerDat... | infojasyrc/client_dataws | client_dataws/register.py | Python | mit | 2,399 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
"""
Semantic Machines\N{TRADE MARK SIGN} software.
Evaluates 1best predictions.
Computes both turn-level and dialogue-level accuracy.
"""
import argparse
import csv
import json
from dataclasses import dataclass
from typing import List, Option... | microsoft/task_oriented_dialogue_as_dataflow_synthesis | src/dataflow/onmt_helpers/evaluate_onmt_predictions.py | Python | mit | 6,412 |
#!/usr/bin/env python
#PPM.py by pbsds for python 2.7
#AGPL3 licensed
#
#Numpy is required
#PIL is needed to write images to disk
#
#Credits:
#
# - Steven for most of the documentation on DSiBrew and his frame decoding example on his talkpage
# - Remark for help on the 8x8 tiling on the preview image.
# - Jsafive for s... | pbsds/Flipnote-Player | Hatenatools/PPM.py | Python | agpl-3.0 | 36,031 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2013 Boris Pavlovic (boris@pavlovic.me).
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# ... | imsplitbit/nova | nova/tests/db/test_migration_utils.py | Python | apache-2.0 | 26,893 |
# Copyright 2021 NuoBiT Solutions - Kilian Niubo <kniubo@nuobit.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
from odoo import api, fields, models
class SaleOrder(models.Model):
_inherit = "sale.order"
alternate_name_description = fields.Char(
compute="_compute_alternate_name_d... | nuobit/odoo-addons | project_task_alternate_name/models/sale_order.py | Python | agpl-3.0 | 1,806 |
# USAGE
# python recognize.py --detector face_detection_model \
# --embedding-model openface_nn4.small2.v1.t7 \
# --recognizer output/recognizer.pickle \
# --le output/le.pickle --image images/adrian.jpg
# import the necessary packages
import numpy as np
import argparse
import imutils
import pickle
import cv2
import o... | iproduct/course-social-robotics | image-recognition-python-new/recognize.py | Python | gpl-2.0 | 3,818 |
#!/usr/bin/env python
import testlog_parser, sys, os, xml, glob, re
from table_formatter import *
from optparse import OptionParser
from operator import itemgetter, attrgetter
from summary import getSetName, alphanum_keyselector
import re
if __name__ == "__main__":
usage = "%prog <log_name>.xml [...]"
parser ... | lupustr3/opencv_tools | ts_tools/perf_tests_timing.py | Python | bsd-3-clause | 6,236 |
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
from scrapy import signals
import json
import codecs
class JsonWithEncodingPipeline(object):
def __init__(self):
self.file = codecs.open(... | openslack/openslack-crawler | examples/hrtencent/hrtencent/pipelines.py | Python | apache-2.0 | 583 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | krafczyk/spack | var/spack/repos/builtin/packages/r-sparsem/package.py | Python | lgpl-2.1 | 1,827 |
import os
import sublime
def run():
with open('%s', 'w') as f:
f.write('hello world')
if os.environ.get('SUBLIME_AUTO_KILL'):
sublime.run_command('exit')
| twolfson/sublime-harness | test/test_files/arbitrary.py | Python | unlicense | 180 |
"""phase.py
this module is part of the ciderseq distribution.
"""
#read resultfiles
import sys,os
import json
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqFeature import SeqFeature, FeatureLocation
from Bio.Alphabet import generic_dna
def phase(settings,genome,deconfile,annofile,logger):
#check if gen... | hirschhm/ciderseq | cider/phase.py | Python | agpl-3.0 | 6,043 |
from .util import get_cached
__all__ = ("continents", "map_names", "maps", "map_floor")
def continents():
"""This resource returns static information about the continents used with
the map_floor resource.
The response is a dictionary where the key is the continent id, and the
value is a dictionary ... | hackedd/gw2api | gw2api/map.py | Python | mit | 7,018 |
#! /usr/bin/env python
# coding: utf-8
# Python Script Collection for GEOS-Chem Chemistry Transport Model (gchem)
# Copyright (C) 2012 Gerrit Kuhlmann
#
# 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 Foun... | gkuhl/gchem | gchem/uff.py | Python | gpl-3.0 | 5,410 |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | PaddlePaddle/Paddle | python/paddle/fluid/tests/unittests/npu/test_elementwise_add_op_npu.py | Python | apache-2.0 | 20,475 |
# coding=utf-8
from __builtin__ import super
from datetime import datetime
from flask import redirect, url_for, Response, flash
from flask.templating import render_template
from flask.views import MethodView
from server import app
from server.bands.forms import BandForm, TrackUploadForm, TechriderUploadForm, ImageUpl... | dennisausbremen/tunefish | server/bands/profile.py | Python | apache-2.0 | 3,477 |
from pathlib import Path
BASE_DIR = Path(__file__).resolve().parent.parent
# Django settings
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
DEBUG = True
INSTALLED_APPS = [
'example',
'gallery.apps.GalleryConfig',
'django.c... | aaugustin/myks-gallery | example/example/settings.py | Python | bsd-3-clause | 2,068 |
from django.core.cache import caches
from django.core.management import call_command
from django.utils.six import StringIO
from ._base import BaseTestCase
from main.models import Item
CACHE = caches['ranking']
class TestRankingUpdate(BaseTestCase):
def tearDown(self):
CACHE.clear()
super(Test... | 9dev/django-fb-rank | fts/Ranking.py | Python | mit | 3,153 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '... | yfried/ansible | lib/ansible/modules/source_control/git.py | Python | gpl-3.0 | 48,024 |
"""Script that shrinks the periodic cell progressively.
It prints strain and average stress (computed from total volume force)
once in a while."""
from woo import log,timing
log.setLevel("InsertionSortCollider",log.TRACE)
O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb()]),
InteractionLoop(
[Ig... | tarthy6/dozer-thesis | scripts/test-OLD/periodic-grow.py | Python | gpl-2.0 | 1,320 |
"""
Print out some handy system info.
"""
import os
import platform
import sys
print("Build system information")
print()
print("sys.version\t\t", sys.version.split("\n"))
print("os.name\t\t\t", os.name)
print("sys.platform\t\t", sys.platform)
print("platform.system()\t", platform.system())
print("platform.machine()\... | scottclowe/python-continuous-integration | .github/workflows/system_info.py | Python | mit | 575 |
from sklearn.naive_bayes import GaussianNB
import random
import numpy as np
import math
from pylab import scatter,figure, clf, plot, xlabel, ylabel, xlim, ylim, title, grid, axes, show,semilogx, semilogy
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
# Generation of data to train t... | JonatanAntoni/CMSIS_5 | CMSIS/DSP/Examples/ARM/arm_bayes_example/train.py | Python | apache-2.0 | 2,149 |
from instal.firstprinciples.TestEngine import InstalSingleShotTestRunner, InstalTestCase
from instal.instalexceptions import InstalParserError
class InitiateNormsPerms(InstalTestCase):
def test_initiate_perms_institutional(self):
runner = InstalSingleShotTestRunner(input_files=["fluentchange/perminitiate... | cblop/tropic | instal-linux/instal/firstprinciples/fluentchange/TestInitiateNormsPerms.py | Python | epl-1.0 | 1,549 |
"""
Django settings for cruzebase project.
Generated by 'django-admin startproject' using Django 1.11.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import ... | MenloAthertonCoding/cruzebase | cruzebase/settings.py | Python | apache-2.0 | 3,833 |
#
# Copyright (c) 2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | NervanaSystems/coach | rl_coach/dashboard_components/episodic_board.py | Python | apache-2.0 | 4,661 |
#!/usr/bin/env python3
import sys
import yaml
from os import path
from plistlib import dumps
def generated_comment():
return "This file is auto-generated from %s, do not edit it by hand!" \
% path.basename(in_path)
def convert(yaml):
lines = dumps(yaml).decode('utf-8').splitlines()
lines.insert(... | joaompinto/asciidoctor-vscode | script/yaml-to-plist.py | Python | mit | 739 |
"""
Persistence tests using examples.
"""
from hamcrest import (
assert_that,
calling,
contains_inanyorder,
equal_to,
is_,
raises,
)
from nose.plugins.attrib import attr
from microcosm.api import create_object_graph
from microcosm_dynamodb.errors import ModelNotFoundError
from microcosm_dynamo... | globality-corp/microcosm-dynamodb | microcosm_dynamodb/tests/test_example.py | Python | apache-2.0 | 2,670 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | correct_batch_effects_wdn/forgetting_nuisance.py | Python | apache-2.0 | 55,433 |
from datetime import datetime
from django.test import TestCase
from simple_history.signals import (
post_create_historical_record,
pre_create_historical_record,
)
from ..models import Poll
today = datetime(2021, 1, 1, 10, 0)
class PrePostCreateHistoricalRecordSignalTest(TestCase):
def setUp(self):
... | treyhunner/django-simple-history | simple_history/tests/tests/test_signals.py | Python | bsd-3-clause | 1,806 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Check a MATH-ED program.
"""
__version__ = '0.9.0'
__author__ = 'Jim Hefferon'
__license__ = 'GPL 3'
TODO = []
import sys, os, os.path, re, pprint, argparse, traceback, time
import csv # read the course data
import cgi
import cgitb
cgitb.enable()
import datetime #... | jimhefferon/maed | maed/bin/maed.py | Python | gpl-2.0 | 43,627 |
#pyPartition.py
"""
provide class libraries for partitioning
goal of this code is to provide a reasonable geometric partition
to the pre-processing libraries. The output will be a list of length Nx*Ny*Nz
containing the integer of which partition each lattice point lives.
"""
import partition_suggestion as ps
import ... | stu314159/pyNFC | pyPartition.py | Python | mit | 9,340 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you m... | salv-orlando/MyRepo | nova/virt/libvirt/firewall.py | Python | apache-2.0 | 24,184 |
#########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# 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
#... | Phil-LiDAR2-Geonode/pl2-geonode | geonode/people/views.py | Python | gpl-3.0 | 4,195 |
import Adafruit_BBIO.GPIO as GPIO
import time
# Define program constants
BUTTON_PIN = 'P9_11'
OFF = 0
ON = 1
# Configure the GPIO pin and set the initial state of variables to track the
# state of the button.
GPIO.setup(BUTTON_PIN, GPIO.IN)
button_state_old = OFF
button_state_new = OFF
# print out a ... | SpinStabilized/bbb-primer | chapter09/simple_button.py | Python | mit | 1,015 |
#!/usr/bin/env python
__version__ = "0.1.0"
__date__ = "2014-04-11 1:42:05"
__author__ = "Dhia Abbassi"
__email__ = "dhiaabbassi90@gmail.com"
__license__ = "GPL"
__maintainer__ = ""
__doc__=""" Snippet of code that solves <Problem A. Magic Trick> """ | OssecTN/codejam-2014 | python/magic_trick/__init__.py | Python | gpl-2.0 | 251 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_export_jobs_operation_results_operations.py | Python | mit | 6,375 |
from pyplanet.apps.config import AppConfig
from pyplanet.apps.contrib.funcmd.view import EmojiToolbarView
from pyplanet.contrib.command import Command
from pyplanet.apps.core.maniaplanet import callbacks as mp_signals
from pyplanet.contrib.setting import Setting
class FunCmd(AppConfig):
app_dependencies = ['core.ma... | PyPlanet/PyPlanet | pyplanet/apps/contrib/funcmd/__init__.py | Python | gpl-3.0 | 4,483 |
# -*- coding: utf-8 -*-
import sys
sys.path.append(u"../")
#sys.path.append(u"obs-plugins/32bit/")
from win32gui import *
from _ctypes import byref
from ctypes import pythonapi, c_void_p, py_object
from Common.CXCommon import *
from Common.ErrorLogger import *
import ctypes, sys, time, traceback,os
from PyS... | tristsesame/obs-studio-simply-c-sdk | demo.py | Python | mit | 6,468 |
"""
Unit tests for grades models.
"""
import json
from base64 import b64encode
from collections import OrderedDict
from datetime import datetime
from hashlib import sha1
import ddt
import pytz
from django.db.utils import IntegrityError
from django.test import TestCase
from django.utils.timezone import now
from freezeg... | TeachAtTUM/edx-platform | lms/djangoapps/grades/tests/test_models.py | Python | agpl-3.0 | 18,383 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('product', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='PriceQtyOverride',
fields=... | fusionbox/satchless | satchless/contrib/pricing/simpleqty/migrations/0001_initial.py | Python | bsd-3-clause | 2,293 |
from mysite import db
class Work(db.Model):
__tablename__ = 'Work'
id = db.Column(db.Integer, primary_key=True)
wid = db.Column(db.String(32), default='')
show = db.Column(db.Boolean, default=True)
state = db.Column(db.Boolean, default=True)
user_id = db.Column(db.Integer, db.ForeignKey('User... | liyigerry/caixiang | mysite/models/work.py | Python | mit | 467 |
# coding=utf-8
# Copyright 2022 The Robustness Metrics Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | google-research/robustness_metrics | robustness_metrics/metrics/diversity.py | Python | apache-2.0 | 7,658 |
#!/usr/bin/python
# Copyright (c) 2016 IBM
#
# This module 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 software is distrib... | milad-soufastai/ansible-modules-extras | cloud/openstack/os_user_role.py | Python | gpl-3.0 | 6,078 |
# Sources:
# https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/appengine/standard/localtesting/datastore_test.py
# http://flask.pocoo.org/docs/0.12/testing/
#import os
#import imhere
#import unittest
#import tempfile
#from flask import session
import flask
from models import users_model, index_mo... | keirl/coms4156_jumpstart | test_imhere.py | Python | apache-2.0 | 17,303 |
import os
import sys
import unittest
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../')
from google_api_clients import GoogleApiClient
from google_api_clients.errors import MethodNameError
from google_api_clients.errors import ResourceNameError
class TestGoogleApiClient(unittest.TestCase):
def... | shojikai/python-google-api-clients | test/test_google_api_client.py | Python | apache-2.0 | 1,053 |
"""
raven.transport.threaded_requests
~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from raven.transport.base import AsyncTransport
from raven.transport import RequestsHTTPTra... | Mellthas/quodlibet | quodlibet/packages/raven/transport/threaded_requests.py | Python | gpl-2.0 | 1,059 |
# -*- coding: utf-8 -*-
#
# gPodder - A media aggregator and podcast client
# Copyright (c) 2005-2018 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 3 of the Licens... | gpodder/gpodder | src/gpodder/gtkui/desktop/exportlocal.py | Python | gpl-3.0 | 3,192 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
To run this script you need to have all 10 text files from https://yade-dem.org/wiki/CapillaryTriaxialTest
in the same folder as you run this script in console!
This script shows how to use Law2_ScGeom_CapillaryPhys_Capillarity. The user can switch between hertz and
line... | anna-effeindzourou/trunk | examples/capillaryLaplaceYoung/CapillaryPhys-example.py | Python | gpl-2.0 | 2,492 |
#!/usr/local/bin/python
# encoding: utf-8
"""
*Render a python list of dictionaries in various list and markup formats*
:Author:
David Young
"""
from builtins import str
from builtins import range
from builtins import object
import sys
import os
import io
import re
import codecs
import copy
import json
import yaml... | thespacedoctor/fundamentals | fundamentals/renderer/list_of_dictionaries.py | Python | gpl-3.0 | 20,625 |
# -*- coding: utf-8 -*-
import logging
import commands
import simplejson
import os
import os.path
import openerp
import time
import random
import subprocess
import simplejson
import werkzeug
import werkzeug.wrappers
_logger = logging.getLogger(__name__)
from openerp import http
from openerp.http import request
# Tho... | exploreodoo/datStruct | odoo/addons/hw_proxy/controllers/main.py | Python | gpl-2.0 | 7,800 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | tongwang01/tensorflow | tensorflow/python/debug/cli/curses_ui.py | Python | apache-2.0 | 39,728 |
"""
Parser that converts (C style) binary structs named tuples.
The struct can be read from a file or a byte string.
"""
import struct
def _make_struct_class(name, names):
class Struct(object):
_names = names
def __init__(self, **kwargs):
vars(self).update(kwargs)
def __rep... | olemb/dbfread | dbfread/struct_parser.py | Python | mit | 1,188 |
"""
Escribe un programa que compruebe si la última letra de una cadena es una A que suelte un mensaje
"""
while True:
inputString = input('Would you please intruduce a phrase?\n')
if str(inputString[-1]).casefold() == 'a': # Forzamos la conversión a str y le hacemos casefold (tó a minúsculas)
prin... | IhToN/DAW1-PRG | Ejercicios/PrimTrim/Ejercicio6.py | Python | apache-2.0 | 547 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""Tools and helper functions for abinit calculations"""
from __future__ import unicode_literals, division, print_function
import os
import six
import re
import collections
import shutil
import operator
import ... | migueldiascosta/pymatgen | pymatgen/io/abinit/utils.py | Python | mit | 27,615 |
"""private_base will be populated from puppet and placed in this directory"""
import logging
import os
import dj_database_url
from lib.settings_base import (CACHE_PREFIX, ES_INDEXES,
KNOWN_PROXIES, LOGGING, HOSTNAME)
from .. import splitstrip
import private_base as private
ENGAGE_RO... | jinankjain/zamboni | sites/altdev/settings_base.py | Python | bsd-3-clause | 5,851 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2015, Michael Perzel
#
# 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 you... | calamityman/ansible-modules-extras | network/f5/bigip_gtm_wide_ip.py | Python | gpl-3.0 | 5,733 |
"""Provides the Menu and MenuItem classes."""
from attr import attrs, attrib, Factory, asdict
@attrs
class MenuLabel:
"""A label in a menu."""
title = attrib()
@attrs
class MenuItem(MenuLabel):
"""An item in a menu."""
command = attrib()
args = attrib(default=Factory(dict))
@attrs
class Men... | chrisnorman7/pyrts | server/menus.py | Python | mpl-2.0 | 1,954 |
class StateMask:
def __init__(self, bit, doc=None):
self.bit = bit
if doc is not None:
self.__doc__ = 'bit {}. {}'.format(bit, doc)
def __get__(self, obj, type_=None):
if obj is None:
return self
else:
return bool(obj._data >> self.bit & 1)
... | afg984/pyardrone | pyardrone/navdata/states.py | Python | mit | 4,371 |
import Kaminec.Game as game
from multiprocessing import freeze_support
from Kaminec.jsontools.system import Rule
from time import time
data = "D:\\Learning Pythons\\LAminec2nd\\tmp\\1.11.2.json"
def main():
start = time()
mc = game.Game(data)
a = mc.getLibPath()
print(a)
delta = time() - start
# ... | LambolAlee/LAminec | cli_module/test.py | Python | gpl-3.0 | 849 |
# Copyright © 2020, Joseph Berry, Rico Tabor (opendrop.dev@gmail.com)
# OpenDrop is released under the GNU GPL License. You are free to
# modify and distribute the code, but always under the same license
# (i.e. you cannot make commercial derivatives).
#
# If you use this software in your research, please cite the foll... | ricotabor/opendrop | opendrop/app/common/image_acquisition/__init__.py | Python | gpl-2.0 | 1,445 |
from bokeh.models import FuncTickFormatter
from bokeh.plotting import figure, show, output_file
from ruamel.yaml import YAML
import socket
def graph_bgp(label_dict, redundancy_counts, x_ticks):
""" graph bgp
the main graphing function used to graph the given dataset
we will be graphing this two ways - ful... | syedur-rahman/pyability | scripts/p03_parse_bgp/graphbgp.py | Python | gpl-3.0 | 5,872 |
"""
Django settings for backend project.
Generated by 'django-admin startproject' using Django 1.10.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os... | briot/geneapro | backend/backend/settings.py | Python | gpl-2.0 | 7,154 |
#! /usr/bin/env python2
from Crypto.PublicKey import RSA
key = RSA.generate(4096, e=5)
msg = "this challenge was supposed to be babyrsa but i screwed up and now i have to redo the challenge.\nhopefully this challenge proves to be more worthy of 250 points compared to the 200 points i gave out for babyrsa :D :D :D\nyo... | hgarrereyn/Th3g3ntl3man-CTF-Writeups | 2017/UIUCTF/problems/Cryptography/papaRSA/paparsa.py | Python | gpl-3.0 | 694 |
# coding: utf-8
''' Custom the Base Model class.
1. create class query db session
2. create db -> db_sesssion
3. add some method to Base
'''
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import class_mapper, Query
from sqlalchemy.orm.exc import UnmappedClassError, NoResultFound, MultipleR... | cloudorz/apple | utils/coredb.py | Python | bsd-3-clause | 2,357 |
from jingo import register
@register.function
def gravatar(email, size=48):
import hashlib
import urllib
url = '//www.gravatar.com/avatar.php?' + urllib.urlencode({
'gravatar_id': hashlib.md5(email).hexdigest(),
#'default': 'http://www.mysite.com/media/images/no-avatar.gif',
'size'... | liamcurry/django-boilerplate | project_name/auth/helpers.py | Python | mit | 354 |
"""
Settings and configuration for Django.
Values will be read from the module specified by the DJANGO_SETTINGS_MODULE environment
variable, and then from django.conf.global_settings; see the global settings file for
a list of all possible variables.
"""
import logging
import os
import sys
import time # Needed fo... | edisonlz/fruit | web_project/base/site-packages/django/conf/__init__.py | Python | apache-2.0 | 7,796 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Huyuwei/tvm | topi/python/topi/testing/dilate_python.py | Python | apache-2.0 | 1,663 |
import dedupe
import dedupe.training as training
import unittest
class TrainingTest(unittest.TestCase):
def setUp(self):
field_definition = [{'field' : 'name', 'type': 'String'}]
self.data_model = dedupe.Dedupe(field_definition).data_model
self.training_pairs = {
'match': [({"n... | tfmorris/dedupe | tests/test_training.py | Python | mit | 3,976 |
# Copyright 2015-2017 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | scotwk/cloud-custodian | tests/test_s3.py | Python | apache-2.0 | 101,827 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.