code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2015 Serpent Consulting Services Pvt. Ltd. (<http://www.serpentcs.com>)
# Copyright (C) 2016 FairCoop (<http://fair.coop>)
#
# This program is f... | Punto0/addons-fm | website_product_brand/__openerp__.py | Python | agpl-3.0 | 1,807 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
setup.py
~~~~~~~~
no description available
:copyright: (c) 2015 by diamondman.
:license: see LICENSE for more details.
"""
import codecs
import os
import re
from setuptools import setup
here = os.path.abspath(os.path.dirname(__file__))
def rea... | diamondman/pys3streamer | setup.py | Python | mit | 1,422 |
# Copyright Iris contributors
#
# This file is part of Iris and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
"""
Unit tests for the :class:`iris.common.resolve.Resolve`.
"""
# Import iris.tests first so that some things can be initial... | SciTools/iris | lib/iris/tests/unit/common/resolve/test_Resolve.py | Python | lgpl-3.0 | 191,487 |
from ..models import VMPlayground, VMSandbox
from django.conf import settings
import re
def fillContext(opts, req):
"""
Given a set of already filled in options for a context render, fill in some of the additional
details.
"""
nopts = {
"version": settings.VERSION,
"request": req
... | nemonik/CoCreateLite | ccl-cookbook/files/default/cocreatelite/cocreate/views/util.py | Python | bsd-3-clause | 1,326 |
import asyncio
import copy
import enum
import random
import re
import weakref
from slot.protocols.base import BaseProtocol
from slot.events import EventManager, subscription
from slot.message import IncomingMessage, Conversation, Person
import slot.http
from slot.http import ResponseFormat
from slot.utils import html_u... | Slko/Slot | slot/protocols/vk.py | Python | bsd-3-clause | 13,656 |
from __future__ import print_function, absolute_import, division
import warnings
from astropy import units as u
from astropy.io import registry as io_registry
from radio_beam import Beam, Beams
from .. import DaskSpectralCube, StokesSpectralCube, BooleanArrayMask, DaskVaryingResolutionSpectralCube
from ..spectral_cub... | low-sky/spectral-cube | spectral_cube/io/casa_image.py | Python | bsd-3-clause | 8,718 |
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 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
#
# ... | hahaps/openstack-project-generator | template/<project_name>/tests/unit/db/fakes.py | Python | apache-2.0 | 1,397 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("test_custom", "0001_initial")]
operations = [
migrations.AlterModelOptions(
name="team",
options={
... | bennylope/django-organizations | test_custom/migrations/0002_model_update.py | Python | bsd-2-clause | 479 |
"""This integration provides support for Stookalert Binary Sensor."""
from __future__ import annotations
from datetime import timedelta
import stookalert
import voluptuous as vol
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_SAFETY,
PLATFORM_SCHEMA,
BinarySensorEntity,
)
from homeassi... | aronsky/home-assistant | homeassistant/components/stookalert/binary_sensor.py | Python | apache-2.0 | 3,181 |
import json
import numpy as np
import pytest
from ray.serve.utils import ServeEncoder
def test_bytes_encoder():
data_before = {"inp": {"nest": b"bytes"}}
data_after = {"inp": {"nest": "bytes"}}
assert json.loads(json.dumps(data_before, cls=ServeEncoder)) == data_after
def test_numpy_encoding():
da... | ray-project/ray | python/ray/serve/tests/test_util.py | Python | apache-2.0 | 748 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# pybind11 documentation build configuration file, created by
# sphinx-quickstart on Sun Oct 11 19:23:48 2015.
#
# 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
# a... | fraenkel-lab/pcst_fast | external/pybind11/docs/conf.py | Python | mit | 9,900 |
#import csv
#f = open("New-Users_Sent_test.csv")
#for row in csv.reader(f):
# print(row)
import csv
#----------------------------------------------------------------------
def csv_dict_reader(file_obj):
"""
Read a CSV file using csv.DictReader
"""
reader = csv.DictReader(file_obj, delimiter=';')... | AlexFortLabs/MyPythonLabs | Sammelsurium/Lesen_aus _CSV.py | Python | gpl-3.0 | 673 |
import logging
import requests
import socket
import sys
import threading
import time
from concurrent.futures import ThreadPoolExecutor
from .configs import defaults
from .utils import sanitize_meta, get_ip, normalize_list_option
class LogDNAHandler(logging.Handler):
def __init__(self, key, options={}):
... | logdna/python | logdna/logdna.py | Python | mit | 10,185 |
from . import flags
from . import _binding
from pycrm114.errors import CRM114InitializationError
class CRM114(object):
def __init__(self, classes, flags=flags.CRM114_OSB, storage=None, auto_save=False):
self.classes = classes
self.flags = flags
self.storage = storage
self.auto_save... | alisaifee/pycrm114 | pycrm114/core.py | Python | mit | 2,108 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import django_fields.fields
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations =... | nautilebleu/django-ios-notifications | ios_notifications/migrations/0001_initial.py | Python | bsd-3-clause | 4,492 |
import turtle
from turtle import *
def flocon(i,p):
if p==0:
turtle.forward(10)
else:
flocon(i/3,p-1)
turtle.left(60)
flocon(i/3,p-1)
turtle.right(120)
flocon(i/3,p-1)
turtle.left(60)
flocon(i/3,p-1)
flocon(1,9) | bros-bioinfo/bros-bioinfo.github.io | COURS/M1/SEMESTRE1/ALGO_PROG/ALGO/turtle1.py | Python | mit | 288 |
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import importlib
import logging
import logging.config
import os
from flask import Flask
from flask.ext.redistore import Redistore # pylint: disable=E0611,F0401
from flask.ext.script import Manager # pylin... | davidfischer/warehouse | warehouse/__init__.py | Python | bsd-2-clause | 3,034 |
# -*- coding: ascii -*-
"""
Line graph algorithms.
Undirected Graphs
-----------------
For an undirected graph G without multiple edges, each edge can be written as
a set {u,v}. Its line graph L has the edges of G as its nodes. If x and y
are two nodes in L, then {x,y} is an edge in L if and only if the intersection
... | koorukuroo/networkx_for_unicode | networkx/generators/line.py | Python | bsd-3-clause | 8,159 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | Konubinix/qutebrowser | qutebrowser/app.py | Python | gpl-3.0 | 32,347 |
#!/usr/bin/env python
#
# Copyright 2010 Communications Engineering Lab, KIT
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This softwar... | mfischer/gr-specest | python/qa_specest_burg.py | Python | gpl-3.0 | 7,923 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('candidates', '0013_remove_max_popit_ids'),
]
operations = [
migrations.AlterField(
model_name='organizationextra... | mysociety/yournextmp-popit | candidates/migrations/0014_make_extra_slugs_unique.py | Python | agpl-3.0 | 789 |
"""
This will update node links on POPULAR_LINKS_NODE, POPULAR_LINKS_REGISTRATIONS and NEW_AND_NOTEWORTHY_LINKS_NODE.
"""
import sys
import logging
from django.db import transaction
from website.app import init_app
from framework.auth.core import Auth
from scripts import utils as script_utils
from framework.celery_ta... | laurenrevere/osf.io | scripts/populate_popular_projects_and_registrations.py | Python | apache-2.0 | 2,871 |
#!/usr/bin/env python3
# encoding: utf-8
# author: Timo Schmid
# license: GPLv2
import time
import socket
import random
import datetime
import threading
import struct
import subprocess
MIN_PORT = 40000
MAX_PORT = 60000
SECRET = b'Sesam oeffne dich'
class Guard(threading.Thread):
def __init__(self, ports):
... | bluec0re/port-knocking-guard | guard.py | Python | gpl-2.0 | 4,261 |
# coding: utf-8
# python 3.5
import Orange
from orangecontrib.associate.fpgrowth import *
import pandas as pd
import numpy as np
import sys
import os
from collections import defaultdict
from itertools import chain
from itertools import combinations
from itertools import compress
from itertools import product
from sklea... | gingi99/research_dr | python/FPgrowth/orange_fpgrowth.py | Python | mit | 10,802 |
'''
===============
Milk Extensions
===============
These are modules whose functionality is not really part of the core
functionality of milk, but which are useful with it.
'''
| luispedro/milk | milk/ext/__init__.py | Python | mit | 180 |
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=invalid-name
from __future_... | mganeva/mantid | scripts/reducer_singleton.py | Python | gpl-3.0 | 7,744 |
"""
Contains DAO implementations that always return specific errors.
Used for unit testing.
"""
from restclients.mock_http import MockHTTP
class Always404(object):
"""
Always404 will return a 404 for any URL given.
"""
def getURL(self, url, headers):
"""
This method takes a partial ur... | UWIT-IAM/uw-restclients | restclients/dao_implementation/errors.py | Python | apache-2.0 | 1,037 |
""" file: config.py (syns)
author: Jess Robertson
description: Config file for running Flask app, lifted and lightly modified from
Miguel's 'Flask Web Development' book.
"""
import os
BASEDIR = os.path.abspath(os.path.dirname(__file__))
class Config:
""" Base configuration class
"""
... | drzax/databot | app/config.py | Python | mit | 1,253 |
import socket, struct
def ip2long(ip):
return struct.unpack("!L", socket.inet_aton(ip))[0]
def long2ip(long):
return socket.inet_ntoa(struct.pack('!L', long))
def is_valid_ipv4_address(address):
try:
socket.inet_pton(socket.AF_INET, address)
except AttributeError: # no inet_pton here, sorry
... | erikruiter2/ipbucket | ipaddr_func.py | Python | gpl-2.0 | 731 |
import ast
import base64
import boto3
import os
from os.path import expanduser
import shutil
import time
import server.server_plugins.resource_base as resource_base
from server.common import constants
from server.common import common_functions
from server.common import docker_lib
from server.common import fm_logger
fr... | cloud-ark/cloudark | server/server_plugins/aws/resource/ecr.py | Python | apache-2.0 | 6,882 |
#!/usr/bin/env python3
from collections import OrderedDict as OD
from types import FunctionType, ModuleType
from inspect import getargspec
from .columns import *
from .data import Data
from .server import proxy
import os, sys, subprocess
import __main__
import pdb
'''
def ping(ip, retries = -1):
ret = 0
if ... | ivanovev/start | util/misc.py | Python | gpl-3.0 | 6,464 |
# Very rudimentary test of threading module
import test.support
from test.support import verbose, strip_python_stderr, import_module
import random
import re
import sys
_thread = import_module('_thread')
threading = import_module('threading')
import time
import unittest
import weakref
import os
from test.script_helper ... | wdv4758h/ZipPy | lib-python/3/test/test_threading.py | Python | bsd-3-clause | 29,804 |
#!/usr/bin/env python
# Copyright (C) 2009-2014:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
#
# This file is part of Shinken.
#
# Shinken 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 F... | h4wkmoon/shinken | test/test_service_template_inheritance.py | Python | agpl-3.0 | 1,713 |
# By @Kevin Xu
# kevin28520@gmail.com
# Youtube: https://www.youtube.com/channel/UCVCSn4qQXTDAtGWpWAe4Plw
#
# The aim of this project is to use TensorFlow to process our own data.
# - input_data.py: read in data and generate batches
# - model: build the model architecture
# - training: train
# I used Ubuntu ... | huazhisong/race_code | kaggle_ws/dog_cat_ws/codes/input_data.py | Python | gpl-3.0 | 5,057 |
import os
from unipath import Path
from django.core.exceptions import ImproperlyConfigured
import dj_database_url
def env_var(var_name):
"""Get the environment variable var_name or return an exception."""
try:
return os.environ[var_name]
except KeyError:
msg = "Please set the environment ... | rskwan/mt | mt/mt/settings/base.py | Python | apache-2.0 | 2,992 |
import datetime
import tweepy
from geopy.geocoders import Nominatim
import json
from secret import *
import boto3
import re
import preprocessor as p
import time
p.set_options(p.OPT.URL, p.OPT.EMOJI)
# Get the service resource.
dynamodb = boto3.resource('dynamodb', region_name='us-west-2')
table = dynamodb.Table('fuck... | Gknoblau/gladitude | twitter/twitter_tweepy.py | Python | mit | 3,076 |
#!/usr/bin/env python
# vim:fileencoding=utf-8
__author__ = 'zeus'
from django.core.management.base import BaseCommand, CommandError
from pybb.models import Topic, Post
from django.core import serializers
class Command(BaseCommand):
args = '<topic_id topic_id>'
help = 'Dump target topics to json'
def ha... | orlenko/bccf | src/pybb/management/commands/dump_topics.py | Python | unlicense | 590 |
'''
Created on 25-07-2013
@author: kamil
'''
import logging
import datetime
from django.contrib.contenttypes.models import ContentType
from django.utils.timezone import utc
from models import ScheduledPush
class BasePushPolicy:
ALLOWED_METHODS = ["POST", "PUT", "PATCH", "DELETE"]
MAX_RETRIES = 5
... | Sigmapoint/notos | src/notos/policies.py | Python | mit | 4,467 |
"""Sheets for spd."""
def includeme(config):
"""Include sheets."""
config.include('.s1')
config.include('.description')
| liqd/adhocracy3.mercator | src/adhocracy_s1/adhocracy_s1/sheets/__init__.py | Python | agpl-3.0 | 134 |
# -*- coding: utf-8 -*-
# import numpy no numpy cuz windoz
import collections, csv, itertools, os, re, tempfile, urllib2, sys, urllib,imp,copy, tabulate
import h2o
from expr import ExprNode
from astfun import _bytecode_decompile_lambda
from group_by import GroupBy
# TODO: Automatically convert column names into Fr... | madmax983/h2o-3 | h2o-py/h2o/frame.py | Python | apache-2.0 | 70,908 |
class BasicPresenter(object):
_data = None
def __init__(self, data):
self._data = data
def present(self):
raise NotImplementedError()
def __str__(self):
return self.present()
from jsonpresenter import JsonPresenter
from humanpresenter import HumanPresenter | tspycher/python-aviationdata | aviationdata/presenter/__init__.py | Python | mit | 300 |
import pytest
@pytest.mark.bashcomp(cmd="munin-node-configure")
class TestMuninNodeConfigure:
@pytest.mark.complete("munin-node-configure --libdir ")
def test_1(self, completion):
assert completion
@pytest.mark.complete(
"munin-node-configure -",
require_cmd=True,
xfail=(
... | scop/bash-completion | test/t/test_munin_node_configure.py | Python | gpl-2.0 | 504 |
import json
import unittest
import httpretty
from mock import Mock
from telegrambot import api
from telegrambot.exceptions import TelegramBadRequestError
class DummyAPI(api.TelegramAPIMixin):
def __init__(self):
return
class TestAPIMixin(unittest.TestCase):
def test_logger_name(self):
api ... | wrboyce/telegrambot | tests/test_api.py | Python | apache-2.0 | 2,499 |
#!/usr/bin/env python
# PyQt tutorial 4
import sys
from PySide import QtCore, QtGui
class MyWidget(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.setFixedSize(200, 120)
self.quit = QtGui.QPushButton("Quit", self)
self... | cherry-wb/SideTools | examples/tutorial/t4.py | Python | apache-2.0 | 645 |
# -*- coding: utf-8 -*-
"""
Copyright (c) 2010-2021 OneLogin, Inc.
MIT License
Add SAML support to your Python softwares using this library.
Forget those complicated libraries and use that open source
library provided and supported by OneLogin Inc.
OneLogin's SAML Python toolkit let you build a SP (Service Provider)... | onelogin/python3-saml | src/onelogin/saml2/__init__.py | Python | mit | 727 |
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8
#
# MDAnalysis --- http://www.mdanalysis.org
# Copyright (c) 2006-2016 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#
... | alejob/mdanalysis | testsuite/MDAnalysisTests/topology/test_crd.py | Python | gpl-2.0 | 1,577 |
import glob
import os
from qgis.core import QgsApplication
from command import command, complete_with
from PyQt4.QtCore import QUrl
from PyQt4.QtGui import QDesktopServices
folder = os.path.join(QgsApplication.qgisSettingsDirPath(), "python",
"commandbar")
def packages(argname, data):
retu... | NathanW2/qgiscommand | package_commands.py | Python | gpl-2.0 | 1,552 |
import logging
logger = logging.getLogger('bungiesearch')
| ChristopherRabotin/bungiesearch | bungiesearch/logger.py | Python | bsd-3-clause | 59 |
# encoding=utf-8
import sys
sys.path.insert(1, "lib")
sys.path.insert(1, "core")
import os
import time
import unittest
import xconfig
import xutils
import xtables
import xmanager
import xtemplate
import web
import six
import json
import xauth
from xutils import dbutil
from handlers.fs.fs_upload import get_upload_file_p... | xupingmao/xnote | tests/test_base.py | Python | gpl-3.0 | 4,620 |
# A file to store common functions that avoid iteratively import itself
# Xiang Ji
# xji3@ncsu.edu
import itertools
import numpy as np
from math import floor
def divide_configuration(configuration):
ortho_group_to_pos = dict(extent = {}, distinct = [], loc = [])
# extent positions that represent same paralog (... | xjw1001001/IGCexpansion | IGCexpansion/Common.py | Python | gpl-3.0 | 2,414 |
# -*- coding: utf-8 -*-
"""
"""
import sys
from ..oauthadmin import OAuthAdminCmds
def main():
"""main script of oauth-admin as set up in the 'setup.py'.
"""
app = OAuthAdminCmds()
sys.exit(app.main())
if __name__ == '__main__':
main()
| pythonpro-dev/pp-gdata-helper | pp/gdata/helper/scripts/main.py | Python | bsd-3-clause | 261 |
import tensorflow as tf
from preprocessing import resize
def preprocess_image(image, output_height, output_width, is_training=False):
image = tf.image.convert_image_dtype(image, dtype=tf.float32)
image = resize.preprocess_image(image, output_height, output_width, is_training)
image = tf.subtract(image, 0.5... | pjaehrling/finetuneAlexVGG | preprocessing/inception/resize.py | Python | apache-2.0 | 375 |
# Copyright 2011 OpenStack Foundation
# Copyright 2013 IBM Corp.
# 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/LIC... | silenceli/nova | nova/tests/unit/api/openstack/compute/contrib/test_quotas.py | Python | apache-2.0 | 26,772 |
import bumpy as b
@b.task
def init():
print 'Initializing database'
@b.task
def migrate(start=0.1, end=0.2):
start, end = float(start), float(end)
if end <= start:
b.abort('Unable to migrate to a previous version')
print 'Migrating database from {} to {}'.format(start, end)
@b.task
def destroy():
print 'Dest... | scizzorz/bumpy | example/db.py | Python | mit | 337 |
from vtk import vtkArrowSource, vtkGlyph3D, vtkPolyData
from vtk import vtkRenderer, vtkRenderWindowInteractor, vtkPolyDataMapper, vtkActor, vtkRenderWindow
from pcloudpy.core.filters.base import FilterBase
class DisplayNormals(FilterBase):
def __init__(self):
super(DisplayNormals, self).__init__()
... | mmolero/pcloudpy | pcloudpy/core/filters/DisplayNormals.py | Python | bsd-3-clause | 1,104 |
import json
from app.authorities import CODES
from requests import get
import xmltodict
class Entity:
def __init__(self, data):
self.data = data
self.properties = self._build_properties()
self.labels = self._build_labels()
def _build_properties(self):
raise NotImplemented
... | AdirShemesh/LibraryWiki | app/node_entities.py | Python | gpl-2.0 | 3,155 |
# -*- encoding: utf-8 -*-
from . import account_invoice
| noemis-fr/custom | noemis_change_views/models/__init__.py | Python | gpl-3.0 | 56 |
from setuptools import setup, find_packages
setup(name='MODEL1006230039',
version=20140916,
description='MODEL1006230039 from BioModels',
url='http://www.ebi.ac.uk/biomodels-main/MODEL1006230039',
maintainer='Stanley Gu',
maintainer_url='stanleygu@gmail.com',
packages=find_packages(... | biomodels/MODEL1006230039 | setup.py | Python | cc0-1.0 | 377 |
from pyramid.i18n import TranslationStringFactory
_ = TranslationStringFactory('usingnamespace')
import colander
import deform
from ...forms.schemaform import SchemaFormMixin
from ...forms.csrf import CSRFSchema
from ...models import User
@colander.deferred
def login_username_password(node, kw):
request = kw.ge... | usingnamespace/usingnamespace | usingnamespace/management/forms/user.py | Python | isc | 1,307 |
from mock import patch
from testtools import TestCase
from charmhelpers.contrib import ssl
class HelpersTest(TestCase):
@patch('subprocess.check_call')
def test_generate_selfsigned_dict(self, mock_call):
subject = {"country": "UK",
"locality": "my_locality",
"sta... | whitmo/charmhelpers | tests/contrib/ssl/test_ssl.py | Python | gpl-3.0 | 2,729 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp.osv import fields, osv
class base_config_settings(osv.osv_memory):
_name = 'base.config.settings'
_inherit = 'res.config.settings'
_columns = {
'group_multi_company': fields.boolean('M... | akhmadMizkat/odoo | addons/base_setup/res_config.py | Python | gpl-3.0 | 3,628 |
"""
@package mi.dataset.parser.test
@file marine-integrations/mi/dataset/parser/test/test_dosta_abcdjm_cspp.py
@author Mark Worden
@brief Test code for a dosta_abcdjm_cspp data parser
"""
import os
from nose.plugins.attrib import attr
from mi.core.log import get_logger
from mi.core.exceptions import RecoverableSamp... | oceanobservatories/mi-dataset | mi/dataset/parser/test/test_dosta_abcdjm_cspp.py | Python | bsd-2-clause | 8,489 |
import time
from datetime import datetime
from PyQt5 import QtCore
class QThreadClock(QtCore.QThread):
time_signal = QtCore.pyqtSignal(str, name="clockSignal")
def __init__(self):
super(QThreadClock, self).__init__()
def run(self):
while True:
time.sleep(1)
self.... | pliniopereira/ccd3 | src/business/schedulers/qthreadClock.py | Python | gpl-3.0 | 377 |
'''
Test single SNI hook
'''
# 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.... | taoyunxing/trafficserver | tests/gold_tests/tls_hooks/tls_hooks2.test.py | Python | apache-2.0 | 3,460 |
#!/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... | elventear/ansible | lib/ansible/modules/network/nxos/nxos_gir_profile_management.py | Python | gpl-3.0 | 6,649 |
#!/usr/bin/env python
# coding: utf-8
from __future__ import unicode_literals
# Allow direct execution
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import http_server_port
from youtube_dl import YoutubeDL
from youtube_dl.compat i... | rg3/youtube-dl | test/test_http.py | Python | unlicense | 6,082 |
"""
Attempt to generate templates for module reference with Sphinx
To include extension modules, first identify them as valid in the
``_uri2path`` method, then handle them in the ``_parse_module_with_import``
script.
Notes
-----
This parsing is based on the import and introspection of modules.
Previously functions an... | FrancoisRheaultUS/dipy | doc/tools/apigen.py | Python | bsd-3-clause | 17,957 |
from __future__ import print_function, division, absolute_import
import sys
from toolz import identity
if sys.version_info[0] < 3:
class SeekableFile(object):
def __init__(self, file):
if isinstance(file, SeekableFile): # idempotent
file = file.file
self.file = fil... | chrisbarber/dask | dask/bytes/utils.py | Python | bsd-3-clause | 3,534 |
"""Carmen, a library for geolocating tweets."""
__version__ = '0.0.3'
from .resolver import get_resolver
| mdredze/carmen-python | carmen/__init__.py | Python | bsd-2-clause | 107 |
from django.contrib.auth.models import User
from django.core import management
from citation.models import AuditCommand, AuditLog, Container, Publication, PublicationPlatforms, Platform, \
Author, \
PublicationAuthors
from citation.serializers import PublicationSerializer
from .common import BaseTest
from col... | dhruvilpatel/citation | tests/test_serializers.py | Python | gpl-3.0 | 3,195 |
#pylint: disable=W0703,W0105
'''
Copyright 2014 eBay Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicabl... | eBay/cronus-agent | agent/agent/controllers/status.py | Python | apache-2.0 | 3,960 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | SUSE/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_sku.py | Python | mit | 1,546 |
# Copyright (C) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and th... | danialbehzadi/Nokia-RM-1013-2.0.0.11 | webkit/Tools/Scripts/webkitpy/tool/steps/revertrevision.py | Python | gpl-3.0 | 1,769 |
import json
from pymongo import Connection
LEVELS = [ 'DEBUG', 'INFO', 'NOTICE', 'WARNING', 'ERROR' ]
db = None
def get_db(mongohost=None):
global db
if db: return db
if mongohost:
hostname, port = mongohost.split(':')
port = int(port)
else:
hostname = 'localhost'
port = 27017
conn = Conne... | jay3sh/logfire | src/common.py | Python | mit | 467 |
# -*- coding: utf-8 -*-
SUCCESS = 0
UNINITAILIZE = 0x10000001
UNSPORTED_PROTOCOL = 0x10000002
INIT_TASK_TRAY_ICON_FAIL = 0x10000003
ADD_TASK_TRAY_ICON_FAIL = 0x10000004
POINTER_IS_NULL = 0x10000005
STRING_IS_EMPTY = 0x10000006
PATH_DONT_INCLUDE_FILENAME = 0x10000007
CREATE_DIRECTORY_FAIL = 0x10000008
MEMORY_ISNT_ENOUG... | shonenada-archives/thunder-dl-server | src/libs/errors.py | Python | mit | 901 |
from django.utils import unittest
from . import game_test
def suite():
loader = unittest.TestLoader()
return loader.loadTestsFromTestCase(game_test.GameTests)
| ukch/online_sabacc | src/sabacc/old_sabacc/tests.py | Python | gpl-3.0 | 169 |
import _plotly_utils.basevalidators
class NameValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self,
plotly_name="name",
parent_name="choropleth.colorbar.tickformatstop",
**kwargs
):
super(NameValidator, self).__init__(
plotly_name=plot... | plotly/python-api | packages/python/plotly/plotly/validators/choropleth/colorbar/tickformatstop/_name.py | Python | mit | 503 |
#coding: utf-8
"""
a wrapper for multiple socks5 proxy & http proxy
"""
from xsocket import XSocket
from clients import HTTPProxy, SocksProxy
from functools import partial
clients = [partial(HTTPProxy, ("10.239.120.37", 911)),
partial(SocksProxy, ("10.7.211.16", 1080)),
XSocket]
def SmartSocket(... | lvsoft/sockshub | smartsocket.py | Python | gpl-2.0 | 383 |
from django.views.generic import View
class EmbeddedViewBase(View):
layout = 'base.html'
embedded_layout = 'embedded_base.html'
is_embedded = False
def get_context_data(self, * args, **kwargs):
context = super(EmbeddedViewBase, self).get_context_data(* args, **kwargs)
if self.is_embed... | lfalvarez/votai | votai_utils/view_mixins.py | Python | gpl-3.0 | 485 |
import mock, os, random, shutil, string, tempfile, unittest
from postcode_api.caches.s3_cache import S3Cache
from random_temp_dir import RandomTempDir
class S3CacheTest(unittest.TestCase):
def setUp(self):
self.mock_key = mock.MagicMock('mock Key')
self.mock_key.get_contents_to_filename = moc... | ministryofjustice/postcodeinfo | postcodeinfo/apps/postcode_api/tests/caches/test_s3_cache.py | Python | mit | 3,255 |
# -*- coding: utf-8; -*-
# Copyright (c) 2014-2015 Sebastian Wiesner <swiesner@lunaryorn.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 without restriction, including without limitatio... | flycheck/sphinxcontrib-emacs | sphinxcontrib/emacs/directives/__init__.py | Python | mit | 1,186 |
#!/usr/bin/python3
# coding=utf-8
# -------------------------------------------------------------------------------
# This file is part of Phobos, a Blender Add-On to edit robot models.
# Copyright (C) 2020 University of Bremen & DFKI GmbH Robotics Innovation Center
#
# You should have received a copy of the 3-Clause ... | rock-simulation/phobos | phobos/io/entities/submechanisms.py | Python | lgpl-3.0 | 2,046 |
from django.contrib import admin
# Register your models here.
from .models import Post
class PostModelAdmin(admin.ModelAdmin):
"""docstring for PostModelAdmin"""
class Meta:
model = Post
list_display=["author", "title"]
list_display_links=["title"]
list_filter= ["timestamp"]
search_fields =["title","author__n... | pandeydivesh15/item_sharing_portal | src/post/admin.py | Python | mit | 368 |
"""
numsed library
numsed opcodes include unsigned operators (+, -, *) and unsigned
comparisons. This library provides functions implementing all
arithmetic and comparison signed operators using only numsed
operators.
"""
from __future__ import print_function
# signed comparison operators
def signed_eq(x, y):
... | GillesArcas/numsed | numsed/numsed_lib.py | Python | mit | 6,078 |
from django.shortcuts import render
from . import models
# Create your views here.
def socialIndex(request):
index = ""
return render(request, 'social/socialIndex.html', {'index':index})
| Datateknologerna-vid-Abo-Akademi/date-website | social/views.py | Python | cc0-1.0 | 198 |
import inspect
def csv(val):
if isinstance(val, basestring):
return val.split(',')
elif hasattr(val, '__iter__'):
return ','.join(map(str, val))
else:
raise TypeError('Must supply a comma separated string or an iterable')
def get_pos_args(func):
""" Return the names of a func... | PaulMcMillan/kismetclient | kismetclient/utils.py | Python | mit | 519 |
import serpent
from pyethereum import transactions, blocks, processblock, utils
import bitcoin
key = utils.sha3('aimfesidfd')
addr = utils.privtoaddr(key)
def pad32(n):
if type(n) ==str:
h = n.encode('hex')
else:
h = "%02x"%n
l = len(h)
return "0"*(32-l)+h
nargs = pad32(1)
d0 = pad32('hi')
print nargs, d0
ms... | ebuchman/daoist_protocol | contracts/test_daoism.py | Python | mit | 1,067 |
# Copyright (c) 2014 Intel Corporation.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of works must retain the original copyright notice, this list
# of conditions and the following disclaimer.... | xiaojunwu/crosswalk-test-suite | tools/atip/atip/common/common.py | Python | bsd-3-clause | 1,701 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2011 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | zen/openstack-dashboard | django-openstack/django_openstack/tests/api_tests.py | Python | apache-2.0 | 49,989 |
# Copyright 2021 Binovo IT Human Project SL
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import logging
from requests import exceptions
from odoo.tools.safe_eval import safe_eval
_logger = logging.getLogger(__name__)
try:
from requests_pkcs12 import post as pkcs12_post
except(ImportError, IOEr... | factorlibre/l10n-spain | l10n_es_ticketbai_api/ticketbai/api.py | Python | agpl-3.0 | 2,399 |
"""Support for monitoring the local system."""
import logging
import os
import socket
import sys
import psutil
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import (
CONF_RESOURCES,
CONF_TYPE,
DATA_GIBIBYTES,
DATA_MEBIBYTES,... | adrienbrault/home-assistant | homeassistant/components/systemmonitor/sensor.py | Python | apache-2.0 | 12,270 |
#!/usr/bin/python -i
# Set things up to use the bindings in the build directory.
# Used by the testsuite, but you may also run:
# $ python -i tests/setup_path.py
# to start an interactive interpreter.
import sys
import os
src_swig_python_tests_dir = os.path.dirname(os.path.dirname(__file__))
sys.path[0:0] = [ src_... | bdmod/extreme-subversion | BinarySourcce/subversion-1.6.17/subversion/bindings/ctypes-python/test/setup_path.py | Python | gpl-2.0 | 411 |
# Copyright 2010 David Hwang
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
"""
This module holds a ID3Tag class which takes a file and constructs an object
representing the tag.... | ultima51x/shelltag | shelltag_src/id3tag.py | Python | gpl-2.0 | 11,651 |
from django.db import models
from django.contrib.auth.models import User
class Zone(models.Model):
name = models.CharField(max_length = 64)
created = models.DateTimeField(auto_now_add = True)
def __str__(self):
return self.name
class Sub_Zone(models.Model):
owner = models.ForeignKey(User)
... | rockwyc992/monkey-pdns | monkey_pdns/app/models.py | Python | mit | 1,285 |
username = ""
password = ""
if not username or not password:
err_str = \
"Fill out login_details.py with your username and password."
raise Exception(err_str) | thismachinechills/awful.py | tests/TestObjs/login_details.py | Python | gpl-3.0 | 175 |
# Copyright 2018 SAS Project 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 requ... | Wireless-Innovation-Forum/Spectrum-Access-System | src/harness/sas_test_harness.py | Python | apache-2.0 | 21,724 |
from amazonproduct import *
import urllib2
from django.core.management import setup_environ
import settings
setup_environ(settings)
from django.db import connection, transaction
from book.models import Book
AWS_KEY = 'AKIAI6M6RNJTOTRN7M4Q'
SECRET_KEY = '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'
api = A... | shawiz/idlebook | idlebook/data/amazon_import.py | Python | mit | 8,592 |
# Copyright 2019 Fortinet, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the... | thaim/ansible | test/units/modules/network/fortios/test_fortios_wireless_controller_hotspot20_anqp_roaming_consortium.py | Python | mit | 8,355 |
# Copyright (C) 2014-2020 Syracuse University, European Gravitational Observatory, and Christopher Newport University. Written by Ryan Fisher and Gary Hemming. See the NOTICE file distributed with this work for additional information regarding copyright ownership.
# This program is free software: you can redistribute... | duncanmmacleod/dqsegdb | server/db/db_utils/component_interface_data_integrity_test_suite/src/gpstime.py | Python | gpl-3.0 | 8,933 |
#!/usr/bin/env python
import sys
import re
import csv
import os.path
from itertools import izip
import shutil
import pandas as pd
#TODO:
# Read the input file via sysarg or path crawling --> include everything in pathrun()
# Change the hardcodename argument
# FIX: Q 8 - 23
# Joining all ... | shayanb/SEC.gov-form-retriever | parser_nsar.py | Python | gpl-2.0 | 5,676 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.