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 |
|---|---|---|---|---|---|
from scrapy.commands.crawl import Command
from scrapy.exceptions import UsageError
from typing import List, Any
class StatusCommand(Command):
def run(self, args, opts):
# type: (List[str], Any) -> None
if len(args) < 1:
raise UsageError()
elif len(args) > 1:
raise U... | sonali0901/zulip | tools/documentation_crawler/documentation_crawler/commands/crawl_with_status.py | Python | apache-2.0 | 784 |
from __future__ import print_function
import os
import networking
import tts.tts as tts
import schedule
import robot_util
# TODO
# If I pull the send_video stuff into controller, the ability to restart the ffmpeg process would
# be useful
# /stationary only able to move left and right.
#/mod username
#/unmod usernam... | Nocturnal42/runmyrobot | extended_command.py | Python | apache-2.0 | 10,228 |
from flask_smorest import Page
class CursorPage(Page):
@property
def item_count(self):
return self.collection.count()
| ev-agelos/Python-bookmarks | bookmarks/api/pagination.py | Python | mit | 136 |
#!/usr/bin/env python3
#
# Copyright (C) 2020 FreeIPA Contributors see COPYING for license
#
"""Configure lite-server environment.
See README.md for more details.
"""
import argparse
import os
import socket
from urllib.request import urlopen
DEFAULT_CONF = """\
[global]
host = {args.hostname}
server = {args.servernam... | encukou/freeipa | contrib/lite-setup.py | Python | gpl-3.0 | 5,165 |
# -*- coding: utf-8 -*-
"""
garage.help_text
Helper function to retrieve help text for backend admin form views.
* created: 2011-03-18 Kevin Chan <kefin@makedostudio.com>
* updated: 2014-11-21 kchan
"""
from __future__ import (absolute_import, unicode_literals)
import warnings
# issue deprecation warning
# * This ... | kefin/django-garage | garage/help_text.py | Python | bsd-3-clause | 1,517 |
# Copyright 2011 OpenStack Foundation
# 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 requ... | potsmaster/cinder | cinder/api/contrib/quotas.py | Python | apache-2.0 | 7,248 |
# -*- Mode: Python; -*-
# Package : omniORBpy
# PortableServer__POA.py Created on: 2000/02/24
# Author : Duncan Grisby (dpg1)
#
# Copyright (C) 2002-2013 Apasphere Ltd
# Copyright (C) 2000 AT&T Laboratories Cambridge
#
# This file is part of the om... | amonmoce/corba_examples | omniORBpy-4.2.1/python3/omniORB/PortableServer__POA.py | Python | mit | 2,639 |
import json
import os
import tarfile
import unittest
from hashlib import md5
from time import sleep
from netjsonconfig import OpenWrt
from netjsonconfig.exceptions import ValidationError
from netjsonconfig.utils import _TabsMixin
class TestBackend(unittest.TestCase, _TabsMixin):
maxDiff = None
def test_conf... | openwisp/netjsonconfig | tests/openwrt/test_backend.py | Python | gpl-3.0 | 17,902 |
from urllib.parse import urljoin
from twisted.internet import reactor
from twisted.web import server, resource, static, util
class SiteTest(object):
def setUp(self):
super(SiteTest, self).setUp()
self.site = reactor.listenTCP(0, test_site(), interface="127.0.0.1")
self.baseurl = "http://... | eLRuLL/scrapy | scrapy/utils/testsite.py | Python | bsd-3-clause | 1,514 |
#!/usr/bin/env python
"""
You can precisely specify dashes with an on/off ink rect sequence in
points.
"""
from pylab import *
dashes = [5,2,10,5] # 5 points on, 2 off, 3 on, 1 off
l, = plot(arange(20), '--')
l.set_dashes(dashes)
savefig('dash_control')
show()
| sniemi/SamPy | sandbox/src1/examples/dash_control.py | Python | bsd-2-clause | 264 |
#
# This file is part of Checkbox.
#
# Copyright 2008 Canonical Ltd.
#
# Checkbox 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.
#
# C... | jds2001/ocp-checkbox | checkbox/lib/pci.py | Python | gpl-3.0 | 3,097 |
"""Useful functions for the IHC component."""
import asyncio
from homeassistant.core import callback
async def async_pulse(hass, ihc_controller, ihc_id: int):
"""Send a short on/off pulse to an IHC controller resource."""
await async_set_bool(hass, ihc_controller, ihc_id, True)
await asyncio.sleep(0.1)
... | jawilson/home-assistant | homeassistant/components/ihc/util.py | Python | apache-2.0 | 868 |
#coding=UTF-8
'''
Created on 2011-7-6
@author: Administrator
'''
from urlparse import urlparse
import cookielib
import urllib2,urllib
from pyquery.pyquery import PyQuery
import re
import time
import datetime
import urllib2
from lxml import etree
import datetime
import time
from urlparse import urlparse
import re
from ... | ptphp/PyLib | src/webpy1/webpy/fetch/tongcheng58.py | Python | apache-2.0 | 32,102 |
"""
usage: __main__.py [-h] [--reset_prefs] [--no_prefs] [-image_out IMAGE_OUT]
[-plugin PLUGIN]
[tree]
Launch Kataja visualisation environment.
positional arguments:
tree bracket tree or source tree filename
optional arguments:
-h, --help show t... | jpurma/Kataja | kataja/launcher.py | Python | gpl-3.0 | 5,544 |
# -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Romain Bignon
# Copyright(C) 2012 François Revol
#
# 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 vers... | Konubinix/weboob | modules/vimeo/module.py | Python | agpl-3.0 | 2,848 |
# -*- coding: utf-8 -*-
class Parser(object):
'''
Base class for parsers
'''
def noun_tokenize(self, sentence):
'''
Extract only nouns
'''
tagged_tokens = self.pos_tokenize(sentence)
nouns = self.noun_filter(tagged_tokens)
nouns = self.stopword_filter(no... | mpkato/mobileclick | mobileclick/nlp/parser.py | Python | mit | 591 |
from math import *
m = 9.8e-28
q = 4.8e-10
print( "q = {:.3e} [cgs]".format( q ) )
print( "m = {:.3e} [g]".format( m ) )
ev_to_cgs = 1.60218e-12
E_along = 1000 * ev_to_cgs
v_along = sqrt( 2 * E_along / m )
E_perp = 100 * ev_to_cgs
v_perp = sqrt( 2 * E_perp/2 / m )
print( "E_along = {:.3e} [eV] = {:.3e} [erg]".format(... | epicf/ef | examples/single_particle_in_magnetic_field/estimates.py | Python | mit | 1,787 |
import psutil
def generate_process_graph():
"""
Returns a process graph of all the processes in the system.
"""
return ProcessGraph(psutil.process_iter())
class ProcessGraph(object):
def __init__(self, processes):
self.snapshots = {}
self.root_pids = []
self.child_map = ... | Spferical/visram | visram/processes.py | Python | mit | 4,514 |
## This file is part of PyGaze - the open-source toolbox for eye tracking
##
## PyGaze is a Python module for easily creating gaze contingent experiments
## or other software (as well as non-gaze contingent experiments/software)
## Copyright (C) 2012-2013 Edwin S. Dalmaijer
##
## This program is free... | esdalmaijer/EyeTribe_test | experiment/pygaze/examples/simple_tracker_experiment/constants.py | Python | gpl-3.0 | 4,442 |
"Bilateral grid."
import sys
from halide import *
int_t = Int(32)
float_t = Float(32)
def main():
def lerp(a, b, alpha):
return (1.0-alpha)*a + alpha*b
input = ImageParam(float_t, 3, 'input')
r_sigma = Param(float_t, 0.1)
s_sigma = 8
x = Var('x')
y = Var('y')
z = Var('z... | mikeseven/Halide | python_bindings/apps/bilateral_grid.py | Python | mit | 3,216 |
from kivy.graphics import Color, Line, Quad
from modeful.ui.diagram.relationship import Trigonometry
from modeful.ui.diagram.relationship.association import Association
class Aggregation(Association):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
with self.canv... | Modeful/poc | modeful/ui/diagram/relationship/aggregation.py | Python | gpl-3.0 | 774 |
from __future__ import absolute_import
#
# 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, Versio... | snithish/spark-testing-base | python/sparktestingbase/streamingtestcase.py | Python | apache-2.0 | 4,566 |
# Copyright (C) 2010-2018 The ESPResSo project
#
# This file is part of ESPResSo.
#
# ESPResSo 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... | hmenke/espresso | src/python/espressomd/accumulators.py | Python | gpl-3.0 | 10,294 |
"""
Models for activity
"""
from django.contrib.auth.models import User
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.utils.timesince import timesince as timesince
from django.db import models
class Activity(models.Model):
actor = models.For... | openhealthcare/opal-activity | activity/models.py | Python | agpl-3.0 | 1,075 |
# coding=utf-8
# Copyright 2020 The TF-Agents 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | tensorflow/agents | tf_agents/utils/value_ops_test.py | Python | apache-2.0 | 8,908 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-11-25 03:56
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('terms', '0001_initial'),
]
operations = [
migrations.AlterField(
... | sebastienbarbier/723e_server | seven23/models/terms/migrations/0002_auto_20171125_0356.py | Python | mit | 509 |
import numpy as np
import csv, os, random
from collections import Counter
def dirty_pairtree(htid):
period = htid.find('.')
prefix = htid[0:period]
postfix = htid[(period+1): ]
if '=' in postfix:
postfix = postfix.replace('+',':')
postfix = postfix.replace('=','/')
dirtyname = prefi... | tedunderwood/GenreProject | python/reception/fiction/makeficetymratio.py | Python | mit | 5,788 |
from django.test import TestCase
from candidator.models import Topic, Position, TakenPosition, Category
from popolo.models import Person
from candidator.comparer import Comparer, InformationHolder
class ComparisonTestCase(TestCase):
def setUp(self):
self.person1 = Person.objects.create(name=u"Person1")
... | lfalvarez/django-candidator | candidator/tests/comparison_tests.py | Python | mit | 21,582 |
### File: konane.py
### Classes defined: KonaneError, Konane, Player, SimplePlayer,
### RandomPlayer, HumanPlayer
import random
import copy
class KonaneError(AttributeError):
"""
This class is used to indicate a problem in the konane game.
"""
class Konane:
"""
This class implements Konane, the H... | okiyama/EEA-Opponent-Modeling | Konane/mycode/konane.py | Python | gpl-2.0 | 12,968 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-22 16:28
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('auth', '0008_alter_user_username_max_length'),
]
operations = [
migrations.... | auto-mat/klub | local_migrations/migrations_auth/0009_auto_20170822_1628.py | Python | gpl-3.0 | 514 |
import asyncio
from unittest import mock
import pytest
from waterbutler.core import utils
class TestAsyncRetry:
@pytest.mark.asyncio
async def test_returns_success(self):
mock_func = mock.Mock(return_value='Foo')
retryable = utils.async_retry(5, 0, raven=None)(mock_func)
x = await r... | TomBaxter/waterbutler | tests/core/test_utils.py | Python | apache-2.0 | 2,451 |
# various imported libraries
from django import forms
from django.contrib.auth.models import User
from share.models import File
from datetime import date, timedelta
from captcha.fields import CaptchaField
# Form for uploading the files
class FileForm(forms.Form):
#File
file = forms.FileField(label="File to upl... | roopansh/rshare | share/forms.py | Python | mit | 1,195 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-24 19:34
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Channel... | MarkDavidson/taxii2_demo | taxii2/migrations/0001_initial.py | Python | mit | 836 |
import pytest
from petra.place import Place
def test_place():
place = Place("place_0")
assert place.name == "place_0"
assert repr(place) == "Place('place_0')"
| simone-campagna/petra | tests/test_place.py | Python | apache-2.0 | 173 |
# -*- coding: utf-8 -*-
import os
# Reaction-Diffusion Simulation Using Gray-Scott Model
# https://en.wikipedia.org/wiki/Reaction-diffusion_system
# http://www.labri.fr/perso/nrougier/teaching/numpy/numpy.html#
# FB - 20160130
import random
import numpy as np
from PIL import Image, ImageDraw
n = 256
imgx = n
imgy = n... | NicovincX2/Python-3.5 | Analyse (mathématiques)/Analyse à plusieurs variables/Équation aux dérivées partielles/Système à réaction-diffusion/reaction_diffusion_numpy.py | Python | gpl-3.0 | 2,280 |
# pylint: disable=missing-module-docstring, missing-class-docstring
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('substitutions', '0003_auto_20171120_0745'),
]
operations = [
migrations.AlterModelOption... | studybuffalo/studybuffalo | study_buffalo/substitutions/migrations/0004_auto_20171120_1205.py | Python | gpl-3.0 | 593 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from ConfigParser import ConfigParser
from parser.logParser import Parser, LogObserverPlugin
from os import path
from importlib import import_module
import sys
def import_plugins(plug_list):
"""
Dada una lista de plugins para activar intenta importar los modulos c... | ybenitezf/miner | miner.py | Python | gpl-2.0 | 1,564 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import re
... | pantsbuild/zincutils | zincutils/zinc_analysis_parser.py | Python | apache-2.0 | 6,902 |
# This script reads the carrier database
# and display it along a path in histogram form
# along with a representation of the carriers in energy space
from __future__ import print_function
from yambopy import *
import matplotlib.gridspec as gridspec
from matplotlib.colors import Normalize
from scipy.optimize import cu... | alexandremorlet/yambopy | scripts/realtime/plot_occ.py | Python | bsd-3-clause | 9,213 |
import json
import xml.dom.minidom as minidom
class Article(object):
itemTag = {"content_type":"text/x-wiki","type":"article"}
#itemTag = {"content_type":"text/x-wiki","type":"article","wikiident":"lo","url":"http://asdlkf/","source-url":"http://sourceurl/","source":"http://source/"}
attributes = {}
in... | Limezero/libreoffice | helpcontent2/wiki-to-help/metabook.py | Python | gpl-3.0 | 4,798 |
# -*- coding: utf-8 -*-
# Copyright: (c) 2008, Jarek Zgoda <jarek.zgoda@gmail.com>
__revision__ = '$Id: models.py 28 2009-10-22 15:03:02Z jarek.zgoda $'
import re
from django.db import models
from django.core.urlresolvers import reverse
from django.conf import settings
from django.contrib.sites.models import Site
f... | jrowan/zulip | confirmation/models.py | Python | apache-2.0 | 4,244 |
H, W = map(int, input().split())
N = int(input())
A = [int(x) for x in input().split()]
board = [[0] * W for _ in range(H)]
colors = [i + 1 for i in range(N) for _ in range(A[i])]
for i in range(H):
if i % 2 == 0:
for j in range(W):
board[i][j] = colors[i * W + j]
else:
for j in ran... | knuu/competitive-programming | atcoder/arc/arc080_b.py | Python | mit | 409 |
import click
from os import listdir, makedirs, environ
from os.path import isdir, join, exists, abspath
from click import ClickException
from shutil import copytree
def create_at_path(name, path, my):
if exists(path):
raise ClickException("Role %s already exists" % path)
roledir = environ.get("ROLER_... | TheDivic/roler | roler.py | Python | mit | 1,592 |
from django.core.management import call_command
from django.test import TestCase
from poradnia.judgements.factories import CourtFactory
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
class RunCourtSessionParserTestCase(TestCase):
def test_run_command_basic(self):
... | watchdogpolska/poradnia | poradnia/judgements/tests/test_commands.py | Python | mit | 507 |
#!/usr/bin/env python
import bisect, os, sys, getopt, infodata, glob
import scipy, scipy.signal, ppgplot
import numpy as Num
from presto import rfft, next2_to_n
from psr_utils import coord_to_string
from optparse import OptionParser
from Pgplot import *
class candidate:
def __init__(self, DM, sigma, time, bin, dow... | pscholz/presto | bin/single_pulse_search.py | Python | gpl-2.0 | 30,794 |
# img
# trigger = attributes[12]
# http://ws-tcg.com/en/cardlist
# edit
import os
import requests
import sqlite3
def get_card(browser):
attributes = browser.find_elements_by_xpath('//table[@class="status"]/tbody/tr/td')
image = attributes[0].find_element_by_xpath('./img').get_attribute('src')
if attri... | electronicdaisy/WeissSchwarzTCGDatabase | card.py | Python | mit | 3,176 |
#
# Copyright 2010 Markus Pielmeier
#
# This file is part of brainfs.
#
# brainfs 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.
#
# b... | marook/brainfs | src/modules/brainfs/brainfs.py | Python | gpl-3.0 | 3,382 |
import json
import websocket
import logging
import random
try:
import http.client as HttpClient
except:
import httplib as HttpClient
from .protocol import ReallyClientProtocol
import threading
import collections
import socket
import exceptions
from .tracker import ReallyTracker
from .responses import GetRespon... | reallylabs/pyreally | pyreally/really.py | Python | apache-2.0 | 8,232 |
import csv
import datetime
import os
import re
from optparse import make_option
from django.core.management.base import NoArgsCommand
from django.utils.text import slugify
from django_date_extensions.fields import ApproximateDate
from pombola.core.models import (
Person, Place, Position, PositionTitle, Organisat... | mysociety/pombola | pombola/nigeria/management/commands/nigeria_add_governors.py | Python | agpl-3.0 | 8,002 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created: Tue Mar 11 13:01:43 2014
# by: The Resource Compiler for PyQt (Qt v4.8.4)
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
qt_resource_data = "\
\x00\x00\x05\x3e\
\x3c\
\x3f\x78\x6d\x6c\x20\x76\x65\x72\x73\x69\x6f\x6e\x... | xran-deex/PyChat | sys_rc.py | Python | mit | 13,017 |
from Components.PerServiceDisplay import PerServiceBase
from enigma import iPlayableService
from Source import Source
from Components.Element import cached
import NavigationInstance
class CurrentService(PerServiceBase, Source):
def __init__(self, navcore):
Source.__init__(self)
PerServiceBase.__init__(self, navc... | BlackHole/enigma2-obh10 | lib/python/Components/Sources/CurrentService.py | Python | gpl-2.0 | 1,504 |
class X(object):
def testChain(self):
return X()
def g():
return X()
g().testChain().testChain()
| akosyakov/intellij-community | python/testData/completion/chainedCall.after.py | Python | apache-2.0 | 116 |
from django import http
from django.conf.urls import patterns
from django.contrib import admin
from django.db import models
from django.forms.models import modelform_factory
from django.shortcuts import get_object_or_404
from django.template import loader, Context
from django.views.generic import View
def get_printab... | SohoTechLabs/django-ajax-changelist | ajax_changelist/admin.py | Python | mit | 4,495 |
"""Provides the constants needed for component."""
ATTR_AUX_HEAT = 'aux_heat'
ATTR_AWAY_MODE = 'away_mode'
ATTR_CURRENT_HUMIDITY = 'current_humidity'
ATTR_CURRENT_TEMPERATURE = 'current_temperature'
ATTR_FAN_LIST = 'fan_list'
ATTR_FAN_MODE = 'fan_mode'
ATTR_HOLD_MODE = 'hold_mode'
ATTR_HUMIDITY = 'humidity'
ATTR_MAX_H... | MartinHjelmare/home-assistant | homeassistant/components/climate/const.py | Python | apache-2.0 | 1,686 |
from django.contrib import admin
from musicvoting.models import Artist, Album, User, Track
# Register your models here.
admin.site.register(Artist)
admin.site.register(Album)
admin.site.register(User)
admin.site.register(Track)
| WIStudent/musicvotingsite | musicvoting/admin.py | Python | gpl-3.0 | 228 |
from __future__ import absolute_import
import time
from mock import patch, create_autospec
from tornado.ioloop import IOLoop
from tornado.concurrent import Future
import nsq
from nsq import event
_conn_port = 4150
def get_reader(max_in_flight=5):
return nsq.Reader("test", "test",
message... | bitly/pynsq | tests/reader_unit_test_helpers.py | Python | mit | 1,538 |
# -*- coding: utf-8 -*-
import h5py
import os
from collections import namedtuple
PathValue = namedtuple('PathValue', ['path', 'value'])
class HiisiHDF(h5py.File):
"""hdf5 file handle written on top of h5py.File.
Module offers easy to use search, and write methods for handling
HDF5 files.
"""
CACH... | karjaljo/hiisi | hiisi/hiisihdf.py | Python | mit | 8,001 |
from pyGBot.Plugins.games.fluxxfiles.fluxx import FluxxCard
from pyGBot.Plugins.games.fluxxfiles.goals import GoalCard
from pyGBot.Plugins.games.fluxxfiles.game import pretty_print_list
class RuleCard(FluxxCard):
information = """
This rule goes into effect as soon as you play it.
Place this card face up in the c... | pyGBot/pyGBot | pyGBot/Plugins/games/fluxxfiles/rules.py | Python | gpl-3.0 | 8,471 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
from frappe.utils import nowdate
from erpnext.stock.doctype.item.test_item import create_item
from erpnext.stock.doctype.delivery_note.test_deliv... | ESS-LLP/erpnext | erpnext/stock/doctype/quality_inspection/test_quality_inspection.py | Python | gpl-3.0 | 5,291 |
import pytest
import importlib
from spectralDNS import config, get_solver, solve
from TG2D import initialize, regression_test
@pytest.fixture(params=('1', '2'))
def args(request):
"""Check for uniform and non-uniform cube"""
if request.param[-1] == '1':
_args = ['--M', '5', '5', '--L', '2*pi', '2*pi']
... | spectralDNS/spectralDNS | tests/test_NS2D.py | Python | lgpl-3.0 | 1,361 |
# Copyright 2016 Milos Svana
#
# 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 w... | msvana/warcreader | warcreader/__init__.py | Python | apache-2.0 | 657 |
from sqlalchemy.ext.hybrid import hybrid_method, hybrid_property
from ext import db
from config import avatar_tmpl
from .mixin import BaseMixin
friendship = db.Table(
'friends',
db.Column('user_id', db.String(20), db.ForeignKey('users.id')),
db.Column('friend_id', db.String(20), db.ForeignKey('users.id')... | dongweiming/wechat-admin | models/core.py | Python | gpl-3.0 | 4,344 |
import json
from django import forms
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
class JSONEditorWidget(forms.Widget):
template_name = 'django_admin_json_editor/editor.html'
def __init__(self, schema, collapsed=True, sceditor=False, editor_options=None):... | abogushov/django-admin-json-editor | django_admin_json_editor/admin.py | Python | mit | 2,131 |
# -*- coding: utf-8 -*-
# __author__ = chenchiyuan
from __future__ import division, unicode_literals, print_function
from django.contrib.admin.widgets import ForeignKeyRawIdWidget
from django.forms import ClearableFileInput
from django.utils.safestring import mark_safe
from django.conf import settings
from hawaii.apps... | chenchiyuan/hawaii | hawaii/apps/weixin/widgets.py | Python | bsd-3-clause | 1,224 |
# -*- coding: utf-8 -*-
"""pybooru.pybooru
This module contains pybooru main class for access to API calls,
authentication and return JSON response.
Classes:
_Pybooru -- Main pybooru classs, define Pybooru object and do requests.
"""
# __furute__ imports
from __future__ import absolute_import
# External imports... | LuqueDaniel/pybooru | pybooru/pybooru.py | Python | mit | 6,195 |
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
from PyQt5.Qt import Qt
from calibre.gui2.convert.look_and_feel_ui import Ui_Form
f... | elssar/calibre | src/calibre/gui2/convert/look_and_feel.py | Python | gpl-3.0 | 5,251 |
import certifi
import hashlib
import json
import time
import os.path
import queue
import ssl
import threading
import urllib.error
import urllib.parse
import urllib.request
import zlib
class HashHandler:
hash_dict = None
hash_addresses = None
downloads_failed_list = []
downloads_total_counter = 0
... | Naozumi/updater | updater/hash.py | Python | mit | 13,294 |
# -*- coding: utf-8 -*-
import os
import pytest
from scripts import compile_data
TESTS_DIR = os.path.abspath(os.path.join(__file__, '..'))
MOCK_DATA_DIR = os.path.join(TESTS_DIR, 'mock_data')
PID_FAIL = '401'
PID_SUCCESS = '1'
PID_SUCCESS_2 = '2'
def _csv_path(stage, pid):
return os.path.join(MOCK_DATA_DIR, s... | shamrt/jsSART | scripts/tests/test_compile_data.py | Python | mit | 18,242 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
This module provides classes to identify optimal substrates for film growth
"""
from dataclasses import dataclass
from typing import Tuple
from pymatgen.analysis.elasticity.strain import Deformation, Stra... | gmatteo/pymatgen | pymatgen/analysis/interfaces/substrate_analyzer.py | Python | mit | 7,398 |
"""Tests for the CVEcheckerTask worker task."""
from datadiff.tools import assert_equal
from flexmock import flexmock
from pathlib import Path
import pytest
from f8a_worker.object_cache import EPVCache
from f8a_worker.workers import CVEcheckerTask
@pytest.mark.usefixtures("dispatcher_setup")
class TestCVEchecker(ob... | miteshvp/fabric8-analytics-worker | tests/workers/test_cvecheck.py | Python | gpl-3.0 | 8,157 |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'secret-key'
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
SQLALCHEMY_TRACK_MODIFICATIONS = True
MAIL_SERVER = 'smtp.googlemail.com'
MAIL_PORT = 587
MAIL_USE_TLS = True
MAIL_USE... | hszjj221/myflasky | config.py | Python | gpl-3.0 | 1,307 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-07-20 16:56
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('scoping', '0120_auto_20170720_1653'),
]
operations = [
migrations.RemoveField(
... | mcallaghan/tmv | BasicBrowser/scoping/migrations/0121_auto_20170720_1656.py | Python | gpl-3.0 | 482 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'(?P<question_id>[0-9]+)/$', views.detail, name='detail'),
url(r'^(?P<question_id>[0-9]+)/results/$', views.results, name='results'),
url(r'^(?P<question_id>[0-9]+)/vote/$', views.vote, nam... | EMCain/ovc-polls | mysite/polls/urls.py | Python | mit | 404 |
# This file is part of Scapy
# Scapy 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
# any later version.
#
# Scapy is distributed in the hope that it will be useful,
# but ... | smainand/scapy | scapy/contrib/mpls.py | Python | gpl-2.0 | 2,257 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2021, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | mrcslws/nupic.research | src/nupic/research/frameworks/pytorch/hooks/hook_manager.py | Python | agpl-3.0 | 5,818 |
import typedef_class
a = typedef_class.RealA()
a.a = 3
b = typedef_class.B()
b.testA(a)
| DGA-MI-SSI/YaCo | deps/swig-3.0.7/Examples/test-suite/python/typedef_class_runme.py | Python | gpl-3.0 | 90 |
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import numpy as np
import pandas as pd
import tensorflow as tf
from scipy.stats import pearsonr
from load_mnist import load_mnist
import influence.experiments as ... | kohpangwei/influence-release | scripts/run_hinge_experiment.py | Python | mit | 4,640 |
assists = crosses = 3
chancesCreated = goals = 4
shotsOnTarget = 5
successfulDribbles = 10
points = 89
# points = goals * 9 + assists * 6 + chancesCreated * 3 + \
# shotsOnTarget * 2 + crosses + successfulDribbles
| the-zebulan/CodeWars | katas/beta/grasshopper_fantasy_points.py | Python | mit | 223 |
import pingo
rpi = pingo.rpi.RaspberryPi()
fmt = '{:>22s} {:2d} {:<2d} {}'
for loc1, pin1 in sorted(rpi.pins.items())[::2]:
loc2 = loc1 + 1
pin2 = rpi.pins[loc2]
print fmt.format(pin1, loc1, loc2, pin2)
| garoa/pingo | pingo/examples/rpi_examples/pin_map.py | Python | mit | 217 |
import os
import csv
import simplejson as json
from tempfile import mkstemp
from zipfile import ZipFile
import datetime
import hashlib
DLI_MANIFEST_FILENAME = 'upload_info.json'
CSV_DATA_FILENAME = 'data.csv'
DEFAULT_ARCHIVE_NAME = 'upload.zip'
def write_tmp_file(content):
'''Write any data to a temp... | comoga/gooddata-python | gooddataclient/archiver.py | Python | bsd-3-clause | 3,802 |
# -*- coding: utf-8 -*-
import attr
from navmazing import NavigateToAttribute, NavigateToSibling
from widgetastic.widget import Text, TextInput, Widget
from widgetastic_patternfly import Button, Input
from cfme.modeling.base import BaseCollection, BaseEntity
from cfme.utils import deferred_verpick
from cfme.utils impo... | lkhomenk/integration_tests | cfme/control/explorer/conditions.py | Python | gpl-2.0 | 11,889 |
from __future__ import unicode_literals
import datetime
import decimal
from collections import defaultdict
from django.contrib.auth import get_permission_codename
from django.core.exceptions import FieldDoesNotExist
from django.core.urlresolvers import NoReverseMatch, reverse
from django.db import models
fr... | diego-d5000/MisValesMd | env/lib/python2.7/site-packages/django/contrib/admin/utils.py | Python | mit | 17,422 |
import toolbox
import numpy as np
import pylab
#extract shot record
data, params = toolbox.initialise("prepro.su")
mask = data['fldr'] == 221
shot = data[mask].copy()
#agc
toolbox.agc(shot, None, **params)
params['primary'] = 'fldr'
params['secondary'] = 'tracf'
params['wiggle'] = True
toolbox.display(shot, **params)... | stuliveshere/SeismicProcessing2015 | prac2_staff/05.0_fk.py | Python | mit | 1,260 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import optparse
import mechanize
import urllib
import re
import urlparse
from _winreg import *
def val2addr(val):
addr = ''
for ch in val:
addr += '%02x ' % ord(ch)
addr = addr.strip(' ').replace(' ', ':')[0:17]
return addr
def wiglePrint(... | psb-seclab/CTFStuff | utils/violent_python_code/CH3/1-discoverNetworks.py | Python | mit | 2,387 |
from jmclient import old_mnemonic
import pytest
@pytest.mark.parametrize(
"seedphrase, key, valid",
[
(["spiral", "squeeze", "strain", "sunset", "suspend", "sympathy",
"thigh", "throne", "total", "unseen", "weapon", "weary"],
'0028644c0028644f0028645200286455',
True),... | AdamISZ/joinmarket-clientserver | jmclient/test/test_mnemonic.py | Python | gpl-3.0 | 2,169 |
from __future__ import absolute_import
from django.utils.translation import ugettext_lazy as _
from .permissions import PERMISSION_VIEW_JOB_LIST
job_list = {'text': _(u'interval job list'), 'view': 'job_list', 'icon': 'time.png', 'permissions': [PERMISSION_VIEW_JOB_LIST]}
| appsembler/mayan_appsembler | apps/scheduler/links.py | Python | gpl-3.0 | 276 |
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 12 11:19:05 2016
@author: birksworks
"""
from sklearn.base import BaseEstimator, ClassifierMixin
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer
from sklearn.pipeline import Pipeline
from sklearn.linear_model import LogisticRegression
class... | bobflagg/sentiment-analysis | fsa/model/mlr.py | Python | gpl-3.0 | 4,477 |
#!/usr/bin/env python2
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
import sys, os, re
from functools import partial
from PyQt5.Qt import (
... | drxaero/calibre | src/calibre/gui2/tweak_book/diff/main.py | Python | gpl-3.0 | 18,741 |
# vim: expandtab ts=4 sw=4 sts=4 fileencoding=utf-8:
#
# Copyright (C) 2007-2010 GNS3 Development Team (http://www.gns3.net/team).
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation;
#
#... | dlintott/gns3 | src/GNS3/Node/Hub.py | Python | gpl-2.0 | 7,744 |
# -*- coding:utf-8 -*-
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
vm = test_lib.lib_get_specific_stub('e2e_mini/vm', 'vm')
vm_ops = None
vm_name = 'vm-' + vm.get_time_postfix()
vm_image_name = 'vm_image-' + vm.get_time_postfix()
def test():
global vm_ops
vm_o... | zstackio/zstack-woodpecker | integrationtest/vm/e2e_mini/vm/test_create_vm_image.py | Python | apache-2.0 | 865 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the time synchronization state checks."""
from grr.lib import flags
from grr.lib import test_lib
from grr.lib.checks import checks_test_lib
from grr.parsers import config_file
class TimeSyncTests(checks_test_lib.HostCheckTest):
checks_loaded = False
de... | pidydx/grr | grr/checks/time_test.py | Python | apache-2.0 | 5,144 |
# coding=utf-8
from __future__ import unicode_literals
import hashlib
import random
import string
import uuid
from faker.providers.date_time import Provider as DatetimeProvider
from .. import BaseProvider
class Provider(BaseProvider):
language_codes = ('cn', 'de', 'el', 'en', 'es', 'fr', 'it', 'pt', 'ru')
... | venmo/faker | faker/providers/misc/__init__.py | Python | mit | 2,967 |
# -*- coding: utf-8 -*-
# Copyright (C) 2011, 2012 Sebastian Wiesner <lunaryorn@gmail.com>
# This library 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 2.1 of the License, or (at your
... | pyudev/pyudev | src/pyudev/device/_device.py | Python | lgpl-2.1 | 44,657 |
import openliveq as olq
import os
class TestClickthrough(object):
def test_load(self):
filepath = os.path.join(os.path.dirname(__file__),
"fixtures", "sample_clickthrough.tsv")
cs = []
with open(filepath) as f:
for line in f:
c = olq.Clickthrough.rea... | mpkato/openliveq | tests/test_clickthrough.py | Python | mit | 1,259 |
"""
This test file is meant for developing purposes, providing an easy method to
test the functioning of Pastas recharge module during development.
Author: R.A. Collenteur, University of Graz.
"""
import pandas as pd
import pastas as ps
# read observations
head = pd.read_csv("notebooks/data_notebook_5/head_wellex.c... | pastas/pasta | examples/example_well.py | Python | mit | 1,118 |
# Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org)
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and... | klim-iv/phantomjs-qt5 | src/webkit/Tools/Scripts/webkitpy/style/checkers/python_unittest.py | Python | bsd-3-clause | 3,202 |
import os
try:
import urlparse
except ImportError:
import urllib.parse as urlparse
import dj_database_url
from werkzeug.contrib.cache import RedisCache, NullCache
here = os.path.abspath(os.path.dirname(__file__))
urlparse.uses_netloc.append('redis')
redis_conf = dj_database_url.config('REDIS_URL')
class B... | renstrom/imdb-api | imdb/config.py | Python | mit | 1,139 |
#!/usr/bin/env python
import sys, os, math
import matplotlib.pyplot as plt
#-Configuration ----------------------------------------------------------------
sizes = [ 2**n for n in range(6, 13) ]
modes = ['Naive', 'SMB', 'CRB', 'CRB-T', 'CRB-TR']
#-Script Body ----------------------------------------------------------... | Cryst4L/Blaze | run.py | Python | mit | 3,195 |
# coding: utf-8
'''
MAGE Query Language
'''
from pyparsing import Forward, Group, Suppress, Optional, ZeroOrMore, Combine, \
Word, alphas, nums, QuotedString, CaselessLiteral, FollowedBy
from ref.models.instances import ComponentInstance, ComponentInstanceField, ComponentInstanceRelation
from django.db.models.que... | marcanpilami/MAGE | ref/mql.py | Python | apache-2.0 | 10,438 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
BPMN diagram for FOMDES process 1
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from bpmn_pgv import *
import pygraphviz as pgv
__author__ = 'mapologo'
PROCE... | sani-coop/tinjaca | doc/informe1/_graphviz/fomdes_proc22.py | Python | gpl-2.0 | 2,940 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.