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 |
|---|---|---|---|---|---|
import sys
from collections import deque
class TreeNode(object):
def __init__(self, data=None):
self.data = data
self.left = self.right = None
for line in sys.stdin:
nodes = line.strip().split()
root = TreeNode()
for e in nodes:
print(e)
e = e.strip('()')
... | Blimeo/Java | out/production/matthew/Contests/ICPC/Volume1/p122.py | Python | apache-2.0 | 1,315 |
"""
hashdd_file_absolute_path.py
@brad_anton
License:
Copyright 2015 hashdd.com
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 app... | hashdd/pyhashdd | hashdd/features/hashdd_file_absolute_path.py | Python | apache-2.0 | 837 |
import datetime
import logging
import os
import unittest
from unittest.mock import patch, MagicMock
import requests_mock
from freezegun import freeze_time
from tests.helper_func import get_fixture, load_fixture_config
from yatcobot.client import TwitterClient, TwitterClientException, TwitterClientRetweetedException, ... | buluba89/Yatcobot | tests/test_twitterclient.py | Python | gpl-2.0 | 28,404 |
#: Operation ids
operations = {}
operations["vote"] = 0
operations["comment"] = 1
operations["transfer"] = 2
operations["transfer_to_vesting"] = 3
operations["withdraw_vesting"] = 4
operations["limit_order_create"] = 5
operations["limit_order_cancel"] = 6
operations["feed_publish"] = 7
operations["convert"] = 8
operati... | xeroc/piston-lib | pistonbase/operationids.py | Python | mit | 2,051 |
import itertools
import os
import random
from collections import defaultdict
from datetime import datetime
from typing import Any, Dict, List, Mapping, Sequence, Tuple
import bmemcached
import orjson
from django.conf import settings
from django.contrib.sessions.models import Session
from django.core.files.base import ... | hackerkid/zulip | zilencer/management/commands/populate_db.py | Python | apache-2.0 | 45,898 |
# -*- coding: utf-8 -*-
from abc import ABC
from copy import deepcopy
from dataclasses import asdict, dataclass
from datetime import datetime, timezone
from enum import Enum, unique
from typing import Optional
__author__ = 'ft'
class SessionNSBase(ABC):
def to_dict(self):
return asdict(self)
@class... | SUNET/eduid-common | src/eduid_common/session/namespaces.py | Python | bsd-3-clause | 3,156 |
# 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... | Yam-cn/potato | engine/optimizer/server.py | Python | apache-2.0 | 2,635 |
# User creation text spoke
#
# Copyright (C) 2013-2014 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, or (at your option) any later version.
# This program is distrib... | jkonecny12/anaconda | pyanaconda/ui/tui/spokes/user.py | Python | gpl-2.0 | 11,266 |
# -*- coding: utf-8 -*-
from module.plugins.internal.Account import Account
class BitshareCom(Account):
__name__ = "BitshareCom"
__type__ = "account"
__version__ = "0.19"
__status__ = "testing"
__description__ = """Bitshare account plugin"""
__license__ = "GPLv3"
__authors__ ... | Guidobelix/pyload | module/plugins/accounts/BitshareCom.py | Python | gpl-3.0 | 1,192 |
import os
from pathlib import Path
from types import MethodType
from typing import Type
from unittest.mock import Mock
import pytest
from baby_steps import given, then, when
from vedro import Scenario
from vedro.core import ScenarioResult, StepResult, VirtualScenario, VirtualStep
def make_scenario_path(path: str = ... | nikitanovosibirsk/vedro | tests/core/test_scenario_result.py | Python | apache-2.0 | 6,232 |
from django.shortcuts import get_object_or_404
from django.urls import reverse
from rest_framework import generics, status
from rest_framework.views import APIView
from rest_framework.response import Response
from zentral.core.events.base import EventRequest
from zentral.utils.drf import DefaultDjangoModelPermissions, ... | zentralopensource/zentral | zentral/contrib/wsone/api_views.py | Python | apache-2.0 | 1,602 |
from flask import Blueprint, render_template, abort
from jinja2 import TemplateNotFound
simple_page = Blueprint('simple_page', __name__,
template_folder='templates')
@simple_page.route('/', defaults={'page': 'index'})
@simple_page.route('/<page>')
def show(page):
try:
return render... | jackTheRipper/iotrussia | web_server/lib/flask-master/examples/blueprintexample/simple_page/simple_page.py | Python | gpl-2.0 | 402 |
"""Support for interface with a Bose Soundtouch."""
from __future__ import annotations
import logging
import re
from libsoundtouch import soundtouch_device
from libsoundtouch.utils import Source
import voluptuous as vol
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
from homeass... | rohitranjan1991/home-assistant | homeassistant/components/soundtouch/media_player.py | Python | mit | 17,069 |
import sys
import smtplib
from os.path import basename
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.utils import COMMASPACE, formatdate
def send_mail(files=None):
send_to = ["discoalerts@gmail.com"]
send_from ... | romain-fontugne/disco | src/emailWithAttachment.py | Python | gpl-3.0 | 1,191 |
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
import pkg1.p1a, pkg1.p1b, pkg1.sub
import pkg2.p2a, pkg2.p2b
import othermods.othera, othermods.otherb
import othermods.sub.osa, othermods.sub.osb
| blueyed/coveragepy | tests/modules/usepkgs.py | Python | apache-2.0 | 304 |
# -*- coding: utf-8 -*-
import unittest
from three_sum_closest import three_sum_closest
class Test3SumClosest(unittest.TestCase):
def test_three_sum_closest(self):
tests = [
([-1,0,1,0], 0, 0),
([-1,-1,1,0], -1, -1),
([1, 2, 3, 4], 5, 6),
([1, 1, 1, 0], 100... | topliceanu/learn | interview/leetcode/test_three_sum_closest.py | Python | mit | 658 |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
import logging
import MySQLdb
from PySide2.QtCore import QThread,Signal,Slot
from database.manager import DatabaseManager
from util.util import Util
log = logging.getLogger(__name__)
class PreloadThread(QThread):
_instance = None
updateLabelSignal = Signal(str)
... | celtas/NFCAttendancePy | nap/main/preload.py | Python | gpl-3.0 | 2,661 |
import pprint
def period_ns(freq):
return 1e9/freq
def csr_map_update(csr_map, csr_peripherals):
csr_map.update(dict((n, v)
for v, n in enumerate(csr_peripherals, start=(max(csr_map.values()) + 1) if csr_map else 0)))
def csr_map_update_print(csr_map, csr_peripherals):
print()
print("-"*75... | mithro/HDMI2USB-litex-firmware | targets/utils.py | Python | bsd-2-clause | 1,695 |
"""
Get
---
.. moduleauthor: Jachym Cepicky
"""
# Author: Jachym Cepicky
# http://les-ejk.cz
# Lince:
#
# Web Processing Service implementation
# Copyright (C) 2006 Jachym Cepicky
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as ... | jachym/PyWPS-SVN | pywps/Parser/Get.py | Python | gpl-2.0 | 6,535 |
# -*- coding: utf-8 -*-
# Copyright 2017 GIG Technology 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... | rogerthat-platform/rogerthat-backend | src-test/rogerthat_tests/mobicage/capi/test_feature_version.py | Python | apache-2.0 | 1,999 |
#!/usr/bin/python2.4
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://w... | marcellodesales/svnedge-console | ext/windows/pkg-toolkit/pkg/vendor-packages/pkg/actions/legacy.py | Python | agpl-3.0 | 6,079 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown Copyright 2012-8 Met Office.
#
# This file is part of Rose, a framework for meteorological suites.
#
# Rose is free software: you can redistribute it and/or modify
# it under the terms of the GNU ... | aosprey/rose | lib/python/rose/config_editor/valuewidget/array/entry.py | Python | gpl-3.0 | 21,099 |
# -*- 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 the terms of the GNU General Public License as published by
# the Free Software Foundation; eit... | sadig/DC2 | components/dc2-admincenter/dc2/admincenter/lib/controllers/jsoncontroller.py | Python | gpl-2.0 | 1,430 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from time import sleep
import urlparse
from ConfigParser import ConfigParser
import pickle
import requests
def config():
global video_format
global resolution
configr = ConfigParser()
configr.read('settings.ini')
quality = configr.ge... | einstein95/crunchy-xml-decoder | crunchy-xml-decoder/altfuncs.py | Python | gpl-2.0 | 7,465 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Sebastian Kornehl <sebastian.kornehl@asideas.de>
#
# This file is part of Ansible
#
# Ansible 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 versi... | CenturylinkTechnology/ansible-modules-extras | monitoring/datadog_monitor.py | Python | gpl-3.0 | 12,600 |
import win32api
import Tkinter
import win32con
from gui.widgets import OptionMenu, Buttons, Textboxes
from gui.widgets.frames import Frame
from gui.widgets.frames.tabs import DisableDeleteNotebookTab
import constants as c
class WindowTab(DisableDeleteNotebookTab.Disable):
def __init__(self, parent, row, column,... | kahvel/VEP-BCI | src/gui/widgets/frames/tabs/WindowTab.py | Python | mit | 3,034 |
"""Moira list tasks"""
import logging
from django.contrib.auth import get_user_model
from channels.membership_api import update_memberships_for_managed_channels
from moira_lists.models import MoiraList
from moira_lists import moira_api
from open_discussions.celery import app
User = get_user_model()
log = logging.getL... | mitodl/open-discussions | moira_lists/tasks.py | Python | bsd-3-clause | 1,210 |
"""User-defined positioned parser example.
This shows how a new parser can be defined outside Parsita and used in tandem
with the built-in parsers. The ``positioned`` parser updates the value
returned from an arbitrary parser with the position in the input that was
consumed by that parser.
"""
from abc import abstrac... | drhagen/parsita | examples/positioned.py | Python | mit | 3,313 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
import sys
PY3 = False
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
if PY3:
import urllib.parse as urlparse # Es muy lento en PY2. En PY3 es nativo
else:
import... | alfa-addon/addon | plugin.video.alfa/channels/vjav.py | Python | gpl-3.0 | 7,630 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 MicroEra s.r.l.
# (<http://www.microera.it>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License... | appendif/microera | product_private_price/__init__.py | Python | agpl-3.0 | 1,045 |
# -*- coding: utf-8 -*-
# Django settings for layer zero pinax project.
import os.path
import posixpath
import pinax
PINAX_ROOT = os.path.abspath(os.path.dirname(pinax.__file__))
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
PYCON_YEAR = "2011"
# tells Pinax to use the default theme
PINAX_THEME = "defau... | mitsuhiko/pycon | pycon_project/settings.py | Python | bsd-3-clause | 6,646 |
#!/usr/bin/env python
"""
Interface with wcs.
Adapted from fermipy.skymap
"""
__author__ = "Alex Drlica-Wagner"
import numpy as np
from astropy.wcs import WCS
from astropy.io import fits
from astropy.coordinates import SkyCoord
def create_wcs(skydir, coordsys='CEL', projection='AIT',
cdelt=1.0, crpix... | kadrlica/dmsky | dmsky/utils/wcs.py | Python | mit | 3,091 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) Copyright 2012 Andreas Hausmann
# This file is part of TGSBot.
# Permission to copy or use is limited. Please see LICENSE for information.
#
"""A twisted client that serves as playing bot for TGS.
Based on client/twisted-client1.py.
Example:
./tgsBot.py -P8081 ... | Watzmann/TGSBot | testBot.py | Python | gpl-3.0 | 4,170 |
# coding=utf-8
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import os
from pex.interpreter import PythonInterpreter
from pex.pex import PEX
from pex... | twitter/pants | src/python/pants/backend/python/tasks/gather_sources.py | Python | apache-2.0 | 3,731 |
import unittest
from hamcrest import assert_that, equal_to
from mock import MagicMock, call
from mac_os_scripts.set_user_account_logo import LocalUserAccountLogoSetter
from mac_os_scripts_tests.test_common import _NO_OUTPUT
class LocalUserAccountLogoSetterTest(unittest.TestCase):
def setUp(self):
self._... | initialed85/mac_os_scripts | mac_os_scripts_tests/set_user_account_logo_test.py | Python | mit | 2,865 |
import copy
import time
import numpy
import numpy.random
import theano
import theano.tensor as T
from theano.tensor.shared_randomstreams import RandomStreams
SharedCPU = theano.tensor.sharedvar.TensorSharedVariable
try:
SharedGPU = theano.sandbox.cuda.var.CudaNdarraySharedVariable
except:
SharedGPU = SharedCPU... | hantek/NeuroBricks | neurobricks/train.py | Python | bsd-3-clause | 54,936 |
from django.db import IntegrityError
from rest_framework import viewsets, status
from rest_framework.response import Response
from rest_framework.status import HTTP_404_NOT_FOUND, HTTP_400_BAD_REQUEST
from treeherder.model.models import JobType, Push, Repository, InvestigatedTests
from treeherder.webapp.api.serializer... | jmaher/treeherder | treeherder/webapp/api/investigated_test.py | Python | mpl-2.0 | 2,969 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Comunitea Servicios Tecnológicos All Rights Reserved
# $Omar Castiñeira Saavedra <omar@comunitea.com>$
#
# This program is free software: you can redistribute it and/or modify
# it u... | jgmanzanas/CMNT_004_15 | project-addons/purchase_advance_payment/__openerp__.py | Python | agpl-3.0 | 1,575 |
##############################################################################
#
# Copyright (C) 2011 - 2013 Therp BV (<http://therp.nl>).
# Copyright (C) 2011 Smile (<http://smile.fr>).
# Copyright (C) 2014 Acysos S.L. (<http://acysos.com>).
# @author: Ignacio Ibeas <ignacio@acysos.com>
# All Rights Res... | otherway/sepa-tools | account_payment_direct_debit/__openerp__.py | Python | agpl-3.0 | 2,442 |
from social_django.admin import UserSocialAuthOption, NonceOption, AssociationOption
| cjltsod/python-social-auth | social/apps/django_app/default/admin.py | Python | bsd-3-clause | 85 |
# http://www.asterank.com/skymorph
#This API wraps NASA's SkyMorph archive in a RESTful JSON interface. Currently, it provides observation and image data from the NEAT survey.
from bowshock.helpers import bowshock_logger, dispatch_http_get
logger = bowshock_logger()
def search_target_obj(target):
'''
Query ... | danwagnerco/bowshock | bowshock/skymorph.py | Python | gpl-2.0 | 2,047 |
from pychecker2 import TestSupport
from pychecker2 import VariableChecks
class UnknownTestCase(TestSupport.WarningTester):
def testUnknown(self):
self.warning('def f(): print a\n',
1, VariableChecks.UnknownCheck.unknown, 'a')
self.silent('def f():\n'
' a =... | lavjain/incubator-hawq | tools/bin/pythonSrc/pychecker-0.8.18/pychecker2/utest/unknown.py | Python | apache-2.0 | 1,029 |
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 30 11:37:59 2016
@author: AF
"""
import ode as solving_ode
import math
import matplotlib.pyplot as plt
def correct(string,y_t): ##### delete all the data of (x,y) where y<0
x_record = string[0][-1]
y_record = y_t
while True:
if (string[1][-... | 1412kid/computationalphysics_n2014301020035 | Chapter2/chapter2_2.10.py | Python | mit | 4,276 |
#!/usr/bin/python3
#This script will determine the season and episode number of a TV show given the Title and episode Subtitle.
#If it cannot find the correct episode from the subtitle, the airdate will alternatively be used.
import requests
import json
def get_sonarr_id(sonarr_ip, sonarr_port, sonarr_api, tvdb_id):
... | CTetford/Tvheadend-scripts | modules/sonarr_functions.py | Python | gpl-3.0 | 2,291 |
"""
Tests for StopWordFactory
"""
import os
from tempfile import NamedTemporaryFile
from unittest import TestCase
from mots_vides.stop_words import StopWord
from mots_vides.factory import StopWordFactory
from mots_vides.exceptions import StopWordError
class StopWordFactoryTestCase(TestCase):
def setUp(self):
... | Fantomas42/mots-vides | mots_vides/tests/factory.py | Python | bsd-3-clause | 4,559 |
#!/usr/bin/python
# Copyright (C) 2012 Sibi <sibi@psibi.in>
#
# This file is part of pyuClassify.
#
# pyuClassify 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
# (... | psibi/pyuClassify | uclassify/uclassify_eh.py | Python | gpl-3.0 | 1,589 |
# Copyright (c) 2012 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | yuewko/neutron | neutron/api/v2/base.py | Python | apache-2.0 | 32,611 |
from openmdao.main.api import Component, Assembly
from openmdao.main.datatypes.api import Float, Int, Array
from openmdao.lib.drivers.api import NewtonSolver
import numpy as np
class PolyScalableProblem(Assembly):
"""
Multivariable polynomial test problem
m : number of variables (also the number of compo... | HyperloopTeam/FullOpenMDAO | lib/python2.7/site-packages/openmdao.lib-0.13.0-py2.7.egg/openmdao/lib/optproblems/polyscale.py | Python | gpl-2.0 | 3,183 |
import re
REGEX_START = '^'
REGEX_END = '.*'
def create_regex(search_text):
return REGEX_START + re.escape(search_text) + REGEX_END
def add_matches_to_list(matches, list_):
for m in matches:
if m not in list_:
list_.append(m)
# def calculate_symmetric_difference_between_tw... | fkie-cad/iva | matching/cpe_matcher_utils.py | Python | lgpl-3.0 | 1,514 |
# Copyright 2010 Steven Robertson
# 2012 Christoph Reiter
# 2017 Nick Boultbee
# 2018 Olli Helin
#
# 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 ... | Mellthas/quodlibet | quodlibet/ext/events/equalizer.py | Python | gpl-2.0 | 13,707 |
# Importing standard libraries
import sys
'''
Function to print the array with numbers in a space seperated format
'''
def printArray(a,delimiter):
arrayStr = ""
for i in a:
arrayStr += str(i) + delimiter
arrayStr.rstrip()
print arrayStr
'''
Space Efficient Counting sort version. ... | tejasnikumbh/Algorithms | Searching/MissingNumbers.py | Python | bsd-2-clause | 2,224 |
#!/usr/bin/env python2
#
# vocab.py - allows the user to enter word and meaning
#
# Copyright (c) 2015 Harsimran Singh <me@harsimransingh.in>
#
# 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, ei... | harsimrans/vocab-builder | vocab.py | Python | gpl-3.0 | 2,800 |
"""
WSGI config for inflation project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SET... | lexieheinle/inflation-vs-unemployment | inflation/inflation/wsgi.py | Python | mit | 395 |
from django.contrib.comments.models import Comment
from . import CommentTestCase
from ..models import Author, Article
class CommentModelTests(CommentTestCase):
def testSave(self):
for c in self.createSomeComments():
self.assertNotEqual(c.submit_date, None)
def testUserProperties(self):
... | denisenkom/django | tests/comment_tests/tests/test_models.py | Python | bsd-3-clause | 2,160 |
import copy
import itertools
from typing import (
Any,
Callable,
Dict,
Iterable,
Iterator,
List,
MutableSequence,
Optional,
Tuple,
Type,
Union,
)
from ._utils import (
ValueKind,
_is_missing_literal,
_is_none,
_resolve_optional,
format_and_raise,
get_... | omry/omegaconf | omegaconf/listconfig.py | Python | bsd-3-clause | 23,947 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "PolyTrend", cycle_length = 5, transform = "None", sigma = 0.0, exog_count = 100, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_None/trend_PolyTrend/cycle_5/ar_/test_artificial_32_None_PolyTrend_5__100.py | Python | bsd-3-clause | 259 |
# 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 ... | Azure/azure-sdk-for-python | sdk/graphrbac/azure-graphrbac/azure/graphrbac/models/check_group_membership_result_py3.py | Python | mit | 1,366 |
# -*- coding: utf-8 -*-
# Copyright (C) 2009 Axel Tillequin (bdcht3@gmail.com)
# This code is part of Amoco
# published under GPLv2 license
import gtk
import math
from goocanvas import *
# connectors CX are embedded inside node views. These objects are drawn on
# the node's surface and exists only as sub-objects of... | bdcht/amoco | amoco/ui/graphics/gtk_/items.py | Python | gpl-2.0 | 14,955 |
#!/usr/bin/env python
from pymongo import MongoClient
import pymongo
HOST = "mongos-3sh-ex4q:27017,mongos-3sh-lenv:27017,mongos-3sh-ql7j:27017"
c = MongoClient('mongodb://'+HOST)
dbname = "google"
task = "task_events"
avg_cpu = "average_cpu"
mm_cpu = "maxmin_cpu"
med_cpu = "median_cpu"
ratio = "ratio"
avg = "aver... | elainenaomi/sciwonc-dataflow-examples | sbbd2016/experiments/4-mongodb-rp-3sh/10_workflow_full_10files_primary_3sh_annot_with_proj_3s_hs/init_0/DataStoreInit.py | Python | gpl-3.0 | 2,180 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 New Dream Network, LLC (DreamHost)
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/li... | SripriyaSeetharam/tacker | tacker/agent/linux/external_process.py | Python | apache-2.0 | 3,284 |
"""This example demonstrates how to subscribe to topics with WAMP."""
import logging
import sys
from asphalt.core import ContainerComponent, Context, run_application
from asphalt.wamp.context import EventContext
logger = logging.getLogger(__name__)
def subscriber(ctx: EventContext, message: str):
logger.info('... | asphalt-framework/asphalt-wamp | examples/pubsub/subscriber.py | Python | apache-2.0 | 834 |
# -*- coding: utf-8 -*-
#
# botocore documentation build configuration file, created by
# sphinx-quickstart on Sun Dec 2 07:26:23 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# Al... | pplu/botocore | docs/source/conf.py | Python | apache-2.0 | 8,523 |
#!/usr/bin/env python2.7
############################################################################
##
## Copyright (c) 2000-2015 BalaBit IT Ltd, Budapest, Hungary
## Copyright (c) 2015-2018 BalaSys IT Ltd, Budapest, Hungary
##
##
## This program is free software; you can redistribute it and/or modify
## it under th... | mochrul/zorp | tests/zorpctl/test_szig.py | Python | gpl-2.0 | 3,271 |
from __future__ import absolute_import
import warnings
from django import forms
from django.core.urlresolvers import reverse
from django.core import exceptions
from django.db.models import Q
from django.utils.translation import pgettext, ugettext_lazy as _, ugettext
from django.utils.http import int_to_base36
from dj... | joebos/django-allauth | allauth/account/forms.py | Python | mit | 18,730 |
# Time: O(nlogn)
# Space: O(n)
import collections
class Solution:
# @param {string[]} strings
# @return {string[][]}
def groupStrings(self, strings):
groups = collections.defaultdict(list)
for s in strings: # Grouping.
groups[self.hashStr(s)].append(s)
result = []
... | kamyu104/LeetCode | Python/group-shifted-strings.py | Python | mit | 745 |
from typing import Tuple
from dash.utils import chunks, is_dict_equal
from dash.utils.sync import BaseSyncer, SyncOutcome, sync_local_to_changes, sync_local_to_set
from django.utils.timezone import now
from casepro.contacts.models import Contact, Field, Group
from casepro.msgs.models import Label, Message, Outgoing
... | rapidpro/casepro | casepro/backend/rapidpro.py | Python | bsd-3-clause | 15,169 |
### resource API
from django.core.exceptions import ObjectDoesNotExist
from django.core.files import File
from django.core.files.uploadedfile import UploadedFile
import django.dispatch
from django.contrib.auth.models import User
from mezzanine.generic.models import Keyword, AssignedKeyword
from dublincore.models import... | hydroshare/hydroshare_temp | hs_core/hydroshare/resource.py | Python | bsd-3-clause | 34,421 |
# 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 a... | obulpathi/cloud | ml/tensorflow/iris/trainer/util.py | Python | apache-2.0 | 4,441 |
from indivo.tests.internal_tests import InternalTests, enable_transactions
from indivo.models import PHA
from indivo.tests.data.record import TEST_RECORDS
from indivo.tests.data.app import TEST_USERAPPS, TEST_AUTONOMOUS_APPS
from indivo.tests.data.app import TEST_SMART_MANIFESTS, TEST_USERAPP_MANIFESTS
from indivo.tes... | sayan801/indivo_server | indivo/tests/unit/models/pha.py | Python | gpl-3.0 | 7,025 |
import os
import pickle
import sys
def main():
dbpath = sys.argv[1]
textdir = sys.argv[2]
with open(dbpath, 'rb') as f:
passages = pickle.load(f)
for p in passages:
with open(os.path.join(textdir, p.ID + '.tagged')) as f:
tokens = []
for line in f:
... | borgr/ucca | scenes/postag_passages.py | Python | gpl-3.0 | 755 |
from time import sleep
from org.myrobotlab.service import Speech
from org.myrobotlab.framework import MRLListener
# this subscribe is easy shorthand method
# Name it "speech".
speech = Runtime.create("speech","Speech")
speech.startService()
speech.setGoogleURI("http://thehackettfamily.org/Voice_api/api2.php?vo... | MyRobotLab/pyrobotlab | home/Markus/Skin.py | Python | apache-2.0 | 2,542 |
from __future__ import absolute_import
from django.contrib import messages
from django.db import models
from django.utils.translation import ugettext_lazy as _
from .exceptions import SourceFileError
def check_updated(modeladmin, request, queryset):
count = 0
for source in queryset:
try:
... | commonwealth-of-puerto-rico/libre | libre/apps/data_drivers/actions.py | Python | gpl-3.0 | 2,728 |
from optparse import make_option
from django.core.management.base import BaseCommand
from fluff.pillow import FluffPillowProcessor
from pillowtop.utils import get_pillow_by_name
class Command(BaseCommand):
option_list = BaseCommand.option_list + (make_option('--noinput',
... | qedsoftware/commcare-hq | corehq/ex-submodules/fluff/management/commands/wipe_fluff_table.py | Python | bsd-3-clause | 1,243 |
""" yluo - 05/01/2016 creation
Preprocess i2b2/VA relations to generate data files ready to used by Seg-CNN
"""
__author__= """Yuan Luo (yuan.hypnos.luo@gmail.com)"""
__revision__="0.5"
import numpy as np
import cPickle
from collections import defaultdict
import sys, re, os
import pandas as pd
import data_util as du
... | yuanluo/seg_cnn | src/cnn_preprocess.py | Python | mit | 17,257 |
import sys
import os
import shutil
import re
def remove_console(text):
return re.sub('console.(log|debug)\((.*)\);?', '', text)
me_filename = 'mediaelement'
mep_filename = 'mediaelementplayer'
combined_filename = 'mediaelement-and-player'
# BUILD MediaElement (single file)
print('building MediaElement.js')
me_fil... | seekmas/wujiayao | web/bundles/mediaelement/src/Builder.py | Python | mit | 4,545 |
# Copyright (C) 2014 Andreas M. Weller <andreas.m.weller@gmail.com>
#
# read a bedtools output file from
#
# bedtools coverage -abam Q2PL2_H01_N.bam -b TSB_148_gene_panel_HP_amplicons.bed -d > test_coverage.csv
#
# and find bases with coverage or strand_ratio below the threshold
# general modules
import pandas as pd
i... | aweller/CoverageCheck | CoverageCheck.py | Python | bsd-3-clause | 23,333 |
from __future__ import with_statement
import logging
import warnings
import django
from django.conf import settings
from django.conf.urls.defaults import patterns, url
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned, ValidationError
from django.core.urlresolvers import NoReverseMatch, rev... | VishvajitP/django-tastypie | tastypie/resources.py | Python | bsd-3-clause | 84,667 |
"""
Views for the course_mode module
"""
import decimal
from django.core.urlresolvers import reverse
from django.http import (
HttpResponseBadRequest, Http404
)
from django.shortcuts import redirect
from django.views.generic.base import View
from django.utils.translation import ugettext as _
from django.contrib.a... | nanolearning/edx-platform | common/djangoapps/course_modes/views.py | Python | agpl-3.0 | 6,033 |
# -*- coding: UTF-8 -*-
"""
This file is part of Pondus, a personal weight manager.
Copyright (C) 2008-10 Eike Nicklas <eike@ephys.de>
This program is free software licensed under the MIT license. For details
see LICENSE or http://www.opensource.org/licenses/mit-license.php
"""
import pygtk
pygtk.require('2.0')
im... | BackupTheBerlios/pondus | pondus/gui/dialog_save_file.py | Python | mit | 2,401 |
# Embedded file name: /usr/lib/enigma2/python/Components/Converter/SCServicePosition.py
import time
from Converter import Converter
from Poll import Poll
from enigma import iPlayableService
from Components.Element import cached, ElementError
class SCServicePosition(Poll, Converter, object):
TYPE_LENGTH = 0... | kingvuplus/boom2 | lib/python/Components/Converter/SCServicePosition.py | Python | gpl-2.0 | 5,213 |
# This file is part of the Hotwire Shell user interface.
#
# Copyright (C) 2007 Colin Walters <walters@verbum.org>
#
# 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 Li... | SDX2000/hotwire | setup.py | Python | gpl-2.0 | 5,200 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2005 Insecure.Com LLC.
#
# Author: Adriano Monteiro Marques <py.adriano@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... | chriskmanx/qmole | QMOLEDEV64/nmap-4.76/zenmap/zenmapCore/NmapCommand.py | Python | gpl-3.0 | 15,676 |
#!/usr/bin/env python3
from urllib.request import urlopen
from bs4 import BeautifulSoup
import pandas as pd
import html5lib
import pdb
from collections import OrderedDict
import json
import csv
import contextlib
url = "https://kenpom.com/index.php"
#url = "https://kenpom.com/index.php?y=2017" #past year testing over... | meprogrammerguy/pyMadness | scrape_stats.py | Python | mit | 2,098 |
from setuptools import setup, find_packages
setup(name='pyio',
version='0.1',
packages=find_packages(),
author='Theo Julienne',
author_email='theo.julienne+pyio@gmail',
url='https://github.com/theojulienne/pyio',
license='MIT',
include_package_data=True,
description='pyi... | theojulienne/pyio | setup.py | Python | mit | 409 |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible is distribut... | halberom/ansible | lib/ansible/modules/network/junos/junos_command.py | Python | gpl-3.0 | 8,873 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('farms', '0022_add_validators'),
]
operations = [
migrations.AlterField(
model_name='probereading',
n... | warnes/irrigatorpro | irrigator_pro/farms/migrations/0023_reorder_source_choices.py | Python | mit | 1,225 |
import socket
from math import sqrt
Host = 'localhost'
Porta = 2002
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind((Host, Porta))
while True:
mensagem, cliente = s.recvfrom(2048)
mensagem = mensagem.decode("utf-8")
mensagemsp = mensagem.split(" ")
if mensagemsp[0] == "sair":
break
else:
if mens... | felipeatr/tresa | servidor calculadora.py | Python | gpl-3.0 | 1,027 |
# Copyright 2013 Red Hat, 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 agre... | ewindisch/nova | nova/consoleauth/rpcapi.py | Python | apache-2.0 | 3,389 |
'''
multi_lock.py - this file is part of S3QL.
Copyright © 2008 Nikolaus Rath <Nikolaus@rath.org>
This work can be distributed under the terms of the GNU GPLv3.
'''
import threading
import logging
from contextlib import contextmanager
__all__ = [ "MultiLock" ]
log = logging.getLogger(__name__)
class MultiLock:
... | singleton7/main | src/s3ql/multi_lock.py | Python | gpl-3.0 | 1,885 |
# Copyright (c) 2014 EMC 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 copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | jcsp/manila | manila/share/drivers/emc/plugins/vnx/xml_api_parser.py | Python | apache-2.0 | 26,983 |
from __future__ import print_function, division, absolute_import
from timeit import default_timer as timer
import numpy as np
from numba import unittest_support as unittest
from numba import hsa, float32
class TestMatMul(unittest.TestCase):
def test_matmul_naive(self):
@hsa.jit
def matmul(A, B, ... | gdementen/numba | numba/hsa/tests/hsapy/test_matmul.py | Python | bsd-2-clause | 3,127 |
import os
class ListadoCartas(object):
"""Representa el listado de cartas que un jugador aun no visualizo. Permite llevar cuenta de las cartas
que ya se vieron, para saber cuales conviene consultar."""
def __init__(self, personajes_inicial, armas_inicial, lugares_inicial):
"""Recibe un iterable pa... | fbarrios/fiuba7540tp31c2015 | src/listado_cartas.py | Python | gpl-2.0 | 1,333 |
from inspect import signature
from functools import wraps
def typeassert(*ty_args, **ty_kwargs):
def decorate(func):
if not __debug__:
return func
sig = signature(func)
bound_types = sig.bind_partial(*ty_args, **ty_kwargs).arguments
@wraps(func)
def wrapper(*ar... | likeleon/Python | cookbook/9.7 데코레이터를 사용해서 함수에서 타입 확인 강제.py | Python | gpl-2.0 | 819 |
# -*- coding: utf-8 -*-
import xbmc, xbmcgui, xbmcplugin
import urllib2,urllib,cgi, re
import HTMLParser
import xbmcaddon
import json
import traceback
import os
from BeautifulSoup import BeautifulStoneSoup, BeautifulSoup, BeautifulSOAP
import time
import sys
import CustomPlayer
import base64
__addon__ = xbmcaddo... | mirzasany/mirza | plugin.video.shahidmbcnet/resources/community/genericPlayer.py | Python | gpl-2.0 | 34,963 |
#!/usr/bin/env python3
import logging
import types
from collections import defaultdict
import os
import sys
import ipaddress
import itertools
import glob
import yaml
from typing import Dict, Tuple
try:
from yaml import CSafeLoader as SafeLoader # type: ignore
except ImportError:
from yaml import SafeLoader # t... | particleKIT/hostlist | hostlist/hostlist.py | Python | gpl-3.0 | 9,496 |
#!/usr/bin/env python
from home import lightingControl as lc
import logging
from twisted.protocols.basic import LineReceiver
from twisted.internet.protocol import ServerFactory
from twisted.internet import task
from twisted.internet import reactor
logging.basicConfig()
class lightingProtocol(LineReceiver):
def _... | RossWilliamson/home_automation | bin/lightingServer.py | Python | bsd-2-clause | 906 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
import io
import re
from glob import glob
from os.path import basename
from os.path import dirname
from os.path import join
from os.path import splitext
from setuptools import find_packages
fro... | miroag/mfs | setup.py | Python | mit | 2,863 |
## \file
## \ingroup tutorial_dataframe
## \notebook -draw
## \brief The Higgs to two photons analysis from the ATLAS Open Data 2020 release, with RDataFrame.
##
## This tutorial is the Higgs to two photons analysis from the ATLAS Open Data release in 2020
## (http://opendata.atlas.cern/release/2020/documentation/). Th... | karies/root | tutorials/dataframe/df104_HiggsToTwoPhotons.py | Python | lgpl-2.1 | 7,173 |
# -*-coding:utf-8 -*
# Copyright (c) 2011-2015, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, thi... | miguelgaio/parameter-framework | test/functional-tests-legacy/PfwTestCase/Types/tINT32_Max.py | Python | bsd-3-clause | 10,962 |
#!/usr/bin/env python
from ..models import BVLCAlex
import chainer
import fcn
def copy_alex_chainermodel(chainermodel_path, model):
bvlc_model = BVLCAlex()
chainer.serializers.load_hdf5(chainermodel_path, bvlc_model)
for link in bvlc_model.children():
link_name = link.name
if link_name.st... | start-jsk/jsk_apc | demos/selective_dualarm_stowing/python/selective_dualarm_stowing/utils/copy_chainermodel.py | Python | bsd-3-clause | 1,611 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.