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 |
|---|---|---|---|---|---|
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributi... | nicememory/pie | pyglet/pyglet/media/drivers/pulse/__init__.py | Python | apache-2.0 | 1,997 |
from functools import wraps
from django.utils.decorators import decorator_from_middleware_with_args, available_attrs
from django.utils.cache import patch_cache_control, add_never_cache_headers
from django.middleware.cache import CacheMiddleware
def cache_page(*args, **kwargs):
"""
Decorator for views that tri... | 912/M-new | virtualenvironment/experimental/lib/python2.7/site-packages/django/views/decorators/cache.py | Python | gpl-2.0 | 2,280 |
# jsonclient.py
# A simple JSONRPC client library, created to work with Go servers
# Written by Stephen Day
# Modified by Bruce Eckel to work with both Python 2 & 3
import json, socket, itertools, time
from datetime import datetime
class JSONClient(object):
def __init__(self, addr, codec=json):
self._sock... | cgrates/cgrates | data/tester/cgr-tester.py | Python | gpl-3.0 | 2,102 |
from apps.donations.models import MonthlyBatch
from django.utils.timezone import now, timedelta
class MonthlyBatchService(object):
def __init__(self, date=None):
batches = MonthlyBatch.objects.order_by('-date')
if batches.count():
last_batch = batches.all()[0]
else:
... | jfterpstra/bluebottle | bluebottle/recurring_donations/service.py | Python | bsd-3-clause | 759 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Mapper for fusing spatial distance matrix to connectivity-based feature matrix.
Author: kongxiangzheng@gmail.com
Date: 07/23/2012
Editors: [plz add own name after edit here]
"... | BNUCNL/FreeROI | froi/algorithm/unused/fuseconstrainmapper.py | Python | bsd-3-clause | 2,646 |
import pytest
from numpy.testing import assert_array_equal
from landlab import RasterModelGrid
from landlab.io.netcdf import from_netcdf, to_netcdf
@pytest.mark.parametrize("include", ((), [], set(), None))
def test_include_keyword_is_empty(tmpdir, format, include):
grid = RasterModelGrid((4, 3), xy_spacing=(2, ... | cmshobe/landlab | tests/io/netcdf/test_from_netcdf.py | Python | mit | 2,314 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from PyQt4 import QtGui
from PyQt4 import QtCore
from logindialog import login
from exitdialog import exit
from msgdialog import MessageDialog
from msgdialog import msg
from ipaddressdialog import ipaddressinput
from urlinputdialog import urlinput
from numinputdialog import num... | jacklee0810/QMarkdowner | utildialog/__init__.py | Python | mit | 656 |
"""
Support to interface with Sonos players (via SoCo).
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.sonos/
"""
import datetime
import logging
from os import path
import socket
import urllib
import voluptuous as vol
from homeassistant.com... | betrisey/home-assistant | homeassistant/components/media_player/sonos.py | Python | mit | 20,355 |
"""initial migration
Revision ID: 3277cb11e991
Revises: None
Create Date: 2015-05-10 08:39:17.826382
"""
# revision identifiers, used by Alembic.
revision = '3277cb11e991'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust!... | Pritesh242/python | neo1218/0023/web/migrations/versions/3277cb11e991_initial_migration.py | Python | mit | 1,626 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'textthem.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
)
| dkua/textthem | textthem/urls.py | Python | mit | 299 |
from django.apps import AppConfig
class LocalidadesConfig(AppConfig):
name = 'localidades'
| rafaelferrero/sigcaw | localidades/apps.py | Python | gpl-3.0 | 97 |
#!/usr/bin/python
def app(environ, start_response):
request = environ['QUERY_STRING']
start_response("200 OK", [
("Content-Type", "text/plain"),
])
return [request.replace('&','\n') ]
| smartybit/stepic_webtech1 | web/hello.py | Python | mit | 221 |
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Copyright (c) 2014 Mozilla Corporation
# Snapshot configured backups
# Meant to be run once/day... | Phrozyn/MozDef | cron/backupSnapshot.py | Python | mpl-2.0 | 6,390 |
__author__ = 'renhao.cui'
import utilities
import operator
def normalization(inputList):
outputList = []
total = sum(inputList)
for score in inputList:
outputList.append(score/total)
return outputList
def mappingTrainer(labelSet1, labelSet2, limit):
set2 = []
for sets in labelSet2:
... | renhaocui/ensembleTopic | combinedMapping.py | Python | mit | 3,997 |
from functools import cmp_to_key
class Solution:
def largestNumber(self, nums: List[int]) -> str:
def cmp(s1, s2):
if s1 + s2 > s2 + s1:
return -1
elif s1 + s2 < s2 + s1:
return 1
else:
return 0
result =... | jiadaizhao/LeetCode | 0101-0200/0179-Largest Number/0179-Largest Number.py | Python | mit | 727 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-08 18:31
from __future__ import unicode_literals
import django.contrib.postgres.fields
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
init... | Applied-GeoSolutions/geokit | geokit_tables/migrations/0001_initial.py | Python | gpl-2.0 | 1,514 |
# encoding: utf-8
def word_calc(string):
numbers = {
'один': '1', 'два': '2', 'три': '3',
'четыре': '4', 'пять': '5', 'шесть': '6',
'семь': '7', 'восемь': '8', 'девять': '9',
'ноль': '0', 'плюс': '+', 'минус': '-',
'умножить': '*', 'разделить': '/', 'и': '.',
}
result = ''
string ... | mightydok/moscowpy3 | homework1/word_calc.py | Python | gpl-3.0 | 840 |
import os
import uuid
import weakref
import collections
import functools
import numba
from numba.core import types, errors, utils, config
# Exported symbols
from numba.core.typing.typeof import typeof_impl # noqa: F401
from numba.core.typing.asnumbatype import as_numba_type # noqa: F401
from numba.core.typing.templ... | cpcloud/numba | numba/core/extending.py | Python | bsd-2-clause | 19,331 |
# -*- coding: utf-8 -*-
from .slowmatrix import SlowMatrix
from ..matrix import AbstractMatrix
import timeit
import numpy
class FastMatrix(SlowMatrix):
"""
Matrika z množenjem s Strassenovim algoritmom.
"""
def multiply(self, left, right):
"""
V trenutno matriko zapiše produkt podanih m... | markun9/PSA1 | naloge/2016/dn1/matrix/JureMarkun/fastmatrix.py | Python | mit | 5,195 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn.functional as F
from fairseq import utils
from fairseq.modules import (
TransformerSentenceEncoderLayer
)
fr... | hfp/libxsmm | samples/deeplearning/sparse_training/fairseq/fairseq/model_parallel/modules/transformer_sentence_encoder_layer.py | Python | bsd-3-clause | 2,446 |
"""
Tests for DatetimeArray
"""
import operator
import numpy as np
import pytest
from pandas.core.dtypes.dtypes import DatetimeTZDtype
import pandas as pd
from pandas.core.arrays import DatetimeArray
from pandas.core.arrays.datetimes import sequence_to_dt64ns
import pandas.util.testing as tm
class TestDatetimeArra... | toobaz/pandas | pandas/tests/arrays/test_datetimes.py | Python | bsd-3-clause | 10,859 |
# coding = utf-8
import urllib
import urllib.parse
import urllib.request
import threading
import queue
threads = 5
target_url = "http://testphp.vulnweb.com"
wordlist_file = "./tmp/all.txt"
resume = None
user_agent = "Mozilla/5.0 (X11; Linux x86_64; rv:19.0) Gecko/20100101 Firefox/19.0"
word_queue = None
def build_wo... | xieyajie/BackHatPython | backhatpython05/content_bruter.py | Python | apache-2.0 | 2,398 |
"""
Tests for `kolibri.utils.options` module.
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import logging
import os
import tempfile
import mock
import pytest
from kolibri.utils import conf
from kolibri.utils import options
logger = logging.... | DXCanas/kolibri | kolibri/utils/tests/test_options.py | Python | mit | 7,282 |
import collections
import datetime
import json
from django.urls import reverse
from django.utils import timezone
from wagtail.api.v2.tests.test_pages import TestPageDetail, TestPageListing
from wagtail.core.models import Locale, Page
from wagtail.tests.demosite import models
from wagtail.tests.testapp.models import S... | FlipperPA/wagtail | wagtail/admin/tests/api/test_pages.py | Python | bsd-3-clause | 33,496 |
from sysobjects.production.process_control import controlProcess
from sysdata.production.process_control_data import controlProcessData
from syscore.objects import arg_not_supplied, missing_data
from sysdata.mongodb.mongo_generic import mongoDataWithSingleKey
from syslogdiag.log_to_screen import logtoscreen
PROCESS_C... | robcarver17/pysystemtrade | sysdata/mongodb/mongo_process_control.py | Python | gpl-3.0 | 1,876 |
# this function will print a welcome message to the user
def welcome_message():
print("Hello! I'm going to ask you 10 maths questions.")
print("Let's see how many you can get right!")
# this function will ask a maths question and return the points awarded (1 or 0)
def ask_question(first_number, second_number)... | martinpeck/broken-python | mathsquiz/mathsquiz-step2.py | Python | mit | 1,660 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import hr_timesheet_current
| vileopratama/vitech | src/addons/hr_timesheet_sheet/wizard/__init__.py | Python | mit | 128 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 6 10:25:22 2019
@author: ringhausen
"""
import volmdlr as vm
import volmdlr.primitives3d as p3d
import volmdlr.primitives2d as p2d
import math
#%%
p1=vm.Point2D((0, 0))
p2=vm.Point2D((0, 2))
p3=vm.Point2D((2, 4))
p4=vm.Point2D((4, 4))
p5=vm.Poin... | masfaraud/volmdlr | scripts/babylon_extrusion.py | Python | gpl-3.0 | 1,666 |
"""
Author: Shameer Sathar
"""
from ARFFcsvReader import ARFFcsvReader
import numpy as np
"""
Script to test the ARFF predictions output file.
"""
test = ARFFcsvReader('data/results_data.arff')
prediction = np.asarray(test.get_prediction())
"""
Positive change from 0 -> 1 is identified by taking a diff and check... | ssat335/GuiPlotting | TestARFFcsvReader.py | Python | mit | 677 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sys
import shutil
sys.path.append('..')
from functions import *
from config import *
from database import *
shutil.copyfile("gertrude.db", "../aiga.db")
database.init("../aiga.db")
def get_lines_splitted(filename):
result... | studio1247/gertrude | tools/aigaimport.py | Python | gpl-3.0 | 8,430 |
"""
Fix the Sigmoid class so that it computes the sigmoid function
on the forward pass!
Scroll down to get started.
"""
import numpy as np
class Node(object):
def __init__(self, inbound_nodes=[]):
self.inbound_nodes = inbound_nodes
self.value = None
self.outbound_nodes = []
for no... | nehal96/Deep-Learning-ND-Exercises | MiniFlow/4 - Sigmoid Function/miniflow.py | Python | mit | 3,429 |
from django.conf.urls import url
from data_ingestion import views
urlpatterns = [
# ex: /data-ingestion-page/
url(r'^$', views.index, name='indexData'),
# ex: /data-ingestion-page/5/
url(r'^(?P<collection_id>[0-9]+)/$', views.detail, name='detail'),
# ex: /data-ingestion-page/5/edit
url(r'^(?P<... | SISTEMAsw/TAMP | gui/data_ingestion/urls.py | Python | mit | 468 |
import time
from struct import pack
from typing import Optional
from electrum_grs import ecc
from electrum_grs.i18n import _
from electrum_grs.util import UserCancelled
from electrum_grs.keystore import bip39_normalize_passphrase
from electrum_grs.bip32 import BIP32Node, convert_bip32_path_to_list_of_uint32
from elect... | GroestlCoin/electrum-grs | electrum_grs/plugins/safe_t/clientbase.py | Python | gpl-3.0 | 10,155 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
GrassAlgorithm.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
************************... | nextgis/NextGIS_QGIS_open | python/plugins/processing/algs/grass/GrassAlgorithm.py | Python | gpl-2.0 | 22,837 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-27 15:08
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependen... | JakeWimberley/Weathredds | tracker/migrations/0004_auto_20160627_1108.py | Python | gpl-3.0 | 1,456 |
def Setup(Settings,DefaultModel):
# set8backinexpansionism/expand_lr_minlen30_kfold.py
Settings["experiment_name"] = "expand_lr_minlen30_kfold"
Settings["graph_histories"] = ['together']
n=0
from keras.preprocessing.image import ImageDataGenerator
from DatasetHandler.custom_image import Ima... | previtus/MGR-Project-Code | Settings/set7_dataset-aggressive-expansion/expand_lr_minlen30_kfold.py | Python | mit | 2,610 |
"""
The Wub Machine
Python web interface
started August 5 2011 by Peter Sobot (petersobot.com)
"""
__author__ = "Peter Sobot"
__copyright__ = "Copyright (C) 2011 Peter Sobot"
__version__ = "2.2"
import json, time, locale, traceback, gc, logging, os, database, urllib
import tornado.ioloop, tornado.web, tor... | psobot/wub-machine | server.py | Python | mit | 24,698 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:mod:`run_plotly`
==================
.. module:: run_plotly
:platform: Unix, Windows
:synopsis:
.. moduleauthor:: hbldh <henrik.blidh@nedomkull.com>
Created on 2015-08-17
"""
from __future__ import division
from __future__ import print_function
from __future_... | hbldh/wlmetrics | wlmetrics/plot/run_plotly.py | Python | mit | 2,096 |
'''
K.I.S.T.I.E (Keep, It, Simple, Take, It, Easy)
Created on 1 Jan 2013
@author: Leonardo Bruni, leo.b2003@gmail.com
Kistie Core Module Library
This Kistie implementation i's part of project 'Kistie_Autorig' by Leonardo Bruni, leo.b2003@gmail.com
''' | Leopardob/Kistie | kcode/kcore/__init__.py | Python | bsd-3-clause | 251 |
from django.contrib.auth.models import User
from fixture_generator import fixture_generator
from fixture_generator.tests.models import Author, Entry
@fixture_generator(Author)
def test_1():
Author.objects.create(name="Tom Clancy")
Author.objects.create(name="Daniel Pinkwater")
@fixture_generator(User)
def t... | alex/django-fixture-generator | fixture_generator/tests/fixture_gen.py | Python | bsd-3-clause | 455 |
from __future__ import absolute_import, division, print_function
import re
from ...external.qt.QtGui import QDialog, QMessageBox
from ...external.qt import QtCore
from ... import core
from ...core import parse
from ...utils.qt import CompletionTextEdit
from ..qtutil import load_ui
def disambiguate(label, labels)... | JudoWill/glue | glue/qt/widgets/custom_component_widget.py | Python | bsd-3-clause | 8,477 |
# -*- coding: utf-8 -*-
import os
from datetime import datetime
from pytz import timezone
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "schedule_twitter.settings")
import django
from django.conf import settings
from apscheduler.schedulers.background import BlockingScheduler
from tweet.models import Tweet
django... | aoqfonseca/scheduler_tweet | clock.py | Python | mit | 811 |
# Preprocessing: From JPEG to HKL
import os
import glob
import sys
import yaml
import scipy.misc
import numpy as np
import hickle as hkl
def get_img(img_name, img_size=256, batch_size=256):
target_shape = (img_size, img_size, 3)
img = scipy.misc.imread(img_name) # x*x*3
assert img.dtype == 'uint8', i... | momiah/cvariants_theano | preprocessing/make_hkl.py | Python | bsd-3-clause | 9,500 |
from __future__ import annotations
import datetime
from functools import partial
from textwrap import dedent
from typing import TYPE_CHECKING
import warnings
import numpy as np
from pandas._libs.tslibs import Timedelta
import pandas._libs.window.aggregations as window_aggregations
from pandas._typing import (
Ax... | jorisvandenbossche/pandas | pandas/core/window/ewm.py | Python | bsd-3-clause | 33,522 |
import math
import sys
# read FILE with CVs and weights
FILENAME_ = sys.argv[1]
# number of CVs for FES
NCV_ = int(sys.argv[2])
# read minimum, maximum and number of bins for FES grid
gmin = []; gmax = []; nbin = []
for i in range(0, NCV_):
i0 = 3*i + 3
gmin.append(float(sys.argv[i0]))
gmax.append(float(s... | JFDama/plumed2 | user-doc/tutorials/trieste-4/do_block_fes.py | Python | lgpl-3.0 | 3,916 |
from src.li.visual.ViewStyle import ViewStyle
from src.li.types.VideoVisual import VideoVisual
from src.li.types.AddToCollectionVisual import AddToCollectionVisual
from src.li.types.YoutubePlaylistVisual import YoutubePlaylistVisual
from src.li.visual.FullTextSettings import FullTextSettings, Location
from src.li.visua... | SportySpice/Collections | src/paths/visual/browse_youtube_playlist.py | Python | gpl-2.0 | 1,896 |
"""
Average mean sea level pressure by day, unrotate lat/lon and save
"""
import os, sys
import itertools
import numpy as np
import cPickle as pickle
#import matplotlib.animation as animation
import iris
import iris.coords as coords
import iris.coord_categorisation
from iris.analysis.interpolate import linear
imp... | peterwilletts24/Monsoon-Python-Scripts | pp_load_mean_pickle.py | Python | mit | 1,683 |
# -*- coding: utf-8 -*-
"""
gdown.modules.fileshark
~~~~~~~~~~~~~~~~~~~
This module contains handlers for fileshark.
"""
import re
# from datetime import datetime
from dateutil import parser
from requests.exceptions import ConnectionError
from ..module import browser, acc_info_template
from ..exceptions import Mod... | oczkers/gdown | gdown/modules/fileshark.py | Python | gpl-3.0 | 2,312 |
#!/usr/bin/env python2
"""Split a fasta file in n files of approximately the same number of sequences
WARNING: This will create 'n' files in your present directory
USAGE:
python fasta_split.py input_file num_files
input_file: fasta file
num_files: number of files to split into
"""
# Importing modules
import gzi... | enormandeau/Scripts | fasta_split.py | Python | gpl-3.0 | 1,930 |
#!/usr/bin/env pythonw
# -*- coding: UTF-8 -*-
#
# Drag&Drop test 1
#
# Created by Giovanni Porcari on 2007-03-24.
# Copyright (c) 2007 Softwell. All rights reserved.
#
""" Drag&Drop test 1 """
from gnr.core.gnrbag import Bag
class GnrCustomWebPage(object):
def main(self, root, **kwargs):
#root.script... | poppogbr/genropy | packages/showcase/webpages/utilities/dnd/test1.py | Python | lgpl-2.1 | 1,461 |
"""
Copyright (c) 2017 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import unicode_literals, division
from collections import namedtuple
from copy import deepcopy
from multiprocessing.pool impo... | vrutkovs/atomic-reactor | atomic_reactor/plugins/build_orchestrate_build.py | Python | bsd-3-clause | 22,139 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('legislators', '0007_auto_20150311_1607'),
('core', '0005_convenetime_active'),
]
operations = [
migrations.CreateMod... | texastribune/txlege84 | txlege84/core/migrations/0006_stream.py | Python | mit | 1,329 |
import os, sys
'''
BASE_RESOURCE_PATH = os.path.join(os.getcwd())
sys.path.append(os.path.join(BASE_RESOURCE_PATH, "pyparsing"))
sys.path.append(os.path.join(BASE_RESOURCE_PATH, "pyscraper"))
from descriptionparserfactory import DescriptionParserFactory
from descriptionparserfactory import *
descFile = "... | skerit/romcollectionbrowser | resources/lib/temptests2.py | Python | gpl-2.0 | 1,763 |
l=[]
ris = ''
n = int(raw_input())
for i in xrange(n):
x = str(raw_input())
x = str(x)
l.append(x)
l = sorted(l, key=int, reverse=True)
print(" ".join(l))
| Nebulino/CodingGame-Solutions | Reverse - Reverse sort number.py | Python | mit | 168 |
import os
import math
from affine import Affine
import numpy as np
from shapely.geometry import shape
import rasterio
import geopandas as gpd
import pytest
from distancerasters.utils import (
get_affine_and_shape,
rasterize,
export_raster,
convert_index_to_coords,
calc_haversine_distance,
)
@pytes... | sgoodm/python-distance-rasters | tests/test_utils.py | Python | bsd-3-clause | 6,579 |
import os
import re
import shutil
import sublime_plugin
from .git.git_command_base import GitCommandBase
from .command_base import AdvancedNewFileBase
from ..anf_util import *
class AdvancedNewFileMove(AdvancedNewFileBase, sublime_plugin.WindowCommand, GitCommandBase):
def __init__(self, window):
super(A... | herove/dotfiles | sublime/Packages/AdvancedNewFile/advanced_new_file/commands/move_file_command.py | Python | mit | 4,725 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import today
from erpnext.accounts.utils import get_fiscal_year
from erpnext.stock.stock_ledger import update_entries... | hassanibi/erpnext | erpnext/patches/v6_24/repost_valuation_rate_for_serialized_items.py | Python | gpl-3.0 | 827 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016, Jianfeng Chen <jchen37@ncsu.edu>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# 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 t... | Ginfung/FSSE | Metrics/gd.py | Python | mit | 1,445 |
# -*- coding: utf-8 -*-
# This file is part of Bika LIMS
#
# Copyright 2011-2017 by it's authors.
# Some rights reserved. See LICENSE.txt, AUTHORS.txt.
import re
import sys
import math
import inspect
import importlib
import transaction
from zope.interface import implements
from AccessControl import ClassSecurityInfo... | rockfruit/bika.lims | bika/lims/content/calculation.py | Python | agpl-3.0 | 15,072 |
import scrapy
import time
from datetime import datetime
from nhsbot.items import NhsbotItem
class NHSChoices(scrapy.Spider):
"""
Creates an NHSChoices Spider class to scrape the
NHS Choices website.
Inherits from basic spider which provides start_requests()
implementation. This sends requests from ... | nichelia/docker-scraper | nhsbot/nhsbot/spiders/nhs_uk.py | Python | mit | 8,352 |
from distutils.core import setup
setup(name='ftrobopy',
description='Python Interface for Fischertechnik ROBOTICS TXT Controller',
version='1.80',
author='Torsten Stuehn',
author_email='Torsten Stuehn',
url='https://github.com/ftrobopy/ftrobopy',
download_url='https://github.com/ftr... | ftrobopy/ftrobopy | setup.py | Python | mit | 416 |
"""
ErrorClass Plugins
------------------
ErrorClass plugins provide an easy way to add support for custom
handling of particular classes of exceptions.
An ErrorClass plugin defines one or more ErrorClasses and how each is
handled and reported on. Each error class is stored in a different
attribute on the result, and... | Nexenta/s3-tests | virtualenv/lib/python2.7/site-packages/nose/plugins/errorclass.py | Python | mit | 7,279 |
"""
library
"""
from __future__ import absolute_import, division, print_function
import logging
import os
from PySide import QtGui, QtCore
from mcedit2.util.directories import getUserSchematicsDirectory
from mcedit2.widgets.layout import Column
log = logging.getLogger(__name__)
class LibraryTreeModel(QtGui.QFileS... | Rubisk/mcedit2 | src/mcedit2/library.py | Python | bsd-3-clause | 1,436 |
{
'name': 'View Editor',
'category': 'Hidden',
'description': """
OpenERP Web to edit views.
==========================
""",
'version': '2.0',
'depends':['web'],
'data' : [
'views/web_view_editor.xml',
],
'qweb': ['static/src/xml/view_editor.xml'],
'auto_install': Tr... | mycodeday/crm-platform | web_view_editor/__openerp__.py | Python | gpl-3.0 | 326 |
import subprocess, threading
from subprocess import PIPE
class TimedSubProc (object):
def __init__(self, cmd):
self.cmd = cmd.split()
self.process = None
def run(self, timeout=5, stdin=None, stdout=PIPE, stderr=PIPE):
self.output = None
def target():
self.pr... | maxspad/MGrader | autograder/modules/questions/timedsubproc.py | Python | bsd-3-clause | 861 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-08 16:49
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('djangocms_blog', '0014_auto_20160215_1331'),
]
operations = [
migrations.Alt... | skirsdeda/djangocms-blog | djangocms_blog/migrations/0015_auto_20160408_1849.py | Python | bsd-3-clause | 507 |
# -*- coding: utf-8 -*-
from allauth.socialaccount.tests import create_oauth_tests
from allauth.tests import MockedResponse
from allauth.socialaccount.providers import registry
from .provider import TumblrProvider
class TumblrTests(create_oauth_tests(registry.by_id(TumblrProvider.id))):
def get_mocked_response(s... | agconti/njode | env/lib/python2.7/site-packages/allauth/socialaccount/providers/tumblr/tests.py | Python | bsd-3-clause | 931 |
# -*- coding: utf-8 -*-
"""
python-aop is part of LemonFramework.
python-aop 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.
python-aop is ... | andresriancho/python-aop | aop/aspecttype.py | Python | gpl-3.0 | 1,966 |
import os
import tempfile
import struct
import re
from subprocess import Popen, PIPE
from nose.plugins.skip import Skip, SkipTest
import ubpf.assembler
import testdata
VM = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "vm", "test")
def check_datafile(filename):
"""
Given assembly source code... | iovisor/ubpf | test_framework/test_vm.py | Python | apache-2.0 | 2,599 |
# 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... | Kongsea/tensorflow | tensorflow/contrib/metrics/python/ops/metric_ops_test.py | Python | apache-2.0 | 258,475 |
# Copyright (c) 2011 OpenStack Foundation
#
# 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 ... | wbhuber/local_swift_branch | test/unit/common/middleware/test_formpost.py | Python | apache-2.0 | 69,565 |
# This was taken from http://python.org/sf/1541697
# It's not technically a crasher. It may not even truly be infinite,
# however, I haven't waited a long time to see the result. It takes
# 100% of CPU while running this and should be fixed.
import re
starttag = re.compile(r'<[a-zA-Z][-_.:a-zA-Z0-9]*\s*('
... | nmercier/linux-cross-gcc | win32/bin/Lib/test/crashers/infinite_loop_re.py | Python | bsd-3-clause | 661 |
from collections import defaultdict
from compare_mt import corpus_utils
def _count_ngram(sent, order):
gram_pos = dict()
for i in range(order):
gram_pos[i+1] = defaultdict(lambda: [])
for i, word in enumerate(sent):
for j in range(min(i+1, order)):
gram_pos[j+1][word].append(i-j)
word = sent[... | neulab/compare-mt | compare_mt/align_utils.py | Python | bsd-3-clause | 2,139 |
SECRET_KEY = 'c&2sr12q0^g^+epf5g#-lm6+3a(trr5+&v_47jwv4!87oj4k+l'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'app_name.db',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
INSTALLED_APPS = (
'django.contrib.a... | hkage/django-face-off | tests/settings.py | Python | mit | 608 |
# Copyright 2012 New Dream Network, LLC (DreamHost)
#
# 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 a... | yanheven/neutron | neutron/tests/unit/agent/metadata/test_agent.py | Python | apache-2.0 | 20,431 |
import time
import threading
import serial
from actuators.interface import SerialActuator
# TODO : plutôt que de d'envoyer et attendre une réponse, faire en sorte que
# l'arduino envoie en continue sont état, le stocker et comme ça juste lire la
# variable stockée quand on veut la valeur
# => C'est ici qu'il faut le... | ingegus/tipe-corbeillator | actuators/motor.py | Python | mit | 3,785 |
# -*- coding: utf-8 -*-
import logging
import datetime
from django.contrib.contenttypes.generic import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
import pytz
import sys
logger = logging.getLogger(__name__)
class QueueManager(models.Manager):
timezone... | unicornfox/django_queue | queue/models.py | Python | mit | 4,418 |
'''
Created on Jun 6, 2014
@author: rtermondt
'''
from django.conf import settings
def global_settings(request):
invitation_system_setting = getattr(settings, 'INVITATION_SYSTEM', None)
if invitation_system_setting == True:
invite_system = True
else:
invite_system = False
ret... | richtermondt/inithub-web | inithub/inithub/context_processors.py | Python | mit | 376 |
import cgi
import os
import logging
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext.webapp import template
from google.appengine.api import urlfetch
import gmemsess
import ckeynsecret
from myspace.config.MySpaceError import MySpace... | dgouldin/myspaceid-python-sdk | samples/google-app-engine/oauth/consumer.py | Python | apache-2.0 | 4,219 |
import re
from thefuck.utils import sudo_support
@sudo_support
def match(command, settings):
return (command.script.startswith('cd ')
and ('no such file or directory' in command.stderr.lower()
or 'cd: can\'t cd to' in command.stderr.lower()))
@sudo_support
def get_new_command(command, settin... | JianfengYao/thefuck | thefuck/rules/cd_mkdir.py | Python | mit | 398 |
from setuptools import setup
setup(
name='dhtapi',
packages=['dhtapi'],
include_package_data=True,
install_requires=[
'flask',
],
) | BenSimonds/DHTSite | api/setup.py | Python | mit | 160 |
#
# 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... | ErnieAllen/qpid-dispatch | tests/system_tests_policy_oversize_basic.py | Python | apache-2.0 | 36,740 |
def gameStart():
pokers = gameIn()
if pokers:
sum = getPokersSum(pokers)
judge(pokers, sum)
# print(pokers)
# print(sum)
def gameIn():
print('what pokers ?')
print('("0" for 10, joker not allowed)')
gameIn = input()
if not gameIn:
print('empty pokers')
... | BlueSky-07/Poker | Python/Poker.py | Python | mit | 3,505 |
"""List diff preferences associated with one's account"""
# pylint: disable=invalid-name
import argparse
import logging
from libpycr.exceptions import PyCRError
from libpycr.gerrit.client import Gerrit
from libpycr.meta import GerritAccountBuiltin
from libpycr.pager import Pager
from libpycr.utils.commandline import... | JcDelay/pycr | libpycr/builtin/accounts/ls-diff-prefs.py | Python | apache-2.0 | 3,136 |
#!/usr/bin/env python
#
# Copyright 2005-2007,2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at you... | SpectreJan/gnuradio | gr-digital/examples/narrowband/receive_path.py | Python | gpl-3.0 | 6,020 |
"""
Adapted from
https://www.tensorflow.org/tutorials/distribute/multi_worker_with_keras
"""
import argparse
import tensorflow as tf
import numpy as np
import ray
from ray import tune
from ray.tune.schedulers import AsyncHyperBandScheduler
from ray.tune.integration.keras import TuneReportCheckpointCallback
from ray.tun... | ray-project/ray | python/ray/tune/examples/tf_distributed_keras_example.py | Python | apache-2.0 | 4,418 |
from tornado import httpserver,ioloop,web,gen,httpclient
from datetime import datetime
from base_handler import BaseHandler
from tools import *
import conf
import tornado_mysql
class RankHandler(BaseHandler):
@web.authenticated
@gen.coroutine
def get(self):
msg = self.get_argument('msg',None)
... | zrt/XOJ | web/rank_handler.py | Python | gpl-3.0 | 1,181 |
import IMP
import IMP.core
import IMP.algebra
import IMP.test
import IMP.pmi.restraints.em
import IMP.pmi.representation
import math
class Tests(IMP.test.TestCase):
def setUp(self):
IMP.test.TestCase.setUp(self)
self.m = IMP.Model()
self.simo1 = IMP.pmi.representation.Representation(
... | shanot/imp | modules/pmi/test/test_GaussianEMRestraint_rigidbody.py | Python | gpl-3.0 | 3,233 |
# Natural Language Toolkit: Confusion Matrices
#
# Copyright (C) 2001-2015 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
from __future__ import print_function, unicode_literals
from nltk.... | MyRookie/SentimentAnalyse | venv/lib/python2.7/site-packages/nltk/metrics/confusionmatrix.py | Python | mit | 7,825 |
__all__ = ["Service"]
from kokki.base import Resource, ResourceArgument, BooleanArgument
class Service(Resource):
service_name = ResourceArgument(default=lambda obj:obj.name)
enabled = ResourceArgument()
running = ResourceArgument()
pattern = ResourceArgument()
start_command = ResourceArgument()
... | samuel/kokki | kokki/resources/service.py | Python | bsd-3-clause | 795 |
from p2pool.bitcoin import networks
PARENT = networks.nets['coin42']
SHARE_PERIOD = 5 # seconds
CHAIN_LENGTH = 12*60*60//5 # shares
REAL_CHAIN_LENGTH = 12*60*60//5 # shares
TARGET_LOOKBEHIND = 20 # shares
SPREAD = 50 # blocks
IDENTIFIER = 'ff42c01442c0c0ff'.decode('hex')
PREFIX = 'ee42c014aa42c014'.decode('hex')
P2P_P... | ptcrypto/p2pool-adaptive | p2pool/networks/coin42.py | Python | gpl-3.0 | 638 |
"""
Utility functions for matrices and designs transformation.
"""
import warnings
import numpy as np
from scipy import linalg
def normalize_matrix_on_axis(m, axis=0):
""" Normalize a 2D matrix on an axis.
Parameters
----------
m : numpy 2D array,
The matrix to normalize.
axis : integer in... | nilearn/nilearn_sandbox | nilearn_sandbox/mass_univariate/utils.py | Python | bsd-3-clause | 9,113 |
from Tkinter import *
class ScrolledList:
default = "(None)"
def __init__(self, master, **options):
# Create top frame, with scrollbar and listbox
self.master = master
self.frame = frame = Frame(master)
self.frame.pack(fill="both", expand=1)
self.vbar = vbar = Scrollba... | svanschalkwyk/datafari | windows/python/Lib/idlelib/ScrolledList.py | Python | apache-2.0 | 4,157 |
# Copyright (C) 2003-2005 Peter J. Verveer
#
# 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 the following d... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/scipy/ndimage/filters.py | Python | mit | 52,520 |
# -*- coding: utf-8 -*-
from django.core.management.base import NoArgsCommand, BaseCommand
from ffclub.newsletter.utils import generate_newsletter
class Command(BaseCommand):
help = 'Generate Newsletter Static Page'
option_list = NoArgsCommand.option_list
def handle(self, *args, **options):
issu... | elin-moco/ffclub | ffclub/newsletter/management/commands/gen_newsletter.py | Python | bsd-3-clause | 366 |
#substitution cipher
#The user will supply an alphabet as a key.
import random
#You will need to write the methods to encode and decode given a key.
#-------------------------------------------------------------------
def encode(message, key):
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
message = message.upper()
... | DerekBabb/CyberSecurity | Classic_Cryptography/code/SubstitutionCipher.py | Python | gpl-3.0 | 2,066 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2014-2022 GEM Foundation
#
# OpenQuake 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 Licen... | gem/oq-engine | openquake/hazardlib/gsim/pankow_pechmann_2004.py | Python | agpl-3.0 | 8,316 |
import itertools
import numbers
from . import util
from .attractiveness_finder import AttractivenessFinder
class Statistics(object):
def __init__(self, user, message_threads=None, filters=(),
attractiveness_finder=None):
self._user = user
self._message_threads = message_threads ... | IvanMalison/okcupyd | okcupyd/statistics.py | Python | mit | 4,061 |
#!/usr/bin/python
#
# Expand the bundled cairo-1.0.gir.in files
# for use in Visual C++ builds of G-I
#
# Author: Fan, Chun-wei
# Date: January 20, 2014
#
# (Adapted from setup.py in
# $(glib_src_root)/build/win32/setup.py written by Shixin Zeng)
import os
import sys
import argparse
import replace
from gi_msvc_build... | anthrotype/gobject-introspection | build/win32/gen-win32-cairo-gir.py | Python | gpl-2.0 | 1,359 |
# -*- coding: utf-8 -*-
# Copyright (c) 2010-2013 by Yaco Sistemas <goinnn@gmail.com>
# 2015 by Pablo Martín <goinnn@gmail.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundatio... | django-inplaceedit/django-inplaceedit | testing/testing/unusual_fields/admin.py | Python | lgpl-3.0 | 1,048 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.