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 |
|---|---|---|---|---|---|
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
class BellMediaIE(InfoExtractor):
_VALID_URL = r'''(?x)https?://(?:www\.)?
(?P<domain>
(?:
ctv|
tsn|
bnn|
thecomedynetwork|
... | mxamin/youtube-dl | youtube_dl/extractor/bellmedia.py | Python | unlicense | 2,574 |
# Work around mbcs bug in distutils.
# http://bugs.python.org/issue10945
import codecs
try:
codecs.lookup('mbcs')
except LookupError:
ascii = codecs.lookup('ascii')
func = lambda name, enc=ascii: {True: enc}.get(name=='mbcs')
codecs.register(func)
from distutils.core import setup, Extension
import glob... | GUBotDev/mavlink | pymavlink/setup.py | Python | lgpl-3.0 | 5,125 |
TYPE_OUTPUT_HTML = "HTML"
TYPE_OUTPUT_PDF = "PDF"
TYPE_OUTPUT_XLS = "XLS"
TYPE_OUTPUT_RTF = "RTF"
TYPE_OUTPUT_CSV = "CSV"
TYPE_OUTPUT_ODS = "ODS"
TYPE_OUTPUT_ODT = "ODT"
TYPE_OUTPUT_DOCX = "DOCX"
TYPE_OUTPUT_XLSX = "XLSX"
TYPE_OUTPUT_JPRINT = "JPRINT"
TYPE_OUTPUT_XML = "XML" | saguas/jasperserverlib | jasperserverlib/core/ReportOutputFormat.py | Python | mit | 277 |
#!/usr/bin/env python
from __future__ import print_function
import argparse
import os
import subprocess
import sys
from test_util import TestFailedError, prepareForIncrParse, run_command, \
serializeIncrParseMarkupFile
def testWithParserLib(test_file, test_case, pre_edit_file, post_edit_file,
... | sschiau/swift | utils/incrparse/incr_transfer_round_trip.py | Python | apache-2.0 | 9,051 |
from common.challenge import MatasanoChallenge
from common.key_exchange.protocols.srp import SecureRemotePassword,\
SecureRemotePasswordClient,\
SecureRemotePasswordServer
class SRPAuthBypassWithZeroKey(SecureRemotePasswordCli... | lukius/mts | set5/challenge37.py | Python | mit | 1,274 |
import os
import gevent.monkey # noqa: I100, gevent must be imported here
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dmoj.settings')
gevent.monkey.patch_all()
# noinspection PyUnresolvedReferences
import dmoj_install_pymysql # noqa: E402, F401, I100, I202, imported for side effect
import django # noqa: E40... | DMOJ/site | dmoj_bridge_async.py | Python | agpl-3.0 | 668 |
'''
module: clusters.py
use: contains functions associated clustering / unsupervised learning
'''
import numpy as np
from kmeans import kplusplus
from utils import getSimilarityArray
def getDegreeArray(sim_array): #convert array W into respective Degree array, Dii = sum(i=1 to n) Wij
'''
Purpose:
Computes the ... | jvahala/lucid-robotics | code/python-modules/clusters.py | Python | apache-2.0 | 3,293 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | SUSE/azure-sdk-for-python | azure-servicefabric/azure/servicefabric/models/paged_compose_application_status_info_list.py | Python | mit | 1,371 |
"""
Advertising means registering a function to the 'functions'
domain. From a user's standpoint in that domain lives a dictionary of
'name' -> *fn-obj* that is used by the front end to provide functions.
"""
from context import Context
from default import DEFAULTS_DOMAIN
from functions import MetaAdvert
from skin imp... | fakedrake/WikipediaBase-skinz | wikipediabase/api.py | Python | bsd-3-clause | 3,257 |
from dolfin import *
from nanopores import *
from nanopores.physics.simplepnps import *
geo_name = "H_geo"
nm = 1e-9
geo_params = dict(
x0 = None,
boxfields = True,
#Rx = 300*nm,
#Ry = 30*nm,
)
phys_params = dict(
Membraneqs = -0.0,
bulkcon = 3e2,
bV = -.1,
dnaqsdamp = .25
)
generate_mesh(.5, geo_name, **geo_params... | mitschabaude/nanopores | scripts/test_SimplePNPS.py | Python | mit | 1,498 |
import time
import json
import random
from flask import Flask, request, current_app, abort
from functools import wraps
from cloudbrain.utils.metadata_info import (map_metric_name_to_num_channels,
get_supported_devices,
get_metrics_... | andyh616/cloudbrain | cloudbrain/apiservice/rest_api_server.py | Python | agpl-3.0 | 6,641 |
from pictureflow.core import Image, Node
import cv2
class Scale(Node):
"""
Scale an image
Args:
parent (Node): Parent image node
scale_factor (Node): Scale factor
id (str): ID of the node
Attributes:
Input Types: [ :py:class:`Image`, :py:class:`int` ]
Ou... | mentum/pictureflow | pictureflow/transform/scale.py | Python | mit | 777 |
# -*- coding: utf-8 -*-
#################################################################################
#
# (DC)² - DataCenter Deployment Control
# Copyright (C) 2010, 2011, 2012, 2013, 2014 Stephan Adig <sh@sourcecode.de>
# This program is free software; you can redistribute it and/or modify
# it under ... | sadig/DC2 | components/dc2-client/dc2/client/api/dc2/addons/freeipa/ipa.py | Python | gpl-2.0 | 1,423 |
import os
from argparse import ArgumentParser
from xml.etree.ElementTree import tostring
from tqdm import tqdm
from ucca import convert
from ucca.ioutil import write_passage, external_write_mode
from ucca_db.api import get_by_xids, get_most_recent_passage_by_uid
desc = "Download passages from old UCCA annotation app... | danielhers/ucca | ucca_db/download.py | Python | gpl-3.0 | 3,038 |
"""
Python Blueprint
================
Does not install python itself, only develop and setup tools.
Contains pip helper for other blueprints to use.
**Fabric environment:**
.. code-block:: yaml
blueprints:
- blues.python
"""
from fabric.decorators import task
from refabric.api import run, info
from refa... | gelbander/blues | blues/python.py | Python | mit | 997 |
def get_thermodynamic_information_minimum(system, database, minimum, commit=True):
m = minimum
changed = False
if m.pgorder is None:
changed = True
m.pgorder = system.get_pgorder(m.coords)
if m.fvib is None:
changed = True
print "computing fvib for minima", m.... | js850/PyGMIN | pygmin/thermodynamics/_utils.py | Python | gpl-3.0 | 1,227 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "Ponzoni, Nelson"
__copyright__ = "Copyright 2015"
__credits__ = ["Ponzoni Nelson"]
__maintainer__ = "Ponzoni Nelson"
__contact__ = "npcuadra@gmail.com"
__email__ = "npcuadra@gmail.com"
__license__ = "GPL"
__version__ = "1.0.0"
_... | lerker/cupydle | cupydle/dnn/capas.py | Python | apache-2.0 | 8,329 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Package init."""
# Semantic Versioning 2.0.0 https://semver.org/spec/v2.0.0.html
__version__ = "0.5.0"
| carlosperate/ubitflashtool | ubittool/__init__.py | Python | mit | 154 |
#
# Copyright (c) SAS Institute Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | sassoftware/mint | mint/django_rest/rbuilder/jobs/manager.py | Python | apache-2.0 | 36,536 |
#!/usr/bin/env python3
# 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.
#
# Download and build the data if it does not exist.
from parlai.core.build_data import DownloadableFile
import parlai.... | facebookresearch/ParlAI | parlai/tasks/dbll_movie/build.py | Python | mit | 756 |
# -*- coding: utf-8 -*-
import unittest
from outwiker.actions.globalsearch import GlobalSearchAction
from test.basetestcases import BaseOutWikerGUIMixin
class GlobalSearchActionTest(unittest.TestCase, BaseOutWikerGUIMixin):
"""
Tests for GlobalSearchAction
"""
def setUp(self):
self.initAppli... | unreal666/outwiker | src/test/actions/test_globalsearch.py | Python | gpl-3.0 | 1,932 |
# This file is part of mididump.
#
# mididump 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.
#
# mididump is distributed in the hope t... | zdobersek/mididump | messages.py | Python | gpl-3.0 | 7,352 |
# Copyright 2021 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_benchmarks/specjbb2015_benchmark.py | Python | apache-2.0 | 11,831 |
# This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | eliasdesousa/indico | indico/web/util.py | Python | gpl-3.0 | 6,933 |
import random
import sys
import pygame
import string
import re
import xml.dom.minidom
from pygame.locals import *
from gamedata import *
from menu import Menu
class CreateCharacter:
"""Creates a new character for Gods & Monsters based on the rules
defined in the Rule Book beginning on page 6.
"""
... | jmuckian/GodsAndMonsters | bin/char.py | Python | gpl-3.0 | 46,928 |
#
# 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... | wooga/airflow | tests/providers/apache/hive/operators/test_s3_to_hive.py | Python | apache-2.0 | 13,017 |
#!/usr/bin/python
def characterPictureGrid(grid):
for dim1 in range(0, len(grid)):
for dim2 in range(0, len(grid[dim1])):
print grid[dim1][dim2],
print "\n"
grid = [['.', '.', '.', '.', '.', '.'],
['.', 'O', 'O', '.', '.', '.'],
['O', 'O', 'O', 'O', '.', '... | ajitabhpandey/learn-programming | python/characterPictureGrid.py | Python | gpl-2.0 | 597 |
class PingResult:
def __init__(self, unique_id=1, destination="", ttl=0, time_stamp=0.0, round_trip_time=0, size=0,
successful=False):
"""
:param unique_id: unique of of this ping result
:type unique_id: int
:param destination: target of pint
:type destinatio... | nowackie/networkMonitor | networkMonitor/PingResult.py | Python | mit | 1,628 |
from subprocess import check_output
from xml.etree import ElementTree as etree
from sys import argv
from os import getenv
from os import path
path = path.expandvars(getenv('emu_path'))
emulators = check_output([path, "-list-avds"]).decode("utf-8").rstrip().split('\n')
def build_item(title):
item_el = etree.Elem... | nassendelft/alfred-android-emulator | emulist.py | Python | gpl-3.0 | 729 |
#!/usr/bin/env python
import os
import sys
import binascii
"""
Shark the Ripper Tool
For packet capture CTF problems:
Follow TCP Steam > Hex Dump > (Select Client/Server Chat) > Save As
Then input the file, followed by offset(s) where you want to cut.
-mandy
"""
if len(sys.argv) < 2:
... | mandatoryprogrammer/ctf_tools | shark_the_ripper.py | Python | mit | 1,595 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/1/19 0:38
# @Author : TOM.LEE
# @Site : https://github.com/amlyj/pythonStudy
# @File : study_Counter.py
# @Software: PyCharm
from collections import Counter
| amlyj/pythonStudy | 2.7/standard_library/collections0/study_Counter.py | Python | mit | 229 |
# Copyright 2016 Google Inc. 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 applicable law or agree... | Gljivius/SemSegmentacijaUtakmice | SemSegmentacija/slim/ops.py | Python | bsd-3-clause | 14,460 |
"""
Test the API of the symtable module.
"""
import symtable
import unittest
from test import support
TEST_CODE = """
import sys
glob = 42
class Mine:
instance_var = 24
def a_method(p1, p2):
pass
def spam(a, b, *var, **kw):
global bar
bar = 47
x = 23
glob
... | Orav/kbengine | kbe/src/lib/python/Lib/test/test_symtable.py | Python | lgpl-3.0 | 6,136 |
import time
from typing import Optional, Sequence
import orjson
from django.http import HttpRequest, HttpResponse
from django.utils.translation import gettext as _
from zerver.decorator import internal_notify_view, process_client
from zerver.lib.exceptions import JsonableError
from zerver.lib.request import REQ, Requ... | zulip/zulip | zerver/tornado/views.py | Python | apache-2.0 | 6,676 |
from graph import *
import re
class Reader(object):
"""
Interpreter for AI source data in original notation
"""
def __init__(self, registry):
super(Reader, self).__init__()
self.registry = registry
self.relExp = re.compile("(`.+`(?:\*\d+)?)\s+(<|\=)(.+)(\=|>)\s+(`.+`(?:\*\d+)?)")
self.nodeExp = re.compile(... | AlexArendsen/pylog | reader.py | Python | gpl-2.0 | 927 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | weleen/mxnet | python/mxnet/optimizer.py | Python | apache-2.0 | 50,474 |
parameter_lists_copy = [m for m in parameter_lists]
for <caret>m in parameter_lists_copy:
if param_index >= len(m.GetParameters()):
parameter_lists.remove(m)
| asedunov/intellij-community | python/testData/refactoring/rename/renameLocalWithComprehension.py | Python | apache-2.0 | 170 |
#-*-coding:utf-8 -*-
import multiprocessing
import collections
class MapReduce(object):
def __init__(self,mapper,reducer):
self.mapper = mapper
self.reducer = reducer
self.pool = multiprocessing.Pool()
def partition(self,mapped_value):
result = []
for item in mappe... | haipersist/webspider | da/MapReduce.py | Python | mit | 1,493 |
#
# Copyright (c) 2015 ThoughtWorks, Inc.
#
# Pixelated is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pixelated is distrib... | pixelated-project/pixelated-user-agent | service/pixelated/support/replier.py | Python | agpl-3.0 | 1,744 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.7.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
... | djkonro/client-python | kubernetes/client/models/v1beta1_supplemental_groups_strategy_options.py | Python | apache-2.0 | 4,328 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2022 Daniele Simonetti
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
... | OpenNingia/l5r-character-manager-3 | l5r/dialogs/newrankdlg.py | Python | gpl-3.0 | 3,473 |
#!/usr/bin/python
## Copyright (C) 2008, 2010 Red Hat, Inc.
## Authors:
## Tim Waugh <twaugh@redhat.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... | ruibarreira/linuxtrail | usr/lib/python2.7/dist-packages/cupshelpers/debug.py | Python | gpl-3.0 | 1,658 |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distribu... | quantumlib/OpenFermion | src/openfermion/transforms/repconversions/qubit_operator_transforms_test.py | Python | apache-2.0 | 5,595 |
# -*- coding: 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):
# Adding field 'Proposal.slug'
db.add_column('proposal_proposal', 'slug',
self.gf('dja... | arscariosus/django-mango | mango/apps/proposal/migrations/0007_auto__add_field_proposal_slug.py | Python | isc | 6,319 |
from SliderDialog.Slider import Slider_Dialog
from ProgressDialog.Progress import ProgressBar_Dialog
import sys
from PyQt5.QtWidgets import QApplication
if __name__ == '__main__':
app = QApplication(sys.argv)
sd = Slider_Dialog()
pb = ProgressBar_Dialog()
# Making the connection
pb.make_c... | manashmndl/LearningPyQt | Signal_Slot_Example/main.py | Python | mit | 362 |
"""Utility for creating multiple dependencies with synchronized save/restore."""
# Copyright 2017 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
... | jendap/tensorflow | tensorflow/contrib/checkpoint/python/split_dependency.py | Python | apache-2.0 | 5,769 |
import validator.testcases.langpack as langpack
from validator.errorbundler import ErrorBundle
from helper import _do_test, MockXPI, chrome_manifest
def test_langpack_valid():
'Tests that a language pack has a valid chrome manifest file.'
_do_test('tests/resources/langpack/pass.xpi',
langpack.te... | kmaglione/amo-validator | tests/test_langpack.py | Python | bsd-3-clause | 3,133 |
# -*- coding: utf-8 -*-
from __future__ import division
import time
from collections import OrderedDict
import itertools
import ast
import numpy as np
import numpy.ma as ma
#import Splines
#from Splines import spline1d
from scipy.interpolate import interp1d
from scipy.optimize import minimize, curve_fit, le... | cossatot/slip_rate_calculator | slip_rate_tools/slip_rate_tools.py | Python | mit | 38,647 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @file czech-transcription.py
# @author Jaxxer <jaxxer@aeternum.cz>
#
# @section LICENSE
# 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... | jaxxer/numberTranscription | czech-transcription.py | Python | gpl-3.0 | 5,120 |
#!/usr/bin/env python2
#
# Copyright (c) 2014, 2016 ARM Limited
# All rights reserved
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implem... | Weil0ng/gem5 | util/style/verifiers.py | Python | bsd-3-clause | 16,542 |
import os
from functools import partial
from PyQt4.QtGui import QWidget
from PyQt4.QtCore import Qt
from qgis.core import QgsMapLayer
from qgis.gui import QgsExpressionBuilderDialog
from roam.api.utils import layer_by_name
from configmanager.models import QgsLayerModel, QgsFieldModel
from configmanager.editorwidget... | lmotta/Roam | src/configmanager/editorwidgets/listwidget.py | Python | gpl-2.0 | 5,997 |
# Phatch - Photo Batch Processor
# Copyright (C) 2007-2008 www.stani.be
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version... | tibor95/phatch-python2.7 | phatch/actions/watermark.py | Python | gpl-3.0 | 9,920 |
# lrucache.py -- a simple LRU (Least-Recently-Used) cache class
# Copyright 2004 Evan Prodromou <evan@bad.dynu.ca>
# Licensed under the Academic Free License 2.1
# arch-tag: LRU cache main module
"""a simple LRU (Least-Recently-Used) cache module
This module provides very simple LRU (Least-Recently-Used) cache
func... | Jumpscale/jumpscale_core8 | lib/JumpScale/tools/cachelru/LRUCache.py | Python | apache-2.0 | 5,508 |
#! /usr/bin/env python2
import sys
shift = 1;
chars = []
print 'Enter an empty line to exit'
while 1:
str = raw_input(">")
if str=='': break
for c in str:
n = ord(c)
if shift:
chars.append(n << 8)
shift = 0
else:
shift = 1
chars[-1] |= n
#add a newline where the enter key was pressed
if shift:
... | cubeOS/cubeOS-alpha | packascii.py | Python | mit | 645 |
# coding=utf-8
from django.shortcuts import render, get_object_or_404
from django.views import generic
from django.db import models
from watson import search as watson
from .models import Product, Category
from django.views.decorators.cache import cache_page
class ProductListView(generic.ListView):
template_nam... | lucaslamounier/django-ecommerce | catalog/views.py | Python | cc0-1.0 | 1,645 |
import functools
import numpy as np
from scipy.stats import norm as ndist
import regreg.api as rr
from selection.tests.instance import gaussian_instance
from selection.learning.utils import (partial_model_inference,
pivot_plot,
lee_inference)
fr... | selective-inference/selective-inference | doc/learning_examples/multi_target/lee_multi_500.py | Python | bsd-3-clause | 3,820 |
#
# gPrime - A web-based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
#
# 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 optio... | sam-m888/gprime | gprime/filters/rules/person/_hasbirth.py | Python | gpl-2.0 | 3,492 |
from syncloudlib import logger
from syncloud_platform.insider.config import Port
from syncloud_platform.insider.manual import ManualPortMapper
from syncloud_platform.insider.port_prober import PortProber, NoneProber
from syncloud_platform.insider.util import port_to_protocol, is_web_port
from IPy import IP
class Por... | syncloud/platform | src/syncloud_platform/insider/port_drill.py | Python | gpl-3.0 | 5,284 |
import pytest
from twisted.internet import defer
from webmonitor.monitor import WebMonitor
def defer_with_content(content):
'''
return given content via deferred
'''
d = defer.Deferred()
d.callback(content)
return d
def defer_raises(exc_instance):
'''
raises exception inside a deferre... | eddwardo/webmonitor | tests/conftest.py | Python | gpl-3.0 | 646 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | yugangw-msft/azure-cli | tools/automation/verify/verify_packages.py | Python | mit | 3,692 |
"""Test praw.models.list.base."""
import pytest
from praw.models.list.base import BaseList
class TestBaseList(object):
def setup(self):
self._prev_child_attribute = BaseList.CHILD_ATTRIBUTE
self._prev_convert = BaseList._convert
def teardown(self):
BaseList.CHILD_ATTRIBUTE = self._pr... | RGood/praw | tests/unit/models/list/test_base.py | Python | bsd-2-clause | 1,889 |
import urllib
from url_shortener import URLShortener
class XedccShortener (URLShortener):
def __init__ (self, *args, **kwargs):
self.name = "Xed.cc"
super(XedccShortener, self).__init__(*args, **kwargs)
def _shorten (self, url):
answer = url
api = urllib.urlopen ("http://xed.cc/yourls-api.php?action=shortu... | codeofdusk/ProjectMagenta | src/url_shortener/shorteners/xedcc.py | Python | gpl-2.0 | 508 |
__author__ = 'Chao'
import numpy as np
from sklearn import svm, cross_validation
from sklearn.ensemble import RandomForestClassifier
from sklearn.neighbors import KNeighborsClassifier
activity_label = {'1': 'WALKING',
'2': 'WALKING_UPSTAIRS',
'3': 'WALKING_DOWNSTAIRS',
... | Sapphirine/Human-Activity-Monitoring-and-Prediction | analysis.py | Python | apache-2.0 | 6,718 |
#! /usr/bin/env python
import struct
from itertools import izip
from asciipixel import AsciiPixel
class Screen:
"""
stores a screen full of ascii characters
and their respective RGB values
i think the client should tell the server what size
screen they want (number of tiles)
"""
# units are in ascii p... | kendase3/every | common/screen.py | Python | bsd-2-clause | 3,676 |
from ecl import EclPrototype
import sys
import os
def installAbortSignals():
if sys.version_info.major < 3 and not os.getenv('ECL_SKIP_SIGNAL'):
install_signals = EclPrototype("void util_install_signals()")
install_signals()
def updateAbortSignals():
"""
Will install the util_abort_signal... | Statoil/libecl | python/ecl/util/util/install_abort_signals.py | Python | gpl-3.0 | 522 |
# -*- coding: utf-8 -*-
# © 2015 Antiun Ingeniería, S.L. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Legal terms per event",
"summary": "Make attendees to accept legal terms per event",
"version": "8.0.1.0.0",
"category": "Marketing",
"website": "ht... | Endika/event | website_event_sale_legal/__openerp__.py | Python | agpl-3.0 | 742 |
import socket
import math
import random
UDP_IP = "192.168.16.195"
UDP_PORT = 5005
MESSAGE = "50,50,"
print "UDP target IP:", UDP_IP
print "UDP target port:", UDP_PORT
print "message:", MESSAGE
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
for i in range(0,1000):
#angle = math.radians((i % 3... | yannicl/raspi-robot | v1/pi/camera/learning/test_learn_from_basic_rotation.py | Python | mit | 475 |
# Copyright (C) 2021 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class MrpWorkcenterProductivity(models.Model):
_inherit = "mrp.workcenter.productivity"
def _prepare_mrp_workorder_analytic_item(self):
"""
Prepa... | OCA/manufacture | mrp_account_analytic/models/mrp_workorder.py | Python | agpl-3.0 | 1,671 |
# -*- coding: utf-8 -*-
#
#Copyright (C) 2009 kingzero, RaNaN
#
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 3 of the License,
#or (at your option) any later version.
#
#This pro... | estaban/pyload | module/plugins/captcha/captcha.py | Python | gpl-3.0 | 9,726 |
from p4a.calendar import interfaces
from Acquisition import aq_inner, aq_parent
def update_catalog(obj, evt):
"""Reindex the object in the catalog.
"""
obj.reindexObject()
def vevent_demarshalled(obj, evt):
container = aq_parent(aq_inner(obj))
config = interfaces.ICalendarConfig(container, None)
... | cynapse/cynin | products/Plone4ArtistsCalendar/pythonlib/p4a/plonecalendar/__init__.py | Python | gpl-3.0 | 422 |
from setuptools import setup, find_packages
setup(
name='ewave',
version='0.0',
description='ewave',
long_description='',
classifiers=[
"Programming Language :: Python",
"Framework :: Pyramid",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: WSGI ... | clld/ewave | setup.py | Python | apache-2.0 | 1,119 |
__author__ = 'Sharon Lev'
__email__ = 'sharon_lev@yahoo.com'
__date__ = '11/21/16'
from unittest import TestCase, TestLoader, TextTestRunner, TestSuite
from src.unittestextras import DataSet, DataProvider
from StringIO import StringIO
class test_DataProvider(TestCase):
setup_count = 0
teardown_count = 0
class... | sharonlev/pyUnittestExtras | test/test_DataProvider.py | Python | gpl-3.0 | 4,520 |
from datetime import datetime
from flask.ext.script import Manager
from app import app, db
from app.models import User, Post
manager = Manager(app)
@manager.command
def init():
dropdb()
initdb()
filldb()
@manager.command
def initdb():
print('Initializing database...'),
db.create_all()
pri... | aishee/aisheeblog | manage.py | Python | gpl-2.0 | 5,429 |
# Copyright (C) 2013-2015 Samuel Damashek, Peter Foley, James Forcier, Srijay Kasturi, Reed Koser, Christopher Reffett, and Fox Wilson
#
# 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 ve... | jwoglom/ionbot | commands/guarded.py | Python | gpl-2.0 | 1,148 |
"""
ESSArch is an open source archiving and digital preservation system
ESSArch
Copyright (C) 2005-2019 ES Solutions AB
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... | ESSolutions/ESSArch_Core | ESSArch_Core/ip/migrations/0018_auto_20161109_1114.py | Python | gpl-3.0 | 1,388 |
# modu
# Copyright (c) 2006-2010 Phil Christensen
# http://modu.bubblehouse.org
#
#
# See LICENSE for details
"""
Datatypes to manage foreign key relationships.
"""
import time
from zope.interface import implements
from modu import assets
from modu.editable import IDatatype, define
from modu.util import form, tags,... | philchristensen/modu | src/modu/editable/datatypes/relational.py | Python | mit | 14,701 |
########
# Copyright (c) 2013 GigaSpaces Technologies Ltd. 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... | xdegenne/cloudify-plugins-common | cloudify/tests/test_decorators.py | Python | apache-2.0 | 6,442 |
import re
class CustomYaml(object):
"""
Custom YAML dumper that fits the PlanB config export needs exactly.
The regular YAML dumper would add lots of tags that we don't need.
This one is just right for this particular output.
The ugly backslash (\\b) hack signifies that we prefer the data to
... | ossobv/planb | planb/common/customyaml.py | Python | gpl-3.0 | 3,288 |
# -*- coding: utf-8 -*-
configs = {
'db': {
}
} | longfan3/contact | www/config_override.py | Python | apache-2.0 | 57 |
import couchdb
import glob
import os
couch = couchdb.Server('http://127.0.0.1:5984')
db = couch['paullaroid']
"events_gen = glob.iglob(os.path.join('_data','*')) #it's a
for event in events_gen:
doc = { '_id' : os.path.basename(event), 'type_doc':'event'}
db.save(doc)
#
#pict_gen = glob.iglob(os.path.join(... | paulla/photomaton | populate_db.py | Python | mit | 1,008 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from datetime import datetime
import unittest
from pytz import UTC, timezone
from influxdb import line_protocol
class TestLineProtocol(unittes... | Asimmetric/influxdb-python | influxdb/tests/test_line_protocol.py | Python | mit | 3,723 |
# -*- coding: utf-8 -*-
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('visas', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='visa',
name='end_date',
field=mode... | sfu-fas/coursys | visas/migrations/0002_auto_20150317_1306.py | Python | gpl-3.0 | 663 |
# -*- coding: utf-8 -*-
from django.conf import settings
from wsgiref.headers import Headers
from wsgiref.handlers import format_date_time
from time import time
from logging import getLogger
log = getLogger(__name__)
class ExpiresMiddleware (object):
"""WSGI middleware that intercepts calls to the static files
... | codeforsanjose/MobilityMapApi | src/project/twinkie.py | Python | gpl-3.0 | 2,176 |
"""Serialization module.
.. codeauthor:: Tomas Krizek <tomas.krizek1@tul.cz>
"""
import copy
from enum import Enum
class Serializable:
"""Class defines special operations during the serialization process.
It can:
- exclude certain keys from serialization
- delete key from serialized file (same ... | GeoMop/GeoMop | src/gm_base/geomop_util/serializable.py | Python | gpl-3.0 | 4,097 |
"""
SUPPRESS-GO-AHEAD
This supports suppressing or activating Evennia
the GO-AHEAD telnet operation after every server reply.
If the client sends no explicit DONT SUPRESS GO-AHEAD,
Evennia will default to supressing it since many clients
will fail to use it and has no knowledge of this standard.
It is set as the NOG... | jamesbeebop/evennia | evennia/server/portal/suppress_ga.py | Python | bsd-3-clause | 1,792 |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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 cop... | huggingface/transformers | examples/research_projects/adversarial/utils_hans.py | Python | apache-2.0 | 11,767 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# run as:
# python web2py.py -S eden -M -R applications/eden/static/scripts/tools/build.sahana.py
# or
# python web2py.py -S eden -M -R applications/eden/static/scripts/tools/build.sahana.py -A gis
#
#
# Built with code/inspiration from MapFish, OpenLayers & Michael C... | schlos/eden | static/scripts/tools/build.sahana.py | Python | mit | 26,289 |
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | nicko96/Chrome-Infra | appengine/chromium_rietveld/codereview/decorators_chromium.py | Python | bsd-3-clause | 2,669 |
"""
Implementation of cursor for iterating over results.
Backed by pymongo cursor.
"""
from sacredboard.app.data.datastorage import Cursor
class MongoDbCursor(Cursor):
"""Implements Cursor for mongodb."""
def __init__(self, mongodb_cursor):
"""Initialize a MongoDB cursor."""
self.mongodb_cur... | chovanecm/sacredboard | sacredboard/app/data/pymongo/mongocursor.py | Python | mit | 556 |
#!/usr/bin/env python
#encoding: utf-8
import numpy as np
from pylab import *
dt=0.01 # msec
tau=40.0 # msec
tmax=1000 # msec
V_spk=-20
V_thres=-50.0
V_reset=-70.0
E_leak=V_reset
R_m=10.0 # MΩ
tt=np.arange(0, tmax, dt) #0:dt:tmax
Nt=len(tt) #length(tt)
V=np.zeros((Nt,))
V2=np.zeros((Nt,))
S=np.zeros((Nt,))
S2=np.zero... | jdmonaco/vmo-feedback-model | src/spike_reset.py | Python | mit | 3,535 |
from tensorflow.keras import Input
from tensorflow.keras import Model
from tensorflow.keras.layers import Layer, Activation, BatchNormalization, Convolution2D, Dense, Flatten, MaxPooling2D, AveragePooling2D, \
add
from tensorflow.keras.models import Sequential
from tensorflow.keras.regularizers import l2
from tenso... | apacha/MusicSymbolClassifier | ModelTrainer/models/ResNet3SmallWithLocalization.py | Python | mit | 4,567 |
import unittest
from datetime import datetime, timezone, timedelta
from crontab import CronTab
from unittest.mock import Mock
from ..scheduler import Scheduler
class TestScheduler(unittest.TestCase):
def setUp(self):
c = CronTab(user=True)
c.remove_all()
c.write()
def tearDown(self):
... | kiriappeee/reply-later | src/core/tests/TestScheduler.py | Python | mit | 3,070 |
# -*- coding: 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):
# Adding model 'UploadedFile'
db.create_table('lizard_progress_uploadedfile', (
('id', self.gf('... | pombredanne/lizard-progress | lizard_progress/migrations/0003_auto__add_uploadedfile__add_uploadedfileerror__chg_field_location_info.py | Python | gpl-3.0 | 14,099 |
#!/usr/bin/env python
"""This script generates release notes for each merged pull request from
git merge-commit messages.
Usage:
`python release.py <start_commit> <end_commit> [--output {file,stdout}]`
For example, if you wanted to find the diff between version 1.0 and 1.2,
and write the output to the release notes fi... | brady-vitrano/full-stack-django-kit | release.py | Python | mit | 2,926 |
import importlib
from random import randint
from PIL import Image, ImageOps
from datetime import datetime
from django.db import models
from django.contrib.auth.models import User
from django.utils.text import slugify
from utils.utils import Master
from django.utils.translation import ugettext_lazy as _
from sorl.thumbn... | beren5000/ghosttown | imagemap/applications/user_profiles/models.py | Python | mit | 3,409 |
"""
Tests for L{xmantissa.test.rendertools}.
"""
from twisted.trial.unittest import TestCase
from nevow.athena import LiveFragment, LiveElement
from nevow.loaders import stan
from nevow.tags import p, directive
from xmantissa.test.rendertools import renderLiveFragment
class LivePageRendererTestCase(TestCase):
... | twisted/mantissa | xmantissa/test/test_rendertools.py | Python | mit | 1,212 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, fields
class adhoc_b... | jorsea/odoo-addons | adhoc_base_purchase/res_config.py | Python | agpl-3.0 | 2,441 |
# -*- coding: utf-8 -*-
import os
import tempfile
from scout.commands import cli
from scout.server.extensions import store
def test_load_gene_fusion_report_research(mock_app):
"""Test command line function that load a gene fusion research report for an existing case"""
# GIVEN a database with an existing cas... | Clinical-Genomics/scout | tests/commands/load/test_load_report_cmd.py | Python | bsd-3-clause | 2,361 |
import click
import os
import sys
# import utils
sys.path.append(os.path.join('/'.join(__file__.split('/')[:-1]), '../src'))
from kubeconfig.kubectl_actions import *
def _get_output_cli(command):
"""
Process shell command line and return output
"""
c = command.split(' ')
p = subprocess.Popen(c, s... | snipsco/teleport | bin/index.py | Python | mit | 2,447 |
class Corpus:
def __init__(self, id, title, contents, tags = [],tokenized_contents = None):
self.id = id
self.title = title
self.contents = contents
self.tags = tags
self.tokenized_contents = tokenized_contents
def to_dict(self):
return { 'title': self.title, 'ta... | kmp3325/linguine-python | linguine/corpus.py | Python | mit | 427 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.