text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from model import FreebieItem, Distributor, Contributor
import datetime
import logging
head = '''
<html>
<head>
<title>%s</title>
<script src="/static/sorttable.js"></script>
<style>
body {
background-c... | nirea/collardata | freebielist.py | Python | gpl-2.0 | 4,787 | 0.005849 |
from PyQt5.QtDesigner import * | ales-erjavec/anyqt | AnyQt/_backport/QtDesigner.py | Python | gpl-3.0 | 30 | 0.033333 |
# orm/persistence.py
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""private module containing functions used to emit INSERT, UPDATE
and DELETE sta... | sandan/sqlalchemy | lib/sqlalchemy/orm/persistence.py | Python | mit | 51,786 | 0.000019 |
#!/usr/bin/env python
import yaml
import pwd
import sys
import subprocess
import json
import os
__author__ = "Anoop P Alias"
__copyright__ = "Copyright Anoop P Alias"
__license__ = "GPL"
__email__ = "anoopalias01@gmail.com"
installation_path = "/opt/nDeploy" # Absolute Installation Path
if __name__ == "__main_... | AnoopAlias/XtendWeb | scripts/hhvm_ghost_hunter.py | Python | gpl-3.0 | 3,290 | 0.004863 |
class Corpus:
"""Interface for corpus
"""
def __init__(self):
pass
| rain1024/underthesea | underthesea/corpus/corpus.py | Python | gpl-3.0 | 87 | 0 |
import py
from rpython.rtyper.lltypesystem import lltype, llmemory, llarena
from rpython.memory.gc.incminimark import IncrementalMiniMarkGC, WORD
from test_direct import BaseDirectGCTest
T = lltype.GcForwardReference()
T.become(lltype.GcStruct('pinning_test_struct2',
('someInt', lltype.Signed)... | jptomo/rpython-lang-scheme | rpython/memory/gc/test/test_object_pinning.py | Python | mit | 38,271 | 0.001698 |
from couchpotato.core.event import addEvent, fireEvent
from couchpotato.core.logger import CPLog
from couchpotato.core.plugins.base import Plugin
from couchpotato.environment import Env
log = CPLog(__name__)
class Automation(Plugin):
def __init__(self):
addEvent('app.load', self.setCrons)
if n... | coolbombom/CouchPotatoServer | couchpotato/core/plugins/automation/main.py | Python | gpl-3.0 | 1,352 | 0.016272 |
#!/usr/bin/env python
# Standard packages
import sys
import cyvcf2
import argparse
import geneimpacts
from cyvcf2 import VCF
def get_effects(variant, annotation_keys):
effects = []
effects += [geneimpacts.SnpEff(e, annotation_keys) for e in variant.INFO.get("ANN").split(",")]
return effects
def get_t... | GastonLab/ddb-scripts | specialist/scan_multi-gene_annotated_snpEff.py | Python | mit | 1,956 | 0.00409 |
#
# Copyright (C) 2013 Stanislav Bohm
#
# This file is part of Kaira.
#
# Kaira 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, version 3 of the License, or
# (at your option) any later versi... | MrPablozOne/kaira | ptp/base/analysis.py | Python | gpl-3.0 | 6,178 | 0.003561 |
import mock
from olympia.amo.tests import addon_factory, TestCase, user_factory
from olympia.ratings.models import Rating
from olympia.ratings.tasks import addon_rating_aggregates
class TestAddonRatingAggregates(TestCase):
# Prevent <Rating>.refresh() from being fired when setting up test data,
# since it'd ... | tsl143/addons-server | src/olympia/ratings/tests/test_tasks.py | Python | bsd-3-clause | 3,772 | 0 |
#!/usr/bin/env python
# -*- mode: python; coding: utf-8 -*-
##################################################################
# Documentation
##################################################################
# Imports
from __future__ import absolute_import, unicode_literals, print_function
try:
from cPickle im... | WladimirSidorenko/CGSA | cgsa/dl/base.py | Python | mit | 20,205 | 0.000099 |
"""
kombu.transport.pyamqplib
=========================
amqplib transport.
:copyright: (c) 2009 - 2011 by Ask Solem.
:license: BSD, see LICENSE for more details.
"""
import socket
try:
from ssl import SSLError
except ImportError:
class SSLError(Exception): # noqa
pass
from amqplib import client_0_... | mzdaniel/oh-mainline | vendor/packages/kombu/kombu/transport/pyamqplib.py | Python | agpl-3.0 | 9,517 | 0.002102 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-14 06:27
from __future__ import unicode_literals
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('edgar', '0007_auto_20170706_2215'),
]
operati... | MiningTheDisclosures/conflict-minerals-data | conflict_minerals_data/edgar/migrations/0008_edgardocumentcontent_urls.py | Python | mit | 628 | 0.001592 |
import vanilla
import urlparse
import fnmatch
import base64
import bencode
import struct
import socket
import peers
import posixpath
from eventlet.green import zmq
import cPickle as pickle
import eventlet.queue
import fairywren
import itertools
import logging
import array
def sendBencodedWsgiResponse(env,start_respons... | hydrogen18/fairywren | tracker.py | Python | mit | 8,937 | 0.053933 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2021-2022 Daniel Estevez <daniel@destevez.net>
#
# This file is part of gr-satellites
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
from gnuradio import gr, digital
import pmt
from ...hier.sync_to_pdu_packed import sync_to_pdu_packed
from ...hdlc_deframer ... | daniestevez/gr-satellites | python/components/deframers/yusat_deframer.py | Python | gpl-3.0 | 2,570 | 0 |
# Generated by Django 3.0.5 on 2020-04-17 14:12
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import easy_thumbnails.fields
import userena.models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_... | ngageoint/geoq | geoq/accounts/migrations/0001_initial.py | Python | mit | 3,881 | 0.004638 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-13 11:29
from __future__ import unicode_literals
from django.db import migrations, models
import jsonfield.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
... | barseghyanartur/django-admin-tools-stats | admin_tools_stats/migrations/0001_initial.py | Python | mit | 3,865 | 0.004398 |
# Copyright 2012 Red Hat, 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 agre... | Hybrid-Cloud/Hybrid-Cloud-Patches-For-Tricircle | hybrid-cloud/neutron/plugins/openvswitch/common/config.py | Python | gpl-2.0 | 5,912 | 0.000507 |
#author CongThuc 12/13/2015
import MySQLdb
from database.DBHelper import DBHelper
from database.DBConnectManager import DBConnectManager
from resourcefactories.AnalysisInitDefaultValue import AnalysisInitDefaultValue
db_helper = DBHelper()
class DataUtils:
def __init__(self):
print "init DataUtils"
... | congthuc/androguard-2.0-custom | database/DataUtils.py | Python | apache-2.0 | 4,034 | 0.008676 |
# encoding: 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):
# Deleting model 'Repo'
db.delete_table('package_repo')
# Deleting field 'Package.repo'
d... | miketheman/opencomparison | package/migrations/0015_auto__del_repo__del_field_package_repo.py | Python | mit | 10,959 | 0.008304 |
#!/usr/bin/python
import os, subprocess
amsDecode = "/usr/local/bin/amsDecode"
path = "/usr/local/bin"
specDataFile = "specData.csv"
f = open("processFile.log", "w")
if os.path.exists(specDataFile):
os.remove(specDataFile)
for fileName in os.listdir('.'):
if fileName.endswith('.bin'):
#print 'file :' + fil... | jennyb/amsDecode | processBinFiles.py | Python | gpl-2.0 | 451 | 0.046563 |
# shamelessly copied from pliExpertInfo (Vali, Mirakels, Littlesat)
from enigma import iServiceInformation, iPlayableService
from Components.Converter.Converter import Converter
from Components.Element import cached
from Components.config import config
from Tools.Transponder import ConvertToHumanReadable, getChannelNu... | Taapat/enigma2-openpli-vuplus | lib/python/Components/Converter/PliExtraInfo.py | Python | gpl-2.0 | 12,757 | 0.031199 |
# -*- coding: utf-8; -*-
#
# Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. Crate licenses
# this file to you under the Apache License, Version 2.0 (the "License"... | crate/crate-python | src/crate/client/sqlalchemy/tests/bulk_test.py | Python | apache-2.0 | 2,714 | 0 |
def is_lazy_user(user):
""" Return True if the passed user is a lazy user. """
# Anonymous users are not lazy.
if user.is_anonymous:
return False
# Check the user backend. If the lazy signup backend
# authenticated them, then the user is lazy.
backend = getattr(user, 'backend', None)
... | danfairs/django-lazysignup | lazysignup/utils.py | Python | bsd-3-clause | 570 | 0 |
from djpcms import test
from djpcms.core.exceptions import AlreadyRegistered
import djpcms
class TestSites(test.TestCase):
def testMake(self):
self.assertRaises(AlreadyRegistered,djpcms.MakeSite,__file__)
site = djpcms.MakeSite(__file__, route = '/extra/')
self.assertEqual(sit... | strogo/djpcms | tests/regression/routes/tests.py | Python | bsd-3-clause | 741 | 0.026991 |
# -*- coding: utf-8 -*-
# Copyright(C) 2012 Romain Bignon
#
# This file is part of weboob.
#
# weboob 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 opti... | laurent-george/weboob | modules/prixcarburants/pages.py | Python | agpl-3.0 | 2,744 | 0.001094 |
# Copyright 2012 the rootpy developers
# distributed under the terms of the GNU General Public License
"""
This module supports monitoring TObject deletions.
.. warning::
This is not recommended for production
"""
from __future__ import absolute_import
from weakref import ref
import ctypes
from ctypes import CFUN... | qbuat/rootpy | rootpy/memory/deletion.py | Python | gpl-3.0 | 3,682 | 0.000543 |
# -*- coding: utf-8 -*-
from flask import Flask, jsonify, request, abort, make_response
from futu_server_api import *
from db import save_update_token
from db import delete_tokens
from db import list_cards
import logging
import logging.config
import json
app = Flask(__name__)
logging.config.fileConfig('./conf/log.ini... | zznn/futu-openAPI | app/mainapp.py | Python | apache-2.0 | 6,014 | 0.02758 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Modulos
import sys
import pygame
from pygame.locals import *
# Constantes
venx = 640
veny = 448
# Clases
class Pieza(pygame.sprite.Sprite): # 64x64 px tamaño
def __init__(self, tipo):
pygame.sprite.Sprite.__init__(self)
if tipo == 0:
... | LordSprit/Laser | main.py | Python | gpl-2.0 | 2,036 | 0.000983 |
from Chip import OpCodeDefinitions
from Tests.OpCodeTests.OpCodeTestBase import OpCodeTestBase
class TestNopOpCode(OpCodeTestBase):
def test_nop_implied_command_calls_nop_method(self):
self.assert_opcode_execution(OpCodeDefinitions.nop_implied_command, self.target.get_nop_command_executed)
| jeroanan/Nes2 | Tests/OpCodeTests/TestNopOpCode.py | Python | bsd-3-clause | 306 | 0.003268 |
# Copyright (c) 2012 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2012 Amazon.com, Inc. or its affiliates.
# All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software withou... | lochiiconnectivity/boto | tests/integration/dynamodb2/test_cert_verification.py | Python | mit | 1,511 | 0 |
import operator
import os
import shutil
import tempfile
import unittest
import warnings
import tables
from mock import Mock
from numpy import array
from numpy.testing import assert_array_equal
from sapphire.analysis import process_events
TEST_DATA_FILE = 'test_data/process_events.h5'
DATA_GROUP = '/s501'
class Pr... | HiSPARC/sapphire | sapphire/tests/analysis/test_process_events.py | Python | gpl-3.0 | 15,851 | 0.002713 |
SEFARIA_API_NODE = "https://www.sefaria.org/api/texts/"
CACHE_MONITOR_LOOP_DELAY_IN_SECONDS = 86400
CACHE_LIFETIME_SECONDS = 604800
category_colors = {
"Commentary": "#4871bf",
"Tanakh": "#004e5f",
"Midrash": "#5d956f",
"Mishnah": "#5a99b7",
"Talmud": "#c... | nassan/sefaria-embedded | constants.py | Python | gpl-3.0 | 1,909 | 0 |
#!/usr/bin/env python
# encoding: utf-8
"""
models.py
Created by Darcy Liu on 2012-03-03.
Copyright (c) 2012 Close To U. All rights reserved.
"""
from django.db import models
from django.contrib.auth.models import User
# class Setting(models.Model):
# sid = models.AutoField(primary_key=True)
# option = model... | darcyliu/storyboard | home/models.py | Python | mit | 2,582 | 0.013555 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from itertools import combinations
__all__ = [
'network_complement'
]
def network_complement(network, cls=None):
"""Generate the complement network of a network.
The complement of a graph G is ... | compas-dev/compas | src/compas/datastructures/network/complementarity.py | Python | mit | 1,442 | 0.001387 |
"""Inspectors allow you to visually browse through the members of
various python objects. To open an inspector, import this module, and
execute inspector.inspect(anObject) I start IDLE with this command
line: idle.py -c "from inspector import inspect"
so that I can just type: inspect(anObject) any time."""
__all__ =... | ee08b397/panda3d | direct/src/tkpanels/Inspector.py | Python | bsd-3-clause | 15,271 | 0.00681 |
#example
from kivy.base import runTouchApp
from kivy.lang import Builder
from kivy.garden.light_indicator import Light_indicator
from kivy.uix.button import Button
# LOAD KV UIX
runTouchApp(Builder.load_file('example.kv'))
| CAES-Python/CAES_Kivy_Garden | garden.light_indicator/example.py | Python | mit | 229 | 0.026201 |
# Copyright 2020 Princeton University
#
# 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... | brainiak/brainiak | brainiak/eventseg/event.py | Python | apache-2.0 | 26,617 | 0 |
"""bubble - re-emit a log record with superdomain
| bubble [field=host] [parts=3]
adds 'superhost' field
"""
import sys,splunk.Intersplunk
import re
ipregex = r"(?P<ip>((25[0-5]|2[0-4]\d|[01]\d\d|\d?\d)\.){3}(25[0-5]|2[0-4]\d|[01]\d\d|\d?\d))"
ip_rex = re.compile(ipregex)
def super_domain(host, output_parts)... | JustinAzoff/splunk-scripts | bubble.py | Python | mit | 1,305 | 0.010728 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
import cPickle as pickle
except ImportError:
import pickle
import os.path
class FileCache(dict):
def __init__(self, filename):
self.filename = os.path.abspath(filename)
try:
self.update(pickle.load(open(self.filename)))
... | moonfruit/yyfeed | lib/yyfeed/util/cache.py | Python | apache-2.0 | 1,274 | 0.000785 |
# This file is part of MyPaint.
# Copyright (C) 2015 by Andrew Chadwick <a.t.chadwick@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 2 of the License, or
# (at your ... | prescott66/mypaint | gui/inktool.py | Python | gpl-2.0 | 28,795 | 0.000903 |
##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2011, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided ... | cedriclaunay/gaffer | python/GafferUI/ApplicationMenu.py | Python | bsd-3-clause | 5,283 | 0.038236 |
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.orm import relationship
from sqlalchemy.sql import func
db = SQLAlchemy()
class BaseTable(db.Model):
__abstract__ = True
updated = db.Column(db.DateTime, default=func.now(), onupdate=func.current_timestamp())
created = db.Column(db.DateTime, default=func.... | Salamek/git-deploy | git_deploy/database.py | Python | gpl-3.0 | 3,246 | 0.021873 |
"""
The MIT License (MIT)
Copyright (c) [2015-2018] [Andrew Annex]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modif... | drbitboy/SpiceyPy | spiceypy/__init__.py | Python | mit | 1,313 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = "Julien Chaumont"
__copyright__ = "Copyright 2014, Julien Chaumont"
__licence__ = "MIT"
__version__ = "1.0.2"
__contact__ = "julienc91 [at] outlook.fr"
import flickrapi
import os, sys
import re
from config import *
class ShFlickr:
##
# Connexion to F... | julienc91/ShFlickr | main.py | Python | mit | 6,714 | 0.004319 |
# Create your views here.
from django.contrib.auth.models import Group
from django.core.validators import URLValidator
from django.core.exceptions import ValidationError
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestConte... | Ecotrust/PEW-EFH | mp/visualize/views.py | Python | apache-2.0 | 11,227 | 0.004186 |
# -*- coding: utf-8 -*-
# Author: Mikhail Polyanskiy
# Last modified: 2017-04-02
# Original data: Rakić et al. 1998, https://doi.org/10.1364/AO.37.005271
import numpy as np
import matplotlib.pyplot as plt
# Lorentz-Drude (LD) model parameters
ωp = 9.03 #eV
f0 = 0.760
Γ0 = 0.053 #eV
f1 = 0.024
Γ1 = 0.241 #eV
ω1 = 0.... | polyanskiy/refractiveindex.info-scripts | scripts/Rakic 1998 - Au (LD model).py | Python | gpl-3.0 | 2,100 | 0.028529 |
#!/usr/bin/python
#
# 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 later version.
#
# Ansible is distribut... | andreaso/ansible | lib/ansible/modules/network/nxos/nxos_overlay_global.py | Python | gpl-3.0 | 8,884 | 0.0009 |
#!/usr/bin/env python3
#
import re
import evdev
import subprocess
import time
import argparse
def process_test_line(line, controls):
tmp = line.strip()
fields = tmp.split()
operation = fields[1].lower()
if operation == 'receive':
target = fields[2].lower()
if target == 'syn':
return (... | uglyDwarf/evdevshift | scafold2.py | Python | mit | 4,502 | 0.026877 |
#!/usr/bin/env python
import os
import re
import sys
import socket
import httplib
import urlparse
from urllib import urlencode
from urllib2 import urlopen
from argparse import ArgumentParser
from collections import OrderedDict
def _get_discover_url(given_discover_url, update_type):
if update_type == '4':
r... | popen2/he_dns | update_he_dns.py | Python | mit | 4,258 | 0.005636 |
from django.conf.urls import patterns, include, url
from misago.threads.views.privatethreads import PrivateThreadsView
urlpatterns = patterns('',
url(r'^private-threads/$', PrivateThreadsView.as_view(), name='private_threads'),
url(r'^private-threads/(?P<page>\d+)/$', PrivateThreadsView.as_view(), name='priva... | 390910131/Misago | misago/threads/urls/privatethreads.py | Python | gpl-2.0 | 5,045 | 0.008523 |
# -*- coding: utf-8 -*-
import ast
import os
import requests
import models
from config import config, sqla
from gevent.pool import Pool
from helpers import random_str, down
base_path = config.get('photo', 'path')
base_path = os.path.join(base_path, 'celebrity')
cookies = {
'bid': ''
}
def create_down(str_u... | billvsme/videoSpider | webs/douban/tasks/down_celebrity_images.py | Python | mit | 1,702 | 0 |
"""A fast, lightweight, and secure session WSGI middleware for use with GAE."""
import datetime
import hashlib
import hmac
import logging
import os
import pickle
import threading
import time
from Cookie import CookieError, SimpleCookie
from base64 import b64decode, b64encode
from google.appengine.api import memcache
f... | rhefner1/ghidonations | gaesessions/__init__.py | Python | apache-2.0 | 21,922 | 0.002144 |
import itchat, time, re
from itchat.content import *
import urllib2, urllib
import json
from watson_developer_cloud import ConversationV1
response={'context':{}}
@itchat.msg_register([TEXT])
def text_reply(msg):
global response
request_text = msg['Text'].encode('UTF-8')
conversation = ConversationV1(
username='... | Jonathanliu92251/watson-conversation | wechat/watson-wechat.py | Python | apache-2.0 | 1,140 | 0.032456 |
# Copyright 2008-2013 Nokia Siemens Networks Oyj
#
# 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... | yamateh/robotframework | src/robot/running/arguments/argumentvalidator.py | Python | apache-2.0 | 2,829 | 0.000353 |
# -*- coding: utf-8 -*-
import nltk
import csv
import random
import codecs
import re
from nltk.corpus import stopwords
stopset = list(set(stopwords.words('spanish')))
hil_tweets = []
trump_tweets = []
bernie_tweets = []
cruz_tweets = []
classes = {}
def transform(temp):
if temp == "imo":
return "opinion"... | karanjeets/CSCI-544 | Experimental/classifier/tweet_can_es.py | Python | apache-2.0 | 5,270 | 0.009298 |
# ===============================================================================
# Copyright 2016 ross
#
# 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/LICE... | UManPychron/pychron | pychron/media_storage/ftp_storage.py | Python | apache-2.0 | 2,366 | 0.000423 |
from ctypes import *
from ctypes.wintypes import HANDLE
from ctypes.wintypes import BOOL
from ctypes.wintypes import LPCWSTR
_stdcall_libraries = {}
_stdcall_libraries['kernel32'] = WinDLL('kernel32')
from ctypes.wintypes import DWORD
from ctypes.wintypes import WORD
from ctypes.wintypes import BYTE
INVALID_HANDLE_VAL... | pacoqueen/cican | utils/gmapcatcher/gmapcatcher/pyGPSD/nmea/serial/win32.py | Python | gpl-3.0 | 9,044 | 0.006634 |
"""
Tests for the Gauges template tags and filters.
"""
from django.http import HttpRequest
from django.template import Context
from django.test.utils import override_settings
from analytical.templatetags.gauges import GaugesNode
from analytical.tests.utils import TagTestCase
from analytical.utils import AnalyticalEx... | pjdelport/django-analytical | analytical/tests/test_tag_gauges.py | Python | mit | 2,359 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
def get_ki2_list(parser):
parser.add_argument('-p', '--path_2chkifu',
default='~/data/shogi/2chkifu/',
help='2chkifu.zipを展開したディレクトリ')
args = parser.parse_args()
path_2chkifu = args.path_2chkifu
s... | tosh1ki/pyogi | doc/sample_code/get_ki2_list.py | Python | mit | 741 | 0 |
from flask import Blueprint, jsonify, request
routes_api = Blueprint('routes_api', __name__)
@routes_api.route('/v1/routes', methods=['GET'])
def routes_get():
'''
Get a list of routes
It is handler for GET /routes
'''
return jsonify()
| ridindirtyatl/truffle-api | routes.py | Python | agpl-3.0 | 261 | 0 |
"""
Support for manual alarms.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/alarm_control_panel.manual/
"""
import copy
import datetime
import logging
import voluptuous as vol
import homeassistant.components.alarm_control_panel as alarm
import homeas... | ewandor/home-assistant | homeassistant/components/alarm_control_panel/manual.py | Python | apache-2.0 | 10,887 | 0 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2012 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the G... | 3dfxsoftware/cbss-addons | lunch/__openerp__.py | Python | gpl-2.0 | 2,636 | 0.006084 |
from django import forms, template
from django.core.cache import cache
from repertoire_telephonique.models import Phone
register = template.Library()
@register.simple_tag
def simple_add(a, b):
return a + b
@register.inclusion_tag('vcard/tags/form_phone.html')
def get_form_phone(contact_id):
# get from cache... | toopy/django-mon-premier-projet | src/mon_premier_projet/apps/vcard/templatetags/vcard.py | Python | mit | 901 | 0.006659 |
# -*- coding: utf-8 -*-
"""
Integration tests for submitting problem responses and getting grades.
"""
import json
import os
from textwrap import dedent
from django.conf import settings
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test.client import RequestFactor... | martynovp/edx-platform | lms/djangoapps/courseware/tests/test_submitting_problems.py | Python | agpl-3.0 | 51,827 | 0.001777 |
# -*- coding: utf-8 -*-
"""
logbook.testsuite
~~~~~~~~~~~~~~~~~
The logbook testsuite.
:copyright: (c) 2010 by Armin Ronacher, Georg Brandl.
:license: BSD, see LICENSE for more details.
"""
import sys
import unittest
import logbook
_skipped_modules = []
_missing = object()
_func_ident = lambda f... | chiehwen/logbook | logbook/testsuite/__init__.py | Python | bsd-3-clause | 2,534 | 0.001579 |
import unittest
import pandas as pd
from pandas.util.testing import assert_series_equal
import numpy as np
from easyframes.easyframes import hhkit
class TestStataMerge(unittest.TestCase):
def setUp(self):
"""
df_original = pd.read_csv('sample_hh_dataset.csv')
df = df_original.copy()
print(df.to_dict())
... | shafiquejamal/easyframes | easyframes/test/test_statamerge.py | Python | apache-2.0 | 4,184 | 0.032744 |
# Copyright 2021 Red Hat, Inc. Jake Hunsaker <jhunsake@redhat.com>
# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General ... | slashdd/sos | sos/cleaner/archives/insights.py | Python | gpl-2.0 | 1,284 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
tools for imr datasets
@author: Chris Mantas
@contact: the1pro@gmail.com
@since: Created on 2016-02-12
@todo: custom formats, break up big lines
@license: http://www.apache.org/licenses/LICENSE-2.0 Apache License
"""
from ast import literal_eval
from collections impor... | project-asap/IReS-Platform | asap-tools/imr-code/imr_workflow_spark/operators/imr_tools.py | Python | apache-2.0 | 5,668 | 0.000706 |
#!/usr/bin/python2.7
# Copyright 2012 Google Inc. All Rights Reserved.
"""Support for simple JSON templates.
A JSON template is a dictionary of JSON data in which string values
may be simple templates in string.Template format (i.e.,
$dollarSignEscaping). By default, the template is expanded against
its own data, op... | dougbeal/google-apis-client-generator | src/googleapis/codegen/utilities/json_expander.py | Python | apache-2.0 | 1,809 | 0.008292 |
"""
raven.transport.exceptions
~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
class InvalidScheme(ValueError):
"""
Raised when a transport is constructed using a URI which is not
handled by the... | lptorres/noah-inasafe | web_api/third_party/raven/transport/exceptions.py | Python | gpl-3.0 | 498 | 0 |
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 07 13:58:49 2015
@author: Wasit
"""
import serial
import re
import datetime
#ser = serial.Serial('/dev/tty.usbserial', 9600)
#ser = serial.Serial('COM7', 9600)
#ser = serial.Serial(0) # open first serial port
ser=None
for i in xrange(10):
try:
ser = serial.Se... | wasit7/tutorials | arduino_python/02_python_serial/readUno.py | Python | mit | 669 | 0.019432 |
from datetime import datetime, timedelta
from manager_rest.test.base_test import BaseServerTestCase
from cloudify_rest_client.exceptions import CloudifyClientError
class ExecutionSchedulesTestCase(BaseServerTestCase):
DEPLOYMENT_ID = 'deployment'
fmt = '%Y-%m-%dT%H:%M:%S.%fZ'
an_hour_from_now = \
... | cloudify-cosmo/cloudify-manager | rest-service/manager_rest/test/endpoints/test_execution_schedules.py | Python | apache-2.0 | 8,636 | 0 |
#!/usr/bin/env python
from sys import argv, stderr
usage = \
"""
Usage: {program} <sample rate> <A4 freq.> [octaves=8]
e.g.: {program} 64000 442.0 5
""".format(program=argv[0])
if len(argv) < 3 or len(argv) > 4 :
print(usage, file = stderr)
exit(1)
A4 = 0
sample_rate = 0
octaves = 8
try:
A4 = float(argv... | bardes/sonitus | tools/tone_gen.py | Python | mit | 1,271 | 0.02203 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2017-07-27 15:04
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('press', '0001_initial'),
]
operations = [
mig... | BirkbeckCTP/janeway | src/press/migrations/0002_auto_20170727_1504.py | Python | agpl-3.0 | 979 | 0.003064 |
# -*- coding: utf8 -*-
"CountColumn filter"
from .abstract import AbstractFilter
class CountColumn(AbstractFilter):
"Count a flux's column and put the result in a variable"
name = 'Compter colonnes'
description = "Compte le nombre de colonnes d'un flux et met le résultat dans une variable"
node_in =... | Exanis/cannelloni | backend/filters/count_column.py | Python | mit | 662 | 0.003026 |
import bitcoin
import struct
import serialize
class BlockHeader:
def __init__(self):
self.height = None
@classmethod
def deserialize(cls, raw):
assert len(raw) == 80
self = cls()
self.version = struct.unpack('<I', raw[:4])[0]
self.previous_block_hash = raw[4:36][::... | BWallet/sx | src/obelisk/models.py | Python | agpl-3.0 | 3,035 | 0.003295 |
__author__ = 'sondredyvik'
class ConstraintNet:
def __init__(self):
self.constraints = {}
def add_constraint(self,key,constraint):
if key in self.constraints:
self.constraints[key].append(constraint)
else:
self.constraints[key] = [constraint]
| pmitche/it3105-aiprogramming | project1/common/constraintnet.py | Python | mit | 304 | 0.009868 |
#
# Graphene schema for exposing ProcessClassification model
#
import graphene
from valuenetwork.valueaccounting.models import ProcessType
from valuenetwork.api.types.Process import ProcessClassification
from valuenetwork.api.types.EconomicEvent import Action
from django.db.models import Q
class Query(object): #gra... | FreedomCoop/valuenetwork | valuenetwork/api/schemas/ProcessClassification.py | Python | agpl-3.0 | 887 | 0.002255 |
"""
This module implement a filesystem storage adapter.
"""
from __future__ import unicode_literals
import errno
import logging
import os
from flask import current_app
from .interface import ImagineAdapterInterface
from PIL import Image
LOGGER = logging.getLogger(__name__)
class ImagineFilesystemAdapter(ImagineAdapt... | FlaskGuys/Flask-Imagine | flask_imagine/adapters/filesystem.py | Python | mit | 4,244 | 0.001178 |
"""
Flask routing
"""
from flask import Flask, request, session, send_from_directory, render_template
from werkzeug.contrib.fixers import ProxyFix
app = Flask(__name__, static_path="/")
app.wsgi_app = ProxyFix(app.wsgi_app)
import api
import json
import mimetypes
import os.path
from datetime import datetime
from ap... | picoCTF/picoCTF-Platform-2 | api/api/app.py | Python | mit | 2,943 | 0.008155 |
# Django settings for sensible_data_platform project.
import os
import LOCAL_SETTINGS
from utils import SECURE_platform_config
DEBUG = True
TEMPLATE_DEBUG = DEBUG
MAINTENANCE_MODE = False
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
BASE_DIR = LOCAL_SETTINGS.BASE_DIR
ROOT_DIR = LOCA... | MIT-Model-Open-Data-and-Identity-System/SensibleData-Platform | sensible_data_platform/sensible_data_platform/settings.py | Python | mit | 6,429 | 0.004977 |
from __future__ import print_function
from builtins import object
import psycopg2
import psycopg2.extras
from gevent.lock import BoundedSemaphore as Semaphore
from gevent.local import local as gevent_local
from config import PG_DSN,DONESTATES
from gevent import sleep
# migration stuff
import json,re
from datetime impo... | SandStormHoldings/ScratchDocs | pg.py | Python | mit | 12,792 | 0.021029 |
import sys
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from Bio.Alphabet import generic_dna
from Bio import SeqIO
import numpy
import math
import itertools as it
MATERNALFASTAFILENAMELISTFILENAME = sys.argv[1]
PATERNALFASTAFILENAMELISTFILENAME = sys.argv[2]
PEAKHEIGHTFILENAME = sys.argv[3]
... | imk1/IMKTFBindingCode | makeSequenceInputsKMerMotifCounts.py | Python | mit | 12,089 | 0.020928 |
# Copyright (c) 2020, Michael Boyle
# See LICENSE file for details: <https://github.com/moble/spherical_functions/blob/master/LICENSE>
### NOTE: The functions in this file are intended purely for inclusion in the Grid class. In
### particular, they assume that the first argument, `self` is an instance of Grid. They ... | moble/spherical_functions | spherical_functions/SWSH_grids/utilities.py | Python | mit | 2,746 | 0.006191 |
#
# Copyright © 2012–2022 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Licens... | nijel/weblate | weblate/metrics/apps.py | Python | gpl-3.0 | 906 | 0 |
# -*- coding: utf-8 -*-
import sys
#Éú³ÉºòÑ¡¼¯C1
#return£º×Öµäkey=item;value=item³öÏֵĴÎÊý
def getC1(srcdata):
c1 = {}
for transaction in srcdata:
for item in transaction:
key = frozenset(set([item])) #frozenset²Å¿ÉÒÔ×÷Ϊ×ÖµäµÄkey
#¼ÆÊýitem
if key in c1:
... | RayleighChen/Improve | Project/python/PyLDA-Apriori/m3.py | Python | mit | 2,169 | 0.033195 |
#!/usr/bin/env python
# encoding: utf-8
import urllib
from config import USERNAME, EXTENSION, PASSWORD, APP_KEY, APP_SECRET, SERVER, MOBILE
from ringcentral import SDK
def main():
sdk = SDK(APP_KEY, APP_SECRET, SERVER)
platform = sdk.platform()
platform.login(USERNAME, EXTENSION, PASSWORD)
to_number... | ringcentral/python-sdk | demo_sms.py | Python | mit | 609 | 0.00821 |
# encoding: utf-8
'''
@author: Jose Emilio Romero Lopez
@copyright: Copyright 2013-2014, Jose Emilio Romero Lopez.
@license: GPL
@contact: jemromerol@gmail.com
This file is part of APASVO.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Pu... | jemromerol/apasvo | apasvo/gui/views/loaddialog.py | Python | gpl-3.0 | 5,689 | 0.000879 |
from fibonacci import Fibonacci
def ans():
return Fibonacci.index(Fibonacci.after(int('9' * 999)))
if __name__ == '__main__':
print(ans())
| mackorone/euler | src/025.py | Python | mit | 155 | 0.006452 |
# -*- coding: utf-8 -*-
import json
import re
import unicodedata
import string
from urllib import urlencode
from requests import get
languages = {'de', 'en', 'es', 'fr', 'hu', 'it', 'nl', 'jp'}
url_template = 'https://www.wikidata.org/w/api.php?action=wbgetentities&format=json&{query}&props=labels%7Cdatatype%7Cclai... | kdani3/searx | utils/fetch_currencies.py | Python | agpl-3.0 | 4,394 | 0.009558 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | timj/scons | test/Variables/ListVariable.py | Python | mit | 5,013 | 0.000798 |
from django.conf.urls import patterns, include, url
from django.conf import settings
from cabot.cabotapp.views import (
run_status_check, graphite_api_data, checks_run_recently,
duplicate_icmp_check, duplicate_graphite_check, duplicate_http_check, duplicate_jenkins_check,
duplicate_instance, acknowledge_ale... | mcansky/cabotapp | cabot/urls.py | Python | mit | 6,860 | 0.008017 |
"""Testing for ORM"""
from unittest import TestCase
import nose
from nose.tools import eq_
from sets import Set
from mdcorpus.orm import *
class ORMTestCase(TestCase):
def setUp(self):
self.store = Store(create_database("sqlite:"))
self.store.execute(MovieTitlesMetadata.CREATE_SQL)
self... | sosuke-k/cornel-movie-dialogs-corpus-storm | mdcorpus/tests/test_orm.py | Python | mit | 4,351 | 0.002758 |
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
"""Core rules for Pants to operate correctly.
These are always activated and cannot be disabled.
"""
from pants.core.goals import check, fmt, lint, package, publish, repl, run, tailor, t... | patricklaw/pants | src/python/pants/core/register.py | Python | apache-2.0 | 1,821 | 0.000549 |
from django.db import models
class MaternalArvPostModManager(models.Manager):
def get_by_natural_key(
self, arv_code, report_datetime, visit_instance, appt_status,
visit_definition_code, subject_identifier_as_pk):
MaternalVisit = models.get_model('mb_maternal', 'MaternalVisit')
... | botswana-harvard/microbiome | microbiome/apps/mb_maternal/managers/maternal_arv_post_mod_manager.py | Python | gpl-2.0 | 736 | 0.002717 |
#!/usr/bin/env python
"""
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");... | alexryndin/ambari | ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/scripts/hcat.py | Python | apache-2.0 | 2,284 | 0.011384 |
from django.test import TestCase
from app_forum.models import Forum, Comment
from app_forum.forms import CommentForm, ThreadForm
# test for forms
class CommentFormTest(TestCase):
def test_comment_forms(self):
form_data = {
'comment_content' : 'comment'
}
form = CommentForm(dat... | django-id/website | app_forum/tests/test_forms.py | Python | mit | 685 | 0.008759 |
#!/usr/bin/env python
# coding: UTF-8
from __future__ import division
import numpy as np
def left_multiplication(g, x):
"""
Multiplication action of a group and a vector.
"""
return np.dot(g, x)
def trans_adjoint(g, x):
return np.dot(np.dot(g,x),g.T)
class RungeKutta(object):
def __init__(... | olivierverdier/homogint | homogint/homogint.py | Python | mit | 1,957 | 0.00511 |
from ete3 import Tree,TreeStyle,TextFace
t = Tree('tagfrog.phy')
for node in t.traverse():
node.img_style['size'] = 3
if node.is_leaf():
name_face = TextFace(node.name)
ts = TreeStyle()
ts.show_scale = True
t.render('tagfrog.pdf')
| taejoonlab/taejoonlab-toolbox | PopGen/phy2bmp.py | Python | gpl-3.0 | 248 | 0.008065 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.