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 |
|---|---|---|---|---|---|
# Copyright 2014 Mirantis 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... | stackforge/osprofiler | osprofiler/tests/unit/test_profiler.py | Python | apache-2.0 | 21,196 |
# 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 agreed to in... | dklyle/tempest-horizon | tempest_horizon/tests/scenario/test_dashboard_basic_ops.py | Python | apache-2.0 | 4,255 |
# -*- coding: utf-8 -*-
"""
:copyright: 2005-2008 by The PIDA Project
:license: GPL 2 or later (see README/COPYING/LICENSE)
"""
import gobject
import os
from os.path import exists, isdir, isfile
# PIDA Imports
from pida.core.service import Service
from pida.core.features import FeaturesConfig
from pida.core.... | fermat618/pida | pida/services/filewatcher/filewatcher.py | Python | gpl-2.0 | 3,915 |
from django.core import exceptions
from django.conf import settings
import logging
import warnings
from .models import ReloadRulesRequest
from .restrictor import IPRestrictor
logger = logging.getLogger(__name__)
class IPRestrictMiddleware(object):
restrictor = None
trusted_proxies = None
allow_proxies = ... | whyflyru/django-iprestrict | iprestrict/middleware.py | Python | bsd-3-clause | 3,117 |
###LineageProfiler
#Copyright 2005-2008 J. David Gladstone Institutes, San Francisco California
#Author Nathan Salomonis - nsalomonis@gmail.com
#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... | wuxue/altanalyze | LineageProfiler.py | Python | apache-2.0 | 33,157 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | ATSTI/administra | open_myplace/crm_lead_to_opportunity.py | Python | gpl-2.0 | 2,980 |
from django.conf.urls import url
from . import views
urlpatterns = [
url('^products/$', views.ProductListView.as_view(), name='products'),
url('^cart/$', views.CartDetailView.as_view(), name='cart'),
url(r'^cart/(?P<id>[0-9]+)/$', views.CartUpdateDeleteView.as_view(), name='update'),
]
| martinstastny/django-simplestore | simplestore/api/urls.py | Python | mit | 300 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Ericsson AB
#
# 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 ... | shengwen1994/calvin-base | calvin/actorstore/systemactors/text/LineJoin.py | Python | apache-2.0 | 2,194 |
import math
import numpy as np
import random
import scipy
import matplotlib.pyplot as plt
class Explorer:
# Actual initialization happens at first laser callback where the current pose, map size and resolution are defined.
def __init__(self):
self.resolution = 0.04
self.width = 100
sel... | purplenavi/FSR13Group2 | hiekkalaatikko/explorer/src/tester.py | Python | gpl-2.0 | 21,407 |
# Sample code to parse an image XML description and
# spit out libvirt XML; will be hooked into virt-install
#
# Copyright 2007, 2013 Red Hat, Inc.
# David Lutterkort <dlutter@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 ... | tomlanyon/python-virtinst | virtinst/ImageParser.py | Python | gpl-2.0 | 11,792 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com
from preggy import expect
from tests.base import FilterTestCase
fro... | okor/thumbor | tests/filters/test_redeye.py | Python | mit | 1,347 |
import re
import cPickle as pickle
from xml.dom import Node
import sys, os.path, nltk
from LingwoNLP.document import parse, parseString, Text_split
from nltk.tokenize.punkt import PunktLanguageVars, PunktWordTokenizer
class MyPunktLanguageVars(PunktLanguageVars):
sent_end_chars = ('.', '?', '!', '"', '\'')
#... | dsnopek/lingwo-old | nlp/LingwoNLP/segment.py | Python | gpl-2.0 | 14,707 |
"""Set primitives.
"""
from __future__ import division
from collections import Counter, defaultdict
from tde.util.functions import unique, iterator_length, flatten
from tde.substrings.acss import pairwise_substring_completion
from tde.data.classes import ClassDict
def typeset(pairs):
"""
Yield the unique ma... | bootphon/tde | tde/data/sets.py | Python | gpl-3.0 | 5,677 |
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
__author__ = 'yangdd'
'''
example 010
'''
import time
print(time.strftime('%Y-%m-%d %H:%M:%S',time.localtime()))
time.sleep(1)
print(time.strftime('%Y-%m-%d %H:%M:%S')) # 这个参数在表示当前时间的时候可以省略 time.localtime() | yangdd1205/python3-100-examples | example10.py | Python | unlicense | 292 |
from marshmallow import Schema, fields, post_load
from floyd.model.base import BaseModel
class ExperimentConfigSchema(Schema):
name = fields.Str()
family_id = fields.Str()
@post_load
def make_access_token(self, data):
return ExperimentConfig(**data)
class ExperimentConfig(BaseModel):
... | mckayward/floyd-cli | floyd/model/experiment_config.py | Python | apache-2.0 | 507 |
from __future__ import absolute_import, division, unicode_literals
import socket
from .base import StatsClientBase, PipelineBase
class Pipeline(PipelineBase):
def __init__(self, client):
super(Pipeline, self).__init__(client)
self._maxudpsize = client._maxudpsize
def _send(self):
d... | jsocol/pystatsd | statsd/client/udp.py | Python | mit | 1,666 |
import sys
sys.path.insert(0, '..')
from cde_test_common import *
def checker_func():
assert os.path.isfile(CDE_ROOT_DIR + '/home/pgbovine/CDE/tests/pwd_readfile_test/my-file.txt')
assert os.path.isfile(CDE_ROOT_DIR + '/home/pgbovine/CDE/tests/pwd_readfile_test/pwd_readfile_test.py')
generic_test_runner(["python"... | mgood7123/UPM | Tests/PACKAGES/CDE/tests/pwd_readfile_test/testme.py | Python | gpl-3.0 | 361 |
######################################################################elias's code
import turtle
import random
import time
turtle.tracer(1,0)
size_x=800
size_y=500
turtle.setup(size_x,size_y)
turtle.penup()
#how far the snake moves
SQUARE_SIZE=20
pos_list=[]
plane=turtle.clone()
#the shape of the plane
turtle.regist... | shellyw19-meet/meet2017y1final-proj | elias.py | Python | mit | 2,393 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-06-29 20:30
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0005_add_italian_to_lang_field'),
]
operations = [
migrations.A... | Cadasta/cadasta-platform | cadasta/accounts/migrations/0006_add_measurement_field.py | Python | agpl-3.0 | 776 |
import _plotly_utils.basevalidators
class YpadValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="ypad", parent_name="bar.marker.colorbar", **kwargs):
super(YpadValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/bar/marker/colorbar/_ypad.py | Python | mit | 442 |
# This file is part of Indico.
# Copyright (C) 2002 - 2015 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... | XeCycle/indico | indico/MaKaC/webinterface/rh/reviewingAssignContributions.py | Python | gpl-3.0 | 2,181 |
from django.http import HttpResponse
from django.views.generic.edit import FormView
from django.contrib.auth.forms import PasswordResetForm
from django.contrib.auth.tokens import default_token_generator
from django.template.loader import render_to_string
from django.conf import settings
from registration.backends.hmac.... | marcel-dancak/bass-cloud | server/basscloud/accounts/views.py | Python | gpl-3.0 | 2,499 |
#!/usr/bin/env python3
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
"""
License header updater.
"""
from __future__ import unicode_liter... | suutari/shoop | _misc/ensure_license_headers.py | Python | agpl-3.0 | 4,093 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2016-11-05 10:35
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('pootle_translationproject', '0003_realpath_can_be_none'),
]
operations = [
migratio... | r-o-b-b-i-e/pootle | pootle/apps/pootle_translationproject/migrations/0004_add_reverse_tp_idx.py | Python | gpl-3.0 | 485 |
from pymongo import MongoClient
from pymongo import ReadPreference
import os
import mysql.connector as mysql
import datetime, time
metrics_mysql_password = os.environ["METRICS_MYSQL_PWD"]
mongoDB_metrics_connection = os.environ["MONGO_PATH"]
#mongoDB_metricsro_connection = os.environ["METRICSRO_MONGO_PATH"]
sql_host... | kbase/metrics | source/daily_cron_jobs/methods_upload_blobstore_stats.py | Python | mit | 8,226 |
from setuptools import setup, find_packages
from pip.req import parse_requirements
NAME = "probabilities"
# Dynamically calculate the version based on __version__.
version = __import__(NAME).__version__
requirements_path = "requirements.txt"
test_requirements_path = "test_requirements.txt"
def get_requirements(pa... | tomerghelber/probabilities | setup.py | Python | apache-2.0 | 815 |
#!/usr/bin/python
#
# Copyright 2015 rameplayerorg
# Licensed under GPLv2, which you must read from the included LICENSE file.
#
# Handle's local device buttons and call's omx_server and lcd_server
#
from time import sleep
import RPi.GPIO as GPIO
import os
import socket
import time
from threading import Thread
import ... | rameplayerorg/rameplayer_old | services/button_server/button_server.py | Python | gpl-2.0 | 6,735 |
import re;
# dictionary to hold a list of all installed handler functions for all object-signalSignature pairs
installedSignalHandlers = {}
# flag to indicate whether overrideInstallLazySignalHandler() has been called already
overridenInstallLazySignalHandlers = False
# flag to indicate whether a tasks file should be ... | mornelon/QtCreator_compliments | tests/system/shared/build_utils.py | Python | lgpl-2.1 | 9,679 |
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
spannung2, strom2 = np.genfromtxt('Rohdaten/gegsp50ohm.txt',unpack=True)
strom2 = strom2 * 0.001
plt.plot(strom2, spannung2,'k.',label='$Klemmenspannung$')
#plt.legend(loc='best')
plt.grid()
#plt.ylim(20,140)
plt.xlabel(r'$\mathrm{... | mwindau/praktikum | v301/gegsp50.py | Python | mit | 940 |
#
# Wrappers around common queries
#
import logging
from models import Language,DemographicData,ExitSurveyData,TrainingRecord,UserConfiguration,SourceDocument
logger = logging.getLogger(__name__)
def get_language(code_str):
"""
"""
try:
return Language.objects.get(code=code_str)
except Languag... | stanfordnlp/phrasal | ptm/tm/tmapp/model_utils.py | Python | gpl-3.0 | 1,993 |
# Copyright 2020 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... | keras-team/keras | keras/layers/preprocessing/discretization_test.py | Python | apache-2.0 | 16,355 |
#from django.conf.urls.defaults import patterns, url
from corehq.apps.users.views import DefaultProjectUserSettingsView, EditWebUserView, EditMyAccountDomainView, ListWebUsersView, InviteWebUserView
from corehq.apps.users.views.mobile.groups import EditGroupsView, EditGroupMembersView
from corehq.apps.users.views.mobil... | gmimano/commcaretest | corehq/apps/users/urls.py | Python | bsd-3-clause | 4,395 |
"""Provides device triggers for binary sensors."""
import voluptuous as vol
from homeassistant.components.device_automation import TRIGGER_BASE_SCHEMA
from homeassistant.components.device_automation.const import (
CONF_TURNED_OFF,
CONF_TURNED_ON,
)
from homeassistant.components.homeassistant.triggers import st... | sdague/home-assistant | homeassistant/components/binary_sensor/device_trigger.py | Python | apache-2.0 | 7,714 |
# vim: set fileencoding=utf-8 :
"""python-opscripts setup
"""
# Standard library
from __future__ import absolute_import, division, print_function
import os.path
import re
import site
import sys
import glob
# Third-party
from setuptools import find_packages, setup
setup_path = os.path.dirname(os.path.realpath(__fil... | ClockworkNet/OpScripts | setup.py | Python | mit | 2,971 |
import sys
import ndn
class ndnput(ndn.Closure):
def __init__(self, name, content):
self.handle = ndn.Face()
self.name = ndn.Name(name)
self.content = self.prepareContent(content, self.handle.getDefaultKey())
# this is so we don't have to do signing each time someone requests data
# if we will be serving con... | cawka/packaging-PyNDN-dev | examples/ndnput.py | Python | bsd-3-clause | 2,145 |
# Copyright 2016 Quantopian, 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 writ... | quantopian/zipline | zipline/data/history_loader.py | Python | apache-2.0 | 22,513 |
from engine.cardstack import CardStack
from engine.card import Card, YourCard
import pytest
import unittest
from mock import create_autospec, patch
class TestCardStack(unittest.TestCase):
def test_is_legal_play_true(self):
stack = CardStack('red')
mock_red_1 = create_autospec(Card)
mock_re... | chastise/pyhanabi | tests/test_cardstack.py | Python | gpl-3.0 | 3,836 |
# Copyright 2011 Jamie Norrish (jamie@artefact.org.nz)
#
# 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... | ajenhl/django-tmapi | tmapi/models/scoped.py | Python | apache-2.0 | 2,002 |
# -*- coding: utf-8 -*-
"Test page sizes and orientation"
#PyFPDF-cover-test:format=PDF
#PyFPDF-cover-test:fn=page_size.pdf
#PyFPDF-cover-test:hash=be021da05095336223c011d0a23bc40f
import os
import common
from fpdf import FPDF
def page(pdf, text, orientation, format):
pdf.add_page(orientation = orientation, fo... | Hasimir/pyfpdf | tests/cover/test_page_size.py | Python | lgpl-3.0 | 995 |
#!/usr/bin/env python
"""Build script for mccdaq.
unzip mccdaq-x.x.zip
>>>> setup.py install
mccdaq-x.x.win32-py2.x.exe
>>>> setup.py bdist_wininst --bitmap mccdaq.bmp
"""
from distutils.core import setup, Extension
import os, re, sys, string
VERSION_MAJOR = 0
VERSION_MINOR = 2
mccdaq_version = str(VERSION_MAJOR) ... | countrymarmot/mccdaq | setup.py | Python | bsd-3-clause | 2,031 |
from .fetch import FetchParser
from .json_ld import JsonLdParser
from .lom import LomParser
from .lrmi import LrmiParser
from .nsdl_dc import NsdlDcParser
__all__ = [
'FetchParser',
'JsonLdParser',
'LomParser',
'LrmiParser',
'NsdlDcParser',
]
| navnorth/LR-Data | src/payload_schema/__init__.py | Python | apache-2.0 | 265 |
# -*- coding: utf-8 -*-
"""User Timeline Handler."""
from google.appengine.ext import ndb
import json
from util import login_required
from utils import json_response
from utils import offset_pagination
from utils import Utils
from utils import to_int
from custom_exceptions import QueryException
from . import BaseHan... | eciis/web | backend/handlers/institution_timeline_handler.py | Python | gpl-3.0 | 1,553 |
# -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Romain Bignon
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your... | frankrousseau/weboob | modules/arte/module.py | Python | agpl-3.0 | 6,850 |
# Copyright (c) 2014 Mirantis 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, so... | japaniel/CloudFerry | cloudferrylib/os/actions/networks_transporter.py | Python | apache-2.0 | 1,058 |
#!/usr/bin/python
# -*- coding:UTF-8 -*-
# Copyright (c) Stephen Smally <stephen.smally@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of t... | hyperdriveguy/mint-software-center | src/widgets/searchentry.py | Python | gpl-2.0 | 2,634 |
#!/usr/bin/env python
import fnmatch
import os
import sys
from lib.util import execute
IGNORE_FILES = [
os.path.join('atom', 'browser', 'mac', 'atom_application.h'),
os.path.join('atom', 'browser', 'mac', 'atom_application_delegate.h'),
os.path.join('atom', 'browser', 'resources', 'win', 'resource.h'),
os.pa... | brave/electron | script/cpplint.py | Python | mit | 1,583 |
from __future__ import print_function
import argparse
class Requirement(object):
def __init__(self):
super(Requirement, self).__init__()
self.value = None
self.comments = []
@property
def name(self):
if self.value.startswith(b'-e '):
return self.value.lower()... | Coverfox/pre-commit-hooks | pre_commit_hooks/requirements_txt_fixer.py | Python | mit | 2,523 |
"""
sys.argv emulation
This module starts a basic event loop to collect file- and url-open
AppleEvents. Those get converted to strings and stuffed into sys.argv.
When that is done we continue starting the application.
This is a workaround to convert scripts that expect filenames on the
command-line to work in a GUI e... | nCoda/macOS | .eggs/py2app-0.14-py2.7.egg/py2app/bootstrap/argv_emulation.py | Python | gpl-3.0 | 9,175 |
# Copyright (c) 2016 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of G... | candlepin/subscription-manager | src/rhsmlib/dbus/facts/base.py | Python | gpl-2.0 | 2,557 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsLayoutPageCollection
.. note:: 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... | dwadler/QGIS | tests/src/python/test_qgslayoutpagecollection.py | Python | gpl-2.0 | 39,222 |
print("This is mik")
print("This is mik")
print("This is mik")
| michaelshone/Eclipse-Git | src/test.py | Python | gpl-2.0 | 65 |
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from future.builtins.disabled import *
import sys
import fnmatch
import re
import os
import argparse
from argparse import ArgumentTypeError
import traceback
from . import comman... | dahuebi/vsmomi | vsmomi/command_line_parser.py | Python | apache-2.0 | 8,148 |
# Copyright 2022 Google LLC.
#
# 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, ... | google/flaxformer | flaxformer/architectures/longt5/relative_position_biases_general.py | Python | apache-2.0 | 6,812 |
# Bzrflag
# Copyright 2008-2011 Brigham Young University
#
# This file is part of Bzrflag.
#
# Bzrflag 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 l... | andrewls/bzrflag | bzrflag/constants.py | Python | gpl-3.0 | 2,312 |
import random
import logging
from datetime import datetime, timedelta
from django.utils.datastructures import MergeDict
from django.conf import settings
logger = logging.getLogger("multidb.replication.mapper")
class ReplicationQueryError(Exception):
pass
class TableDoesNotExist(ReplicationQueryError):
def ... | woome/multidb | multidb/replication/mapper.py | Python | bsd-3-clause | 10,293 |
"""
Sane parameters for stats.distributions.
"""
distcont = [
['alpha', (3.5704770516650459,)],
['anglit', ()],
['arcsine', ()],
['argus', (1.0,)],
['beta', (2.3098496451481823, 0.62687954300963677)],
['betaprime', (5, 6)],
['bradford', (0.29891359763170633,)],
['burr', (10.5, 4.3)],
... | nmayorov/scipy | scipy/stats/_distr_params.py | Python | bsd-3-clause | 4,526 |
#!/usr/bin/env python
from setuptools import setup
setup(name='txsocksx',
version='0.0.2',
packages=['txsocksx'],
install_requires=[
"parsley",
"Twisted>=12.0"
]
)
| pde/torbrowser-launcher | lib/txsocksx-0.0.2/setup.py | Python | mit | 196 |
import matplotlib.pyplot as plt
import numpy as np
import dpp
import math
t = 0.005
x = []
y = []
for i in range(0, int(1/t)):
a = 2*math.pi*float(i)*t
x.append(math.cos(a))
y.append(math.sin(a))
x = np.array(x)
y = np.array(y)
k = 50
idx = np.arange(x.size)
np.random.shuffle(idx)
x_uniform = x[idx[:k]]
y_unif... | bdol/bdol-ml | dpp/unit_ring.py | Python | lgpl-3.0 | 1,112 |
"""A cleanup tool for HTML.
Removes unwanted tags and content. See the `Cleaner` class for
details.
"""
import re
import copy
try:
from urlparse import urlsplit
except ImportError:
# Python 3
from urllib.parse import urlsplit
from lxml import etree
from lxml.html import defs
from lxml.html import fromstr... | cortext/crawtextV2 | ~/venvs/crawler/lib/python2.7/site-packages/lxml/html/clean.py | Python | mit | 25,851 |
from jflow.utils.observer import lazyobject
from jflow.db.trade.models import Position
from jflow.utils.tx import runInThread
from logger import log, PositionObjectException
import basecache
def listpop(li, elem):
idx = 0
for el in li:
if el == elem:
return li.pop(idx)
... | lsbardel/flow | flow/db/trade/aggregate/basejson.py | Python | bsd-3-clause | 4,983 |
#!/usr/bin/env python
#
# -*- coding: utf-8 -*-
#
# gui_helper.py -
# Copyright 2013 Tomas Hozza <thozza@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the Lic... | thozza/energy-track | energytrack/gui/gui_helper.py | Python | gpl-3.0 | 6,070 |
# Copyright 2018 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/estimator | tensorflow_estimator/python/estimator/head/multi_class_head_test.py | Python | apache-2.0 | 65,133 |
"""Support for ZoneMinder."""
import logging
import voluptuous as vol
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
from homeassistant.components.camera import DOMAIN as CAMERA_DOMAIN
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.components.... | tchellomello/home-assistant | homeassistant/components/zoneminder/__init__.py | Python | apache-2.0 | 5,423 |
# exact numbers
# mensured numbers
# significant figures
float = 0.0
import math
class unit_type:
def __init__(self, name='', symbol='', val=1.0):
self.name = name
self.symbol = symbol
self.val = val
def unit_pow(self, power=1):
#km^2, km^3 etc.
self.power = power
if power == 2:
self.... | defm03/chemistry-cc | src/units.py | Python | gpl-3.0 | 824 |
# pylint: skip-file
#
# 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 "Licen... | lukecwik/incubator-beam | sdks/python/apache_beam/ml/gcp/visionml.py | Python | apache-2.0 | 10,697 |
from numpy import *
from pylab import *
from datetime import datetime, time
def selecc_data(data, tshk):
time = data[0]
rate = data[1]
day = 86400. # [seg]
utc = datetime(1970, 1, 1, 0, 0, 0, 0)
tshk_utc = (tshk - utc).total_seconds()
ti = tshk_utc - 10.*day # [seg] utc
tf = tshk_utc + 30.*day
cond = (t... | jimsrc/seatos | sheaths/src/forbush/funcs.py | Python | mit | 1,698 |
# 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.
# -----------------------------------------------------------------------... | Azure/azure-sdk-for-python | sdk/monitor/azure-monitor-query/azure/monitor/query/aio/__init__.py | Python | mit | 492 |
from modularodm import Q
from website.app import init_app
from website.models import User, Node, Institution
from website.settings import KEEN as keen_settings
from keen.client import KeenClient
def get_institutions():
institutions = Institution.find(Q('_id', 'ne', None))
return institutions
def get_count_... | emetsger/osf.io | scripts/analytics/institutions.py | Python | apache-2.0 | 3,820 |
# ------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -------------------------------------------------------------------------
from azure.... | Azure/azure-sdk-for-python | sdk/digitaltwins/azure-digitaltwins-core/azure/digitaltwins/core/_utils.py | Python | mit | 1,990 |
def mySearch(theList, anItem):
return recursiveSearch(theList, 0, len(theList)-1, anItem)
def recursiveSearch(theList, left, right, anItem):
if right < left:
return False
else:
mid = (right+left)//2
if theList[mid] == anItem:
return True
elif anItem > theList[mid... | dmusican/Elegit | Example merge conflicts/test2/sort 2.py | Python | mit | 739 |
import os
import logging
import ConfigParser
from framework.dependency_management.dependency_resolver import BaseComponent
from framework.dependency_management.interfaces import DBConfigInterface
from framework.lib.exceptions import InvalidConfigurationReference
from framework.db import models
class ConfigDB(BaseCom... | DarKnight24/owtf | framework/db/config_manager.py | Python | bsd-3-clause | 5,750 |
from twython import Twython
import sys
import os
from collections import Counter
import re
import argparse # requires 2.7
import time
import json
import codecs
import pprint
from image_generator import ImageGenerator
import textwrap
import time
class TweepyHelper:
def __init__(self, keyfile):
f = open(k... | timokoola/randomtwittersnippets | image_tweet.py | Python | apache-2.0 | 1,950 |
"""
This is the common settings file, intended to set sane defaults. If you have a
piece of configuration that's dependent on a set of feature flags being set,
then create a function that returns the calculated value based on the value of
FEATURES[...]. Modules that extend this one can change the feature
configuration ... | TangXT/GreatCatMOOC | lms/envs/common.py | Python | agpl-3.0 | 36,538 |
# -*- coding: utf-8 -*-
import os
import kobo.cli
import kobo.admin
class Start_Worker_Task(kobo.cli.Command):
"""create a worker task module in the current directory"""
enabled = True
def options(self):
self.parser.usage = "%%prog %s [options] <task_name>" % self.normalized_name
self.... | pombredanne/https-git.fedorahosted.org-git-kobo | kobo/admin/commands/cmd_start_worker_task.py | Python | lgpl-2.1 | 815 |
swap_keys_values=lambda d:{v:k for k,v in d.items()}
| m1cr0man/OneLineWonders | CA117/Lab_7/swap_42.py | Python | mit | 53 |
import path_util as path
my_cost_map = path.make_grid(40,20,1) #default cost of 1
start_pos = [0,10]
end_pos = [39,10]
# start_pos = [10,0]
# end_pos = [10,19]
#my_cost_map[10][15] = -1
# quick_list = [(4,3,-1),(3,4,-1),(2,3,-1),(3,2,-1)]
# path.apply_list_of_tuples_to_cost_map(quick_list,my_cost_map)
path.two_wall... | NortySpock/aStar-python-library | main.py | Python | mit | 998 |
# Copyright 2015 Open vStorage NV
#
# 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 writ... | tcpcloud/openvstorage | webapps/api/backend/views/licenses.py | Python | apache-2.0 | 3,135 |
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 29 19:27:26 2016
@author: Federico Barabas
"""
import os
from tkinter import Tk, filedialog
def getFilename(title, types, initialdir=None):
try:
root = Tk()
root.withdraw()
filename = filedialog.askopenfilename(title=title, filetypes=types,
... | fedebarabas/tormenta | tormenta/utils.py | Python | gpl-3.0 | 1,079 |
import math
import os
import numpy as np
def import_fluid():
import paddle.v2.fluid as fluid
return fluid
def layer(op):
'''Decorator for composable network layers.'''
def layer_decorated(self, *args, **kwargs):
# Automatically set a name if not provided.
name = kwargs.setdefault('n... | Superjom/models-1 | fluid/image_classification/caffe2fluid/kaffe/paddle/network.py | Python | apache-2.0 | 8,464 |
#! /usr/bin/env python
"""A Python debugger."""
# (See pdb.doc for documentation.)
import sys
import linecache
import cmd
import bdb
from repr import Repr
import os
import re
# Create a custom safe Repr instance and increase its maxstring.
# The default of 30 truncates error messages too easily.
_repr = Repr()
_rep... | remybaranx/qtaste | tools/jython/lib/Lib/pdb.py | Python | gpl-3.0 | 31,033 |
from django.core.management.base import BaseCommand, CommandError
from corehq.elastic import get_es_new
from corehq.pillows.utils import get_all_expected_es_indices
class Command(BaseCommand):
help = "Update dynamic settings for existing elasticsearch indices."
def add_arguments(self, parser):
parse... | dimagi/commcare-hq | corehq/ex-submodules/pillowtop/management/commands/update_es_settings.py | Python | bsd-3-clause | 2,244 |
#!/usr/bin/python3
import os
import os.path
import sqlite3
from argparse import ArgumentParser
from operator import itemgetter
from math import log
from sys import float_info
import utils
from myconfig import MyConfig
from dirwalk import walkIndex
config = MyConfig()
#change cwd to the word recognizer directory
word... | libpinyin/trainer | newword.py | Python | gpl-2.0 | 7,810 |
from collections import OrderedDict
from django.http import HttpResponse
import simplejson
class JSONMixin(object):
"""This class was designed to be inherited and used to return JSON objects from an Ordered Dictionary
"""
## Ordered Dictionary used to create serialized JSON object
# return_rderedDict(... | vecnet/vnetsource | datawarehouse/mixins.py | Python | mpl-2.0 | 1,115 |
from django.utils.encoding import force_str
from infotv.views import InfoTvView
def test_view(rf):
# This is a silly test.
request = rf.get("/")
response = InfoTvView.as_view()(request=request, event="basjdnasdf")
assert "var Options = {" in force_str(response.content)
| kcsry/infotv | infotv_test/tests/test_view.py | Python | mit | 290 |
from . import test_ir_rule
| mozaik-association/mozaik | ir_rule_child_of/tests/__init__.py | Python | agpl-3.0 | 27 |
# -*- coding: utf-8 -*-
from pysped.xml_sped import *
from pysped.cte.leiaute import ESQUEMA_ATUAL_VERSAO_300 as ESQUEMA_ATUAL
import os
from .CTe_300 import CTe
DIRNAME = os.path.dirname(__file__)
class InfInutEnviado(XMLNFe):
def __init__(self):
super(InfInutEnviado, self).__init__()
self.Id ... | thiagopena/PySPED | pysped/cte/leiaute/inutCTe_300.py | Python | lgpl-2.1 | 10,021 |
from __future__ import print_function
from __future__ import absolute_import
# for localized messages
from . import _
from Components.ActionMap import ActionMap
from Components.config import config, ConfigClock, ConfigEnableDisable, configfile, ConfigNumber, ConfigSubsection, ConfigSelection, ConfigSubDict, ConfigText... | LraiZer/RadiotimesXmltvEmulator | enigma2/python/plugin.py | Python | lgpl-2.1 | 16,108 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "quizproject.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| pbx/django-quiz | manage.py | Python | mit | 254 |
#!/usr/bin/env python
"""
make-flaskapp
~~~~~~~~~~~~~
Little helper script that helps creating new flask applications.
:copyright: (c) 2014 by Shipeng Feng.
:license: BSD, see LICENSE for more details.
"""
from __future__ import with_statement
import os
import sys
import getpass
from datetime impo... | fengsp/flask-application-wizard | make-flaskapp.py | Python | bsd-3-clause | 15,603 |
from __future__ import print_function
import copy
import numpy
import theano
from theano import Variable, Constant
from theano import tensor
from theano.compile import SharedVariable
from theano.sandbox.cuda.type import CudaNdarrayType
try:
# We must do those import to be able to create the full doc when nvcc
... | valexandersaulys/airbnb_kaggle_contest | venv/lib/python3.4/site-packages/Theano-0.7.0-py3.4.egg/theano/sandbox/cuda/var.py | Python | gpl-2.0 | 8,963 |
# coding=utf-8
# Copyright 2018 The Tensor2Tensor 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... | mlperf/training_results_v0.5 | v0.5.0/google/research_v3.32/gnmt-tpuv3-32/code/gnmt/model/t2t/tensor2tensor/utils/mlperf_tags.py | Python | apache-2.0 | 12,883 |
# (void)walker command interface
# Copyright (C) 2012 David Holm <dholmster@gmail.com>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any... | dholm/voidwalker | voidwalker/application/commands/voidwalker.py | Python | gpl-3.0 | 1,149 |
# 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... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/tensorflow/contrib/distributions/python/ops/bijectors/conditional_bijector_impl.py | Python | bsd-2-clause | 2,294 |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Description:
Say you have an array for which the ith element is the price of a given stock on day i.
If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), design an algorithm to find the maximum profit.
... | Jan-zou/LeetCode | python/Array/121_best_time_to_buy_and_sell_stock.py | Python | mit | 1,019 |
from django.conf import settings
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.contrib.sites.shortcuts import get_current_site
from django.core.mail import send_mail
from django.shortcuts import redirect
from django.template.loader import render_to_string
from django.urls import reverse_laz... | coffeestats/coffeestats-django | coffeestats/caffeine_oauth2/views.py | Python | mit | 6,196 |
class GoolFileWriterForPY:
def __init__(self,name):
self.name = name ;
def getName(self):
return self.name;
| librecoop/GOOL | src/gool/generator/python/matching/io/GoolFileWriterForPY.py | Python | gpl-3.0 | 125 |
"""Spectral biclustering algorithms.
Authors : Kemal Eren
License: BSD 3 clause
"""
from abc import ABCMeta, abstractmethod
import numpy as np
from scipy.linalg import norm
from scipy.sparse import dia_matrix, issparse
from scipy.sparse.linalg import eigsh, svds
from . import KMeans, MiniBatchKMeans
from ..base im... | chrsrds/scikit-learn | sklearn/cluster/bicluster.py | Python | bsd-3-clause | 20,471 |
"""
Manages the read-eval-print loop
"""
from __future__ import unicode_literals, print_function
from prompt_toolkit import prompt
from prompt_toolkit.history import FileHistory
from pygments.lexers.matlab import MatlabLexer
from colorama import Fore, init
from prompt_toolkit.contrib.completers import WordCompleter
fr... | thuo/bc-6-matlabette | matlabette/repl.py | Python | mit | 5,529 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2015 - Present Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute i... | JayVora-SerpentCS/connector-redmine | models/redmine_binding.py | Python | agpl-3.0 | 1,531 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# 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... | googleapis/python-compute | google/cloud/compute_v1/services/target_tcp_proxies/transports/base.py | Python | apache-2.0 | 7,613 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.