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 |
|---|---|---|---|---|---|
"""Utility functions for PyMC"""
import numpy as np
import itertools
__all__ = ['autocorr', 'autocov', 'hpd', 'quantiles', 'mc_error', 'summary']
def statfunc(f):
"""
Decorator for statistical utility function to automatically
extract the trace array from whatever object is passed.
"""
def wrapp... | nmmarquez/pymc | pymc3/stats.py | Python | apache-2.0 | 13,148 |
import numpy as np
import matplotlib.pyplot as plt
from pylab import *
rcParams['figure.figsize'] = 6, 5
f = np.loadtxt('1e7e.dat')
#f = np.loadtxt('2bxd.dat')
y = np.sqrt(np.power(f,2).cumsum())
xlim(0.5, 20.5)
ylim(0.0, 1.05)
xticks(np.linspace(1, 20, 20, endpoint=True))
yticks(np.arange(0.0, 1.1, 0.1))
xlabel('e... | navjeet0211/phd | hsa/CumulativeOverlap.py | Python | gpl-2.0 | 583 |
from matplotlib import pyplot
import csv
import os
POWER_FREQ = 1
output_filename = 'power_vs_packets.eps'
class StairPowerData:
def __init__(self):
self.x = x
self.y = y
def add(self, x, y):
self.x.append(x)
self.x.append(x + .999)
self.y.append(y)
self.y.ap... | rauljim/power-pcap-analyzer | plotters/_plot_power_packets2.py | Python | apache-2.0 | 1,516 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='User',
... | gitaarik/jazzchords | apps/users/migrations/0001_initial.py | Python | gpl-3.0 | 1,922 |
from typing import Any, Callable, List, Optional, Tuple, Union
import jax
import jax.numpy as jnp
import numpy as np
from .custom_types import PyTree, TreeDef
from .deprecated import deprecated
#
# Filter functions
#
def is_array(element: Any) -> bool:
"""Returns `True` if `element` is a JAX array (but not a ... | patrick-kidger/equinox | equinox/filters.py | Python | apache-2.0 | 6,706 |
# Copyright (c) 2016 Shunta Saito
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import chainer
import numpy
import random
def get_args():
parser = argparse.ArgumentParser()
# Training sett... | mitmul/chainer-segnet | lib/cmd_options.py | Python | gpl-3.0 | 6,997 |
# -*- coding: utf-8 -*-
BANNED_ACCOUNT = 0
USER_ACCOUNT = 1
ADMIN_ACCOUNT = 2
| unStatiK/TorrentBOX | account_status.py | Python | mit | 79 |
#!/usr/bin/env python3
#
# Locate casts in the code
#
import cppcheckdata
import sys
for arg in sys.argv[1:]:
if arg.startswith('-'):
continue
print('Checking %s...' % arg)
data = cppcheckdata.CppcheckData(arg)
for cfg in data.iterconfigurations():
print('Checking %s, config %s...' %... | boos/cppcheck | addons/findcasts.py | Python | gpl-3.0 | 1,197 |
import pyblish.api
import maya.cmds as cmds
import pymel
class ValidateDisplaylayer(pyblish.api.Validator):
""" Ensure no construction history exists on the nodes in the instance """
families = ['scene']
optional = True
label = 'Modeling - Display Layers'
def process(self, instance):
"""... | ProgressiveFX/pyblish-pfx | pyblish_pfx/plugins/maya/modeling/_validate_displaylayer.py | Python | lgpl-3.0 | 692 |
from allauth.socialaccount import providers
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
class BasecampAccount(ProviderAccount):
def get_avatar_url(self):
return None
def to_str(self):
dflt = super... | Alexander-M-Waldman/local_currency_site | lib/python2.7/site-packages/allauth/socialaccount/providers/basecamp/provider.py | Python | gpl-3.0 | 1,226 |
from __future__ import unicode_literals
from future.builtins import str
from future.utils import with_metaclass
from json import loads
try:
from urllib.request import urlopen
from urllib.parse import urlencode
except ImportError:
from urllib import urlopen, urlencode
from django.contrib.contenttypes.gener... | cccs-web/mezzanine | mezzanine/core/models.py | Python | bsd-2-clause | 17,835 |
def triangular_range(start, stop):
cnt = 1
result = {}
while True:
triangle_num = (cnt * (cnt + 1)) / 2
if start <= triangle_num <= stop:
result[cnt] = triangle_num
elif triangle_num > stop:
return result
cnt += 1
| the-zebulan/CodeWars | katas/kyu_7/triangular_range.py | Python | mit | 282 |
__author__ = 'igor'
values = raw_input().split()
values = [float(i) for i in values]
values.sort()
values.reverse()
A, B, C = values
if (A >= B + C):
print("NAO FORMA TRIANGULO")
elif (A == (B**2 + C**2)**0.5):
print("TRIANGULO RETANGULO")
elif ((A > (B**2 + C**2)**0.5)):
print("TRIANGULO OBTUSANGULO")
el... | Igonline/URI | triangleTypes - 1045/src/TriangleTypes.py | Python | gpl-2.0 | 563 |
# Copyright 2021 The Kubeflow Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | kubeflow/pipelines | sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_params_containing_format.py | Python | apache-2.0 | 1,372 |
import _surface
import chimera
try:
import chimera.runCommand
except:
pass
from VolumePath import markerset as ms
try:
from VolumePath import Marker_Set, Link
new_marker_set=Marker_Set
except:
from VolumePath import volume_path_dialog
d= volume_path_dialog(True)
new_marker_set= d.new_marker_set
marker_set... | batxes/4Cin | SHH_WT_models/SHH_WT_models_final_output_0.1_-0.1_11000/mtx1_models/SHH_WT_models44981.py | Python | gpl-3.0 | 17,586 |
# Copyright 2016 Open Source Robotics Foundation, 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... | ros2/rclpy | rclpy/rclpy/timer.py | Python | apache-2.0 | 4,444 |
import json
from django.utils import six
def get_tag_html(tag, args=None, kwargs=None):
"""
Returns the Django HTML to load the tag library and render the tag.
Args:
tag (str): The name of the tag following the 'tag_library.tag_name'
format.
args (str): The JSON encoded strin... | janusnic/django-lazy-tags | lazy_tags/utils.py | Python | mit | 1,289 |
import futcore
import time
import random
from time import strftime
from threading import Timer
fifa = futcore.logIntoFut()
while str(type(fifa)) == "<type 'str'>" or not fifa:
fifa = futcore.logIntoFut(fifa)
watchlist = []
"""
LOAD THE WATCHLIST
STRUCTURE:
Player Name##AssetID
ex:
Gareth Bale##173731
"""
def logAct... | Guad/futsniper | futsniper.py | Python | mit | 4,003 |
default_app_config = 'books.apps.BooksConfig'
| djangogirlstaipei/eshop | bookshop/books/__init__.py | Python | mit | 46 |
# Copyright 2014, 2015 Facundo Batista, Nicolás Demarchi
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WI... | ricardokirkner/fades | tests/test_parsing.py | Python | gpl-3.0 | 18,572 |
import pprint
import sys
from xml.dom import xmlbuilder, expatbuilder, Node
from xml.dom.NodeFilter import NodeFilter
class Filter(xmlbuilder.DOMBuilderFilter):
whatToShow = NodeFilter.SHOW_ELEMENT
def startContainer(self, node):
assert node.nodeType == Node.ELEMENT_NODE
if node.tagName == "s... | Pikecillo/genna | external/PyXML-0.8.4/test/test_filter.py | Python | gpl-2.0 | 5,625 |
# -*- coding: utf-8 -*-
import sys
sys.path.append(sys.argv[1])
from scriptlib import *
"""Файлы пакета"""
FILES = (
'gimp-2.8.14-setup-1.exe',
'gimp-help-2-2.8.1-ru-setup.exe',
)
"""Имена исполняемых файлов"""
INSTALLER0 = os.path.join('', DIR, FILES[1])
INSTALLER1 = os.path.join('', DIR, FILES[0])
UNINSTA... | kuchiman/wpm-pkg | Gimp/script.py | Python | gpl-2.0 | 906 |
# LICENSE: Simplified BSD https://github.com/mmp2/megaman/blob/master/LICENSE
import numpy as np
from scipy.sparse import isspmatrix
from sklearn.utils.validation import check_array
from .utils import RegisterSubclasses
def compute_affinity_matrix(adjacency_matrix, method='auto', **kwargs):
"""Compute the affin... | jakevdp/Mmani | megaman/geometry/affinity.py | Python | bsd-2-clause | 1,893 |
# -*- coding:utf8 -*-
import json
import requests
import re
import datetime
import MySQLdb
from multiprocessing import Pool
# 自己的数据库
db_conf = {
}
db = MySQLdb.connect(host=db_conf.get('host'), user=db_conf.get('user'), port=db_conf.get('port'),
passwd=db_conf.get('passwo... | richardGaoPy/NetSpider | entertainment/entertainmentoa/demo.py | Python | apache-2.0 | 4,466 |
from fastapi.testclient import TestClient
from docs_src.query_params_str_validations.tutorial013 import app
client = TestClient(app)
openapi_schema = {
"openapi": "3.0.2",
"info": {"title": "FastAPI", "version": "0.1.0"},
"paths": {
"/items/": {
"get": {
"responses": {... | tiangolo/fastapi | tests/test_tutorial/test_query_params_str_validations/test_tutorial013.py | Python | mit | 3,095 |
# Copyright 2017 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 ag... | bda2017-shallowermind/MusTGAN | magenta/magenta/models/nsynth/wavenet/train.py | Python | apache-2.0 | 5,263 |
#
# Copyright 2007-2014 Charles du Jeu - Abstrium SAS <team (at) pyd.io>
# This file is part of Pydio.
#
# Pydio 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 ... | pydio/pydio-sync | src/pydio/job/EventLogger.py | Python | gpl-3.0 | 7,410 |
from element_tree import xml_compare_with_visitor, MyElementTree
from default_visitor import StdVisitor
import sys
try:
import xml.etree.cElementTree as ET
except ImportError:
import xml.etree.ElementTree as ET
if len(sys.argv) != 3:
sys.stderr.write("Usage: python %s oldfile newfile" % sys.argv[0])
else:
... | ZhaoYonggang198/xpdiff | __init__.py | Python | gpl-2.0 | 512 |
import argparse
import logging
import sys
import yaml
from . import exc
from . import main as main_
log = logging.getLogger(__name__)
def parse_args():
parser = argparse.ArgumentParser(
description='Create an Ubuntu Cloud image vm',
)
parser.add_argument(
'-v', '--verbose',
... | ceph/propernoun | propernoun/cli.py | Python | mit | 1,296 |
from django.shortcuts import render, render_to_response, RequestContext
from .forms import SignUpForm
# Create your views here.
def home(request):
form = SignUpForm(request.POST or None)
if form.is_valid():
save_it = form.save(commit=False)
save_it.save()
return render_to_response... | sonnykr/blog | SignUps/views.py | Python | apache-2.0 | 389 |
#!/usr/bin/env python
'''
Usage: python lemmatiser.pl lemmaFile < input > output
The input should have two colums
<html>
word1 tag1
word2 tag2
.
'''
import sys
import re
lemmaDict= {} # word : { pos : lemma}
def loadLemmatiser(file):
for line in open(file):
line=line.strip()
word= line.split('\t... | griimick/feature-mlsite | app/static/hindi-dependency-parser-2.0/hindi-pos-tagger/bin/lemmatiser.py | Python | mit | 1,258 |
import pyb
from pyb import Pin
def translate(val, oMin=0, oMax=4096, nMin=0, nMax=255):
"""Translate val from range [oMin, oMax] to [nMin, nMax]"""
return int(((val * (nMax - nMin)) / (oMax - oMin)) + nMin)
def ledsOff():
"""Turn all leds off"""
[pyb.LED(i).off() for i in range(1,5)]
def binLeds(n... | sevanteri/micropython | util.py | Python | mit | 1,664 |
# Generated by Django 2.2.24 on 2021-11-12 14:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('materia', '0079_auto_20210311_1711'),
]
operations = [
migrations.AlterField(
model_name='documentoacessorio',
name... | interlegis/sapl | sapl/materia/migrations/0080_auto_20211112_1106.py | Python | gpl-3.0 | 427 |
# -*- coding: UTF-8 -*-
__author__ = 'Jeffrey'
| duanhun/apk_for_linux | settings.py | Python | apache-2.0 | 47 |
"""
Script for importing courseware from XML format
"""
from django.core.management.base import BaseCommand, CommandError, make_option
from django_comment_common.utils import (seed_permissions_roles,
are_permissions_roles_seeded)
from xmodule.modulestore.xml_importer import imp... | geekaia/edx-platform | cms/djangoapps/contentstore/management/commands/import.py | Python | agpl-3.0 | 2,218 |
# Copyright 2013 The Android Open Source Project
#
# 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 a... | s20121035/rk3288_android5.1_repo | cts/apps/CameraITS/tests/inprog/test_3a_remote.py | Python | gpl-3.0 | 2,817 |
"""
SQL functions reference lists:
http://www.gaia-gis.it/spatialite-3.0.0-BETA/spatialite-sql-3.0.0.html
https://web.archive.org/web/20130407175746/http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.0.0.html
http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.2.1.html
"""
import re
import sys
from django.contrib.gis.db.... | KrzysztofStachanczyk/Sensors-WWW-website | www/env/lib/python2.7/site-packages/django/contrib/gis/db/backends/spatialite/operations.py | Python | gpl-3.0 | 10,604 |
from channels import Group
from channels.sessions import channel_session
from channels.auth import channel_session_user, channel_session_user_from_http
import json
from engine.messaging import Request
@channel_session_user_from_http
def ws_add(message):
if(message.user.is_authenticated()):
message.reply_c... | afriestad/interlecture | interlecture/engine/consumers.py | Python | mit | 849 |
#
# Licensed to Intel Corporation under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# Intel Corporation licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this fi... | dding3/BigDL | dl/src/main/python/dev/modules.py | Python | apache-2.0 | 2,012 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0018_validate_email_on_referrer'),
]
operations = [
migrations.AlterModelOptions(
name='applicationconnec... | efornal/pulmo | app/migrations/0019_changed_verbose_name_models.py | Python | gpl-3.0 | 3,175 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
from django.conf import settings
from django.utils.html import escape
from pybb.defaults import PYBB_SMILES, PYBB_SMILES_PREFIX
from django.forms import Textarea
def smile_it(s):
for smile, url in PYBB_SMILES.items():
s = s.replace... | just-work/pybbm | pybb/markup/base.py | Python | bsd-2-clause | 1,433 |
import cairo
import vector
import rectangle
from .widget import Widget
class CheckBox(Widget):
_on_image = None
_off_image = None
_clicked_image = None
_disabled_image = None
_clicked = False
_moused = False
clickable = True
mousable = True
text = None
toggled_responder ... | BlackDragonN001/BZCLauncher | application/widgets/checkbox.py | Python | mit | 3,226 |
def foo():
return 1
def bar():
return 1
| cortesi/pry | test/covtests/testUnit/getGlobalStats.py | Python | mit | 48 |
# Patchwork - automated patch tracking system
# Copyright (C) 2017 Stephen Finucane <stephen@that.guru>
#
# SPDX-License-Identifier: GPL-2.0-or-later
from collections import OrderedDict
from rest_framework.generics import ListAPIView
from rest_framework.serializers import ModelSerializer
from rest_framework.serialize... | stephenfin/patchwork | patchwork/api/event.py | Python | gpl-2.0 | 3,356 |
# Copyright 2013 Cisco Systems, 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 o... | neoareslinux/neutron | neutron/plugins/cisco/extensions/network_profile.py | Python | apache-2.0 | 3,909 |
# -*- coding: utf-8 -*-
#
# 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
#... | fenglu-g/incubator-airflow | airflow/www/utils.py | Python | apache-2.0 | 15,576 |
"""
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2015 Dirk Beyer
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
... | hbgit/Map2Check | utils/moduleBenchExec/map2check.py | Python | gpl-2.0 | 4,690 |
#
# @BEGIN LICENSE
#
# Psi4: an open-source quantum chemistry software package
#
# Copyright (c) 2007-2021 The Psi4 Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This file is part of Psi4.
#
# Psi4 is free software; you can redistribute it and/or modify
#... | lothian/psi4 | psi4/driver/util/tty/color.py | Python | lgpl-3.0 | 7,149 |
import numpy as np
import pytest
from scipy import sparse
from numpy.testing import assert_array_almost_equal
from numpy.testing import assert_array_equal
from sklearn.utils import check_random_state
from sklearn.utils._testing import assert_allclose
from sklearn.datasets import make_regression
from sklearn.linear_mo... | kevin-intel/scikit-learn | sklearn/linear_model/tests/test_ransac.py | Python | bsd-3-clause | 20,637 |
# -*- coding: utf-8 -*-
# config.py
#
# Copyright 2014-2015 BitVault, Inc. dba Gem
from __future__ import unicode_literals
SUPPORTED_NETWORKS = ['bitcoin_testnet', 'bitcoin', 'dogecoin', 'litecoin']
GEM_URL = 'https://api.gem.co'
| GemHQ/round-py | round/config.py | Python | mit | 232 |
__author__ = 'Jonathan Brodie'
import ctypes
from hzclient.clientmessage import ClientMessage
from util import util
'''
COMMIT
'''
def commitEncode():
msg=ClientMessage()
msg.optype=0x1701
util.raiseNotDefined()
def commitDecode(bytesobject):
servermsg=ClientMessage.decodeMessage(bytesobject)
util.r... | hazelcast-incubator/pyhzclient | hzclient/codec/transaction.py | Python | apache-2.0 | 788 |
# Generated by Django 2.2.9 on 2020-01-24 19:39
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('workshops', '0209_tags_sorting_order'),
]
operations = [
migrations.AlterField(
model_name='eve... | pbanaszkiewicz/amy | amy/workshops/migrations/0210_auto_20200124_1939.py | Python | mit | 600 |
"""
biobox login - Log in to a biobox container with mounted test data
Usage:
biobox login <biobox_type> <image> [<args>...]
Options:
-h, --help Show this screen.
-r, --no-rm Don't remove the container after the process finishes
-t, --no-tty Don't start a terminal emulator, used for scripted intera... | pbelmann/command-line-interface | biobox_cli/command/login.py | Python | mit | 2,319 |
#
# IIT Kharagpur - Hall Management System
# System to manage Halls of residences, Warden grant requests, student complaints
# hall worker attendances and salary payments
#
# MIT License
#
"""
@ authors: Madhav Datt, Avikalp Srivastava
"""
from PyQt4 import QtCore, QtGui
import Complaint
try:
_fromUtf8 = QtCore.... | madhav-datt/kgp-hms | src/ui/Complaint_GUI.py | Python | mit | 804 |
"""
Testing JSON serialisation writer and reader.
"""
import io
import math
from noodles.run.remote.io import (JSONObjectReader, JSONObjectWriter)
from noodles.serial import base as registry
objects = ["Hello", 42, [3, 4], (5, 6), {"hello": "world"},
math.tan, object]
def test_json():
"""Test strea... | NLeSC/noodles | test/serial/test_remote_io.py | Python | apache-2.0 | 612 |
# -*- coding: utf8
from __future__ import division, print_function
from pyksc.trend import TrendLearner
from sklearn.metrics import classification_report
from sklearn.metrics import confusion_matrix
import ioutil
import numpy as np
import os
import plac
import sys
def fit(C, y_train, X, y_true, num_pts):
lear... | flaviovdf/pyksc | src/trend-learner-scripts/classify_pts.py | Python | bsd-3-clause | 2,192 |
class A:
def foo(self): # Add 'self'
pass
| asedunov/intellij-community | python/testData/inspections/AddSelf_after.py | Python | apache-2.0 | 48 |
# -*- coding: utf-8 -*-
# Copyright(C) 2012 Romain Bignon
#
# This file is part of a weboob module.
#
# This weboob module 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 Licens... | vicnet/weboob | modules/seloger/pages.py | Python | lgpl-3.0 | 7,023 |
from heppy_fcc.particles.jet import Jet as BaseJet
from vertex import Vertex
from ROOT import TLorentzVector
import math
class Jet(BaseJet):
def __init__(self, fccjet):
self.fccjet = fccjet
self._tlv = TLorentzVector()
p4 = fccjet.Core().P4
self._tlv.SetXYZM(p4.Px, p4.Py, p4.Pz... | semkiv/heppy_fcc | particles/fcc/jet.py | Python | gpl-3.0 | 341 |
from __future__ import absolute_import, print_function
import re
from django.db import models
from django.utils import timezone
from sentry.db.models import (
BoundedPositiveIntegerField, FlexibleForeignKey, Model, sane_repr
)
from sentry.utils.cache import memoize
_fixes_re = re.compile(r'\b(?:Fix|Fixes|Fixed|... | JackDanger/sentry | src/sentry/models/commit.py | Python | bsd-3-clause | 2,231 |
# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Test pgsession.py."""
__metaclass__ = type
from unittest import TestCase
from zope.publisher.browser import TestRequest
from zope.security.management import (
endInt... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/services/webapp/tests/test_pgsession.py | Python | agpl-3.0 | 5,978 |
from types import NoneType
__all__ = ('Const', 'C')
class Const(object):
creation_counter = 0
def __init__(self, id_or_attrs_dict=None, attrs_dict=None, **attrs_kwargs):
assert isinstance(id_or_attrs_dict, (int, dict, NoneType)), \
'First arg (if given) should be id integer or attributes... | glowka/const_choice | const_choice/const.py | Python | mit | 2,070 |
__author__ = 'Arunkumar Eli'
__email__ = "elrarun@gmail.com"
| aruneli/rancher-test | ui-selenium-tests/lib/utils.py | Python | apache-2.0 | 63 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import, print_function
import click
import json, os, sys, subprocess
from distutils.spawn import find_executable
import frappe
from frappe.commands import pass_context, get_site
from frappe.utils import update_progress_bar
from frappe.utils.resp... | chdecultot/frappe | frappe/commands/utils.py | Python | mit | 18,119 |
# Copyright 2021 Daniel Campos - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class StockOrderpointGenerator(models.TransientModel):
_name = 'stock.orderpoint.generator'
_description = "Wizard to generate stock.warehouse.orderpoints"
gene... | avanzosc/odoo-addons | stock_orderpoint_generation/wizards/stock_orderpoint_generator.py | Python | agpl-3.0 | 2,809 |
# -*- coding: utf-8 -*-
from __future__ import with_statement
from contextlib import contextmanager
import inspect
from itertools import chain
import os
from django.conf import settings
from django.template import Lexer, TOKEN_BLOCK
from django.utils import six
from django.utils.decorators import method_decorator
from... | amaozhao/basecms | cms/utils/check.py | Python | mit | 16,294 |
# Copyright 2019 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... | tensorflow/tensorflow | tensorflow/python/ops/default_gradient.py | Python | apache-2.0 | 2,960 |
# Generated by Django 1.11.5 on 2017-09-07 10:59
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_dependency(settings.AUTH_USER_M... | defivelo/db | apps/challenge/migrations/0049_helperseasonworkwish.py | Python | agpl-3.0 | 1,185 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from __future__ import unicode_literals
import sys
try:
import wx
except ImportError as error:
print error
sys.exit(1)
def crt_command_event(event_type, event_id=0):
"""Shortcut to create command events."""
return wx.CommandEvent(event_type.typeId, ... | Sofronio/youtube-dl-gui | youtube_dl_gui/widgets.py | Python | unlicense | 13,180 |
from flow import Block, Input
from traits.api import Str
class MPlayerControl(Block):
from mplayer import Player
enable = Input()
def init(self, path):
self.player = self.Player('-input default-bindings')
self.player.loadfile(path)
self.player.pause()
self.player.frame_dr... | strfry/OpenNFB | flow/video.py | Python | gpl-3.0 | 624 |
# PyAlgoTrade
#
# Copyright 2011-2015 Gabriel Martin Becedillas Ruiz
#
# 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 ap... | cgqyh/pyalgotrade-mod | pyalgotrade/dataseries/resampled.py | Python | apache-2.0 | 5,989 |
import sys
import decimal
from decimal import Decimal
from concurrent import futures
import btceapi
import bitfinex
import arbmath
from arbmath import Order
from random import randint
class AbstractTradeApi(object):
def __init__(self):
self.orderQueue = []
def Name(self):
return ''
#Fee (%)
de... | victorshch/pytrader | tradeapi.py | Python | mit | 7,810 |
from parameterized import parameterized
from combinatrix.testintegration import load_parameter_sets
from doajtest.fixtures import ArticleFixtureFactory, AccountFixtureFactory, JournalFixtureFactory
from doajtest.helpers import DoajTestCase
from portality.bll import DOAJ
from portality.bll import exceptions
from portal... | DOAJ/doaj | doajtest/unit/test_article_acceptable_and_permissions.py | Python | apache-2.0 | 4,432 |
# Copyright 2010 http://www.collabq.com
import logging
from django.conf import settings
from django.http import HttpResponseRedirect
from common import api
from common import exception
class VerifyInstallMiddleware(object):
def process_request(self, request):
logging.info("VerifyInstallMiddleware")
logging... | CollabQ/CollabQ | middleware/verify.py | Python | apache-2.0 | 608 |
"""Script defined to test the Subscription class."""
import httpretty
from paystackapi.subscription import Subscription
from paystackapi.tests.base_test_case import BaseTestCase
class TestSubscription(BaseTestCase):
"""Class to test subscription actions."""
@httpretty.activate
def test_create(self):
... | andela-sjames/paystack-python | paystackapi/tests/test_subscription.py | Python | mit | 2,802 |
# -*- coding: utf-8 -*
import sys, re
import unicodedata
reload(sys)
sys.setdefaultencoding("utf-8")
class LangConfig:
def __init__(self):
self.avg_keywords = []
self.sum_keywords = []
self.max_keywords = []
self.min_keywords = []
self.count_keywords = []
self.junction_keywords = []
... | Harsh1-1/trash | LangConfig.py | Python | gpl-3.0 | 4,142 |
from django.core.management.base import BaseCommand
from .base import LatexCommand
class Command(LatexCommand, BaseCommand):
def handle(self, *args, **options):
self.activate_translation()
self.make()
| tejo-esperanto/pasportaservo | book/management/commands/makelatex.py | Python | agpl-3.0 | 225 |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to us... | EmanueleCannizzaro/scons | test/Interactive/shell.py | Python | mit | 3,504 |
from django.conf.urls import patterns, url
from . import views
urlpatterns = patterns(
'',
url(r'^$', views.HomeView.as_view(), name="home"),
url(r'^contact/$', views.ContactFormView.as_view(), name="contact"),
url(r'^about/$', views.AboutView.as_view(), name="about"),
url(r'^resume/$', views.Resum... | zsoobhan/prometheus | www/content/urls.py | Python | mit | 447 |
#!/usr/bin/env python
#
# Copyright 2014 tigmi
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | hancockt/python-kubernetes | kubernetes/__init__.py | Python | apache-2.0 | 1,852 |
import _plotly_utils.basevalidators
class MetaValidator(_plotly_utils.basevalidators.AnyValidator):
def __init__(self, plotly_name="meta", parent_name="mesh3d", **kwargs):
super(MetaValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
array_ok=kw... | plotly/python-api | packages/python/plotly/plotly/validators/mesh3d/_meta.py | Python | mit | 479 |
"""
Python implementation of RAF file format.
"""
import os
import re
import zlib
import six
from .formats import RAF_INDEX
from .util import LazyFile
class RAFEntry(object):
"""
Lazy entry.
"""
def __init__(self, fh, path, offset, size):
self.path = path
self.offset = offset
... | Met48/raf | raf/__init__.py | Python | mit | 5,920 |
"""
Tests for Cohort API
"""
import json
import tempfile
import ddt
import six
from six.moves import range
from django.urls import reverse
from openedx.core.djangoapps.oauth_dispatch.tests.factories import ApplicationFactory, AccessTokenFactory
from openedx.core.djangolib.testing.utils import skip_unless_lms
from s... | cpennington/edx-platform | openedx/core/djangoapps/course_groups/tests/test_api_views.py | Python | agpl-3.0 | 19,925 |
import win32ui
import win32gui
import win32con
import win32api
import Image
import sys
import os
import tempfile
import shutil
def extract_icon(exefilename):
"""Get the first resource icon from win32 exefilename and returns it a s PNG bytes array"""
ico_x = win32api.GetSystemMetrics(win32con.SM_CXICON)
... | tranquilit/WAPT | tests/extract_icon.py | Python | gpl-3.0 | 1,236 |
"""
This script is solely used when generating builds. It generates a version number automatically using
git tags as it's basis. Whenever a build is created, run this file beforehand and it should replace
the old version number with the new one in VERSION.YML
"""
import yaml
import subprocess
import os
with open("ve... | blitzmann/Pyfa | scripts/dump_version.py | Python | gpl-3.0 | 1,012 |
#
# Copyright (C) 2017 Maha Farhat
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distribu... | IQSS/gentb-site | tb_website/urls.py | Python | agpl-3.0 | 2,636 |
#!/usr/bin/env python
import sys, os
import whisper
from optparse import OptionParser
option_parser = OptionParser(
usage='''%prog path timePerPoint:timeToStore [timePerPoint:timeToStore]*
timePerPoint and timeToStore specify lengths of time, for example:
60:1440 60 seconds per datapoint, 1440 datapoints =... | tmm1/graphite | whisper/bin/whisper-create.py | Python | apache-2.0 | 1,389 |
#
# partition.py
# Python bindings for libparted (built on top of the _ped Python module).
#
# Copyright (C) 2009-2013 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, o... | ruibarreira/linuxtrail | usr/lib/python2.7/dist-packages/parted/partition.py | Python | gpl-3.0 | 9,914 |
# -*- coding: utf-8 -*-
import os
from better import better_theme_path
READ_THE_DOCS = os.environ.get('READTHEDOCS', None) == 'True'
needs_sphinx = '1.0'
extensions = []
intersphinx_mapping = {}
templates_path = ['_templates']
exclude_patterns = ['_build']
source_suffix = '.rst'
#source_encoding = 'utf-8-sig'
maste... | literallycanvas/literallycanvas.github.com | conf.py | Python | bsd-2-clause | 1,808 |
'''
NNKit is a object-oriented neural network construction and exploration kit.
The following classes are largely orthogonal:
Dendrite objects specify the connectivity between a NeuronLayer and its predecessor. Currently,
only CompleteDendrites are supported (there is a connection between every input and every outpu... | imofftoseethewizard/nnkit | src/__init__.py | Python | gpl-3.0 | 2,511 |
from nose.tools import assert_equal, assert_raises
from encryptit.length import Length
def test_length_in_octets():
l = Length(octets=10)
assert_equal(10, l.in_octets)
assert_equal(10 * 8, l.in_bits)
def test_length_in_bits():
l = Length(bits=80)
assert_equal(10, l.in_octets)
assert_equal(1... | paulfurley/encryptit | encryptit/tests/test_length.py | Python | agpl-3.0 | 767 |
from uuid import uuid4
from django.test import TestCase
from casexml.apps.case.cleanup import claim_case, get_first_claim
from casexml.apps.case.mock import CaseBlock
from casexml.apps.case.util import post_case_blocks
from corehq.apps.case_search.models import CLAIM_CASE_TYPE
from corehq.apps.domain.shortcuts impor... | dimagi/commcare-hq | corehq/apps/ota/tests/test_claim.py | Python | bsd-3-clause | 4,929 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operati... | akbarpn136/logapp-dj | logapp/migrations/0001_initial.py | Python | mit | 3,758 |
#!/usr/bin/python
#
# (c) 2018, Yanis Guenane <yanis+ansible@guenane.org>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | thaim/ansible | lib/ansible/modules/cloud/vultr/_vultr_network_facts.py | Python | mit | 3,847 |
import asposepdfcloud
from asposepdfcloud.PdfApi import PdfApi
from asposepdfcloud.PdfApi import ApiException
import asposestoragecloud
from asposestoragecloud.StorageApi import StorageApi
from asposestoragecloud.StorageApi import ResponseMessage
apiKey = "XXXXX" #sepcify App Key
appSid = "XXXXX" #sepcify App SID
api... | asposepdf/Aspose_Pdf_Cloud | Examples/Python/Examples/RemoveAllDocumentProperties.py | Python | mit | 1,198 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Run the core of the alleleseq pipeline.
============================================================================
FILE: run_pipeline.py
DIR: /scratch/users/dacre/alleleseq/newrun
AUTHOR: Michael D Dacre, mike.dacre@gmail.com
ORGANIZAT... | MikeDacre/mike_tools | bin/run_alleleseq_pipeline.py | Python | unlicense | 14,712 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) Daniel Lombraña González
#
# This file is part of changewallpaper.
#
# changewallpaper 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 ver... | teleyinex/changewallpaper | change-background-art-gnome.py | Python | gpl-3.0 | 6,574 |
from datetime import datetime
from django.db import models
from django.contrib.auth.models import User, Group
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.db.models.signals import post_save, post_delete
from ckeditor import fields as ckedit_fields
from fields im... | vencax/django-vxk-forum | vxkforum/models.py | Python | bsd-3-clause | 11,745 |
import MySQLdb
from datetime import datetime
import random
mysqldatabase = MySQLdb.connect(host="localhost", # your host, usually localhost
user="root", # your username
passwd="root", # your password
db="WW3App")
sqlcursor = mysqldat... | hek23/TBD-Grupo5-1s2017 | Configuracion/words.py | Python | gpl-3.0 | 2,644 |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | aselle/tensorflow | tensorflow/python/estimator/canned/dnn_linear_combined.py | Python | apache-2.0 | 27,478 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.