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 |
|---|---|---|---|---|---|
#pylint: disable-msg=R0903,R0904
"""#10026"""
__revision__ = 1
from gtk import VBox
import gtk
class FooButton(gtk.Button):
"""extend gtk.Button"""
def extend(self):
"""hop"""
print self
print gtk.Button
print VBox
| dbbhattacharya/kitsune | vendor/packages/pylint/test/regrtest_data/pygtk_import.py | Python | bsd-3-clause | 241 |
#!/usr/bin/python
# -*- Mode: python; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*-
import sys
import os
import shutil
from foldersync.storage import Status
class LocalStorage(object):
def __init__(self):
pass
def put(self, localpath, remotepath):
if not os.path.exists(localpath):
ret... | lukacu/foldersync | foldersync/storage/local.py | Python | gpl-3.0 | 650 |
from office365.runtime.client_object import ClientObject
from office365.runtime.queries.service_operation_query import ServiceOperationQuery
from office365.runtime.paths.resource_path import ResourcePath
from office365.sharepoint.userprofiles.userProfile import UserProfile
class ProfileLoader(ClientObject):
def ... | vgrem/Office365-REST-Python-Client | office365/sharepoint/userprofiles/profileLoader.py | Python | mit | 1,190 |
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
#
# 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 lat... | M0ses/ansible | v2/ansible/plugins/connections/local.py | Python | gpl-3.0 | 5,509 |
from crispy_forms.bootstrap import FormActions
from crispy_forms.helper import FormHelper
from crispy_forms.layout import ButtonHolder, Div, Fieldset, HTML, Layout, Submit
from django import forms
from django.core.validators import EmailValidator, email_re
from django.core.urlresolvers import reverse
from django.forms.... | gmimano/commcaretest | corehq/apps/users/forms.py | Python | bsd-3-clause | 11,739 |
import rpyc
class AService(rpyc.Service):
class exposed_A(object):
@classmethod
def exposed_foo(cls, a, b):
return 17 * a + b
if __name__ == "__main__":
with rpyc.connect_thread(remote_service = AService) as conn:
print( conn.root.A.foo(1, 2))
| pombredanne/rpyc | issues/issue26.py | Python | mit | 291 |
"""cyme.branch
- This is the Branch thread started by the :program:`cyme-branch` program.
It starts the HTTP server, the Supervisor, and one or more controllers.
"""
from __future__ import absolute_import
import logging
from celery import current_app as celery
from celery.utils import LOG_LEVELS, term
from cell... | celery/cyme | cyme/branch/__init__.py | Python | bsd-3-clause | 5,311 |
import requests
class GeneralBikeshareFeed(object):
gbfs_feed = 'http://gbfs.citibikenyc.com/gbfs/gbfs.json'
def __init__(self):
"""
{ "last_updated":1478918732,
"ttl":10,
"data":{
"en":{
"feeds":[
{ "name":"system_info... | mdprewitt/citiike-gbf | gbf/feed.py | Python | mit | 1,973 |
import logging
import os
import sys
import signal
DESTDIR = "/opt/spark-cluster/"
logFormatter = logging.Formatter("%(asctime)s [%(threadName)-12.12s] [%(levelname)-5.5s] %(message)s")
rootLogger = logging.getLogger()
rootLogger.setLevel(logging.DEBUG)
def sigint_handler(signum, frame):
os.system("docker-compo... | f-guitart/spark-cluster | run_spark_cluster.py | Python | gpl-3.0 | 7,041 |
xs = (<caret>1, 2) | smmribeiro/intellij-community | python/testData/intentions/PyConvertCollectionLiteralIntentionTest/convertTupleToSetNotAvailableWithoutSetLiterals.py | Python | apache-2.0 | 18 |
import fnmatch
import mimetypes
import os
import re
import signal
import time
import traceback
from multiprocessing import Process, JoinableQueue, Queue
import chardet
import psutil
from lib.FileManager.FM import REQUEST_DELAY
from lib.FileManager.workers.baseWorkerCustomer import BaseWorkerCustomer
from misc.helperU... | LTD-Beget/sprutio-rpc | lib/FileManager/workers/sftp/findText.py | Python | gpl-3.0 | 8,040 |
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & Contributors.
#
# 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 Licen... | cylc/cylc | cylc/flow/config.py | Python | gpl-3.0 | 90,031 |
from jx_bigquery import bigquery
from jx_mysql.mysql import (MySQL,
sql_query)
from jx_mysql.mysql_snowflake_extractor import MySqlSnowflakeExtractor
from jx_python import jx
from mo_files import File
from mo_json import (json2value,
value2json)
from mo_logs import (Log,... | KWierso/treeherder | treeherder/extract/extract_jobs.py | Python | mpl-2.0 | 5,395 |
# Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework 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
... | jaloren/robotframework | src/robot/libraries/BuiltIn.py | Python | apache-2.0 | 146,969 |
#!/usr/bin/env python
# Google Code Jam 2017. Round 1B
# Problem B. Stable Neigh-bors
#
# * Problem
# You are lucky enough to own N pet unicorns. Each of your unicorns has
# either one or two of the following kinds of hairs in its mane: red hairs,
# yellow hairs, and blue hairs. The color of a mane depends on exactly ... | kkutt/codejam | codejam_2017/round_1b/stableneighbors/StableNeighBors.py | Python | mit | 7,160 |
###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... | talha81/TACTIC-DEV | src/tactic/ui/widget/data_export_wdg.py | Python | epl-1.0 | 50,022 |
q = int(input())
for _ in range(q):
n = int(input())
a = list(map(int, input().split()))
a.sort()
a2 = [a[i] for i in range(0, len(a), 2)]
a3 = [a[i+1] for i in range(0, len(a), 2)]
if a2 != a3:
print("NO")
continue
a3.reverse()
areas = [ai * aj for ai, aj in zip(a2, a3... | mathemage/CompetitiveProgramming | codeforces/div3/1203/B/B.py | Python | mit | 410 |
# Copyright FuseSoC contributors
# Licensed under the 2-Clause BSD License, see LICENSE for details.
# SPDX-License-Identifier: BSD-2-Clause
import pytest
def test_deptree(tmp_path):
import os
from fusesoc.config import Config
from fusesoc.coremanager import CoreManager
from fusesoc.edalizer import ... | olofk/fusesoc | tests/test_coremanager.py | Python | bsd-2-clause | 6,691 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_long_term_retention_policies_operations.py | Python | mit | 16,070 |
from __future__ import division, unicode_literals
from ml.similarity import pre_process, TfidfCluster
from textblob import TextBlob as tb
import nltk, re, pprint
import nltk.chunk
from nltk.corpus import twitter_samples
from nltk import tag
from nltk.corpus import wordnet
from nltk.corpus.reader.wordnet import POS_LIST... | marquesarthur/BugAnalysisRecommender | dataset/tests/test_nltk_ne_verbs.py | Python | mit | 8,055 |
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies and Contributors
# See license.txt
from __future__ import unicode_literals
import unittest
class TestGoogleMapsSettings(unittest.TestCase):
pass
| ESS-LLP/frappe | frappe/integrations/doctype/google_maps_settings/test_google_maps_settings.py | Python | mit | 213 |
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
#
# License: BSD 3 clause
import numpy as np
from scipy import sparse
import warnings
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from sklea... | uglyboxer/linear_neuron | net-p3/lib/python3.5/site-packages/sklearn/linear_model/tests/test_base.py | Python | mit | 10,447 |
from django.conf.urls import url
from . import views
app_name = 'osf'
urlpatterns = [
url(r'^reviews/$', views.ReviewActionListCreate.as_view(), name=views.ReviewActionListCreate.view_name),
url(r'^requests/$', views.NodeRequestActionCreate.as_view(), name=views.NodeRequestActionCreate.view_name),
url(r'... | binoculars/osf.io | api/actions/urls.py | Python | apache-2.0 | 412 |
# Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | tensorflow/neural-structured-learning | research/gam/gam/models/mlp.py | Python | apache-2.0 | 10,172 |
import cv2
cap = cv2.VideoCapture('/path/to/video') #import video
count = 0
n = 360 #Number of frames to skip
while cap.isOpened():
ret,frame = cap.read() # Read video frame
cv2.imshow('Video Annotation',frame)
cv2.imwrite("frame%d.jpg" % count, frame) #Save every nth frame
count = count + n
if c... | karanchawla/100DaysofCode | day1/video_to_images.py | Python | mit | 408 |
# Copyright 2014 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 agre... | jettisonjoe/openhtf | examples/all_the_things.py | Python | apache-2.0 | 6,199 |
import pytest
import os
import pkg_resources
import numpy as np
from psoap import orbit_astrometry
from psoap import constants as C
import matplotlib.pyplot as plt
import matplotlib
# Create plots of all of the orbits
from astropy.io import ascii
# Create plots of all of the orbits
# If it doesn't already exist, cr... | iancze/PSOAP | tests/test_orbit_astrometry_41Dra.py | Python | mit | 11,690 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
The L{_response} module contains constants for all standard HTTP codes, along
with a mapping to the corresponding phrases.
"""
from __future__ import division, absolute_import
import string
from twisted.trial import unittest
from twisted.web... | Architektor/PySnip | venv/lib/python2.7/site-packages/twisted/web/test/test_web__responses.py | Python | gpl-3.0 | 877 |
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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 ... | StackStorm/st2 | st2common/tests/unit/test_transport.py | Python | apache-2.0 | 6,878 |
#!/usr/bin/env python
#
# Copyright 2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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)
... | pgoeser/gnuradio | gnuradio-examples/python/pfb/synth_filter.py | Python | gpl-3.0 | 2,042 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# MIT License. See license.txt
from __future__ import unicode_literals
import webnotes, json
from webnotes.widgets import reportview
@webnotes.whitelist()
def get_data(module, doctypes='[]'):
doctypes = json.loads(doctypes)
return {
"reports": get_report_list... | rohitw1991/latestadbwnf | webnotes/widgets/moduleview.py | Python | mit | 1,363 |
import asyncio
from functools import partial
class AsyncWrapper:
def __init__(self, target_instance, executor=None):
self._target_inst = target_instance
self._loop = asyncio.get_event_loop()
self._executor = executor
def __getattribute__(self, name):
try:
return su... | KeepSafe/translation-real-time-validaton | notifier/executor.py | Python | apache-2.0 | 708 |
#!/usr/bin/env python
import sys
import argparse
import logging
from Bio import SeqIO
logging.basicConfig(level=logging.INFO)
log = logging.getLogger()
def drop_id(fasta_file=None):
for rec in SeqIO.parse(fasta_file, "fasta"):
rec.description = ""
ind = str(rec.seq).find("##")
if (
... | TAMU-CPT/galaxy-tools | tools/fasta/fasta_remove_id.py | Python | gpl-3.0 | 846 |
import sqlalchemy
from sqlalchemy import Column, Integer, String
from sqlalchemy.orm import mapper, sessionmaker
import subprocess
class PygrationState(object):
'''Python object representing the state table'''
def __init__(self, migration=None, step_id=None, step_name=None):
self.migration = migration
... | mdg/pygrate | pygration/db.py | Python | apache-2.0 | 2,877 |
# Copyright (C) 2021 Nippon Telegraph and Telephone 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/LICE... | openstack/tacker | tacker/sol_refactored/objects/v2/affected_vnfc.py | Python | apache-2.0 | 1,888 |
# Copyright 2008-2009 WebDriver committers
# Copyright 2008-2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | softak/webfaction_demo | vendor-local/lib/python/selenium/common/exceptions.py | Python | bsd-3-clause | 4,099 |
#ImportModules
import ShareYourSystem as SYS
#Definition a Getter
MyGetter=SYS.GetterClass()
MyGetter.MyInt=1
#print
print("MyGetter['MyFloat'] is ")
print(MyGetter['MyFloat'])
print('\n')
#print
print("MyGetter['MyInterfacer'] is ")
print(MyGetter['MyInterfacer'])
print('\n')
#print
print("MyGetter.get('MyStr',... | Ledoux/ShareYourSystem | Pythonlogy/build/lib/ShareYourSystem/Standards/Itemizers/Getter/05_ExampleDoc.py | Python | mit | 491 |
#!/usr/bin/env python
# Copyright 2009-2016 Thomas Paviot (tpaviot@gmail.com)
##
# This file is part of pythonOCC.
##
# pythonOCC is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the... | tpaviot/pythonocc-core | src/Display/SimpleGui.py | Python | lgpl-3.0 | 9,307 |
import os
import re
from queue import Queue
from shutil import which
from unittest.case import skipIf
from bears.python.PyLintBear import PyLintBear
from tests.LocalBearTestHelper import LocalBearTestHelper
from coalib.settings.Section import Section
from coalib.settings.Setting import Setting
@skipIf(which('pylint'... | sals1275/coala-bears | tests/python/PyLintBearTest.py | Python | agpl-3.0 | 2,109 |
import itertools
import os
import pprint
import re
from math import isclose
import lmfit
import numpy as np
import pandas as pd
import peakutils as pku
from ImagingReso.resonance import Resonance
import ImagingReso._utilities as reso_util
from cerberus import Validator
import matplotlib.pyplot as plt
x_type_list = ['... | ornlneutronimaging/ResoFit | ResoFit/_utilities.py | Python | bsd-3-clause | 25,822 |
import numpy as np
from explauto.utils import rand_bounds, bounds_min_max, softmax_choice, prop_choice
from explauto.utils.config import make_configuration
from learning_module import LearningModule
class Supervisor(object):
def __init__(self, config, model_babbling="random", n_motor_babbling=0, explo_noise=0.1,... | sebastien-forestier/PLAY2017 | play/learning/supervisor.py | Python | gpl-3.0 | 11,933 |
from django.contrib.contenttypes.models import ContentType
from django.core.paginator import Paginator
from django.http import Http404
from django.template.response import TemplateResponse
from wagtail.core.models import Page
def content_type_use(request, content_type_app_name, content_type_model_name):
try:
... | FlipperPA/wagtail | wagtail/admin/views/pages/usage.py | Python | bsd-3-clause | 1,032 |
#!/usr/bin/env python
import sys
import gzip
import paddle.v2 as paddle
### Parameters
word_vector_dim = 620
latent_chain_dim = 1000
beam_size = 5
max_length = 50
def seq2seq_net(source_dict_dim, target_dict_dim, generating=False):
'''
Define the network structure of NMT, including encoder and decoder.
... | zhaopu7/models | nmt_without_attention/nmt_without_attention.py | Python | apache-2.0 | 8,713 |
#!/usr/bin/env python3
import torch
from .. import settings
def pivoted_cholesky(matrix, max_iter, error_tol=None):
from ..lazy import lazify, LazyTensor
batch_shape = matrix.shape[:-2]
matrix_shape = matrix.shape[-2:]
if error_tol is None:
error_tol = settings.preconditioner_tolerance.val... | jrg365/gpytorch | gpytorch/utils/pivoted_cholesky.py | Python | mit | 3,313 |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (c) 2012, Peter Levi <peterlevi@peterlevi.com>
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free So... | GLolol/variety | variety/PreferencesVarietyDialog.py | Python | gpl-3.0 | 58,437 |
"""
HTML parsing library based on the WHATWG "HTML5"
specification. The parser is designed to be compatible with existing
HTML found in the wild and implements well-defined error recovery that
is largely compatible with modern desktop web browsers.
Example usage:
import html5lib
f = open("my_document.html")
tree = ht... | ordbogen/html5lib-python | html5lib/__init__.py | Python | mit | 788 |
import sys
def setup(core, object):
object.setStfFilename('static_item_n')
object.setStfName('item_wookiee_gloves_02_01')
object.setDetailFilename('static_item_d')
object.setDetailName('item_wookiee_gloves_02_01')
object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 3)
object.setStringAttribute(... | ProjectSWGCore/NGECore2 | scripts/object/tangible/wearables/wookiee/item_smuggler_gloves_02_01.py | Python | lgpl-3.0 | 357 |
#!/usr/bin/env python
"""This script allows to create arbitrarily large files with the desired
combination of groups, tables per group and rows per table.
Issue "python stress-test3.py" without parameters for a help on usage.
"""
import gc
import sys
from time import perf_counter as clock
from time import process_t... | avalentino/PyTables | bench/stress-test3.py | Python | bsd-3-clause | 8,612 |
"""
Objects for dealing with polynomials.
This module provides a number of objects (mostly functions) useful for
dealing with polynomials, including a `Polynomial` class that
encapsulates the usual arithmetic operations. (General information
on how this module represents and works with polynomial objects is in
the do... | shoyer/numpy | numpy/polynomial/polynomial.py | Python | bsd-3-clause | 48,632 |
from __future__ import division
import sys
sys.path.append('../spherepy')
import spherepy as sp
#TODO: Change all xrange instances to range
#and do a 'from six.moves import range' here
from six.moves import xrange
fs = """
c[n, m]
=======
2: {7} {4} {2} {6} {8}
1: {3} {1} {5}
0: ... | rdireen/spherepy | examples/test_plot.py | Python | gpl-3.0 | 1,000 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# PyNurseryRhymesDemo
# The MIT License
#
# Copyright (c) 2010,2015 Jeremie DECOCK (http://www.jdhp.org)
#
# 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 ... | jeremiedecock/snippets | python/distutils/example_without_dependency/setup.py | Python | mit | 3,069 |
from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
# Forward declared intermediate model
@python_2_unicode_compatible
class Membership(models.Model):
person = models.ForeignKey('Person')
... | openhatch/new-mini-tasks | vendor/packages/Django/tests/regressiontests/m2m_through_regress/models.py | Python | apache-2.0 | 2,634 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.http import HttpResponseRedirect
from .api import Base, ExampleAuthenticated, ExampleAdmin
#from config import settings
from django.conf import settings
admin.autodiscover()
urlpatterns = patterns('',
url(r'^api/v1/se... | almey/policycompass-services | policycompass_services/urls.py | Python | agpl-3.0 | 1,413 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-10-18 18:43
from __future__ import unicode_literals
from django.core.exceptions import ObjectDoesNotExist
from django.db import migrations, models
import django.db.models.deletion
def set_planrepository(apps, schema_editor):
Build = apps.get_model('bui... | SalesforceFoundation/mrbelvedereci | metaci/build/migrations/0019_build_planrepo.py | Python | bsd-3-clause | 1,072 |
import json
import os
import sys
import webbrowser
import code
import click
from plaintable import Table
from rst2ansi import rst2ansi
import cumulusci
from cumulusci.core.config import ConnectedAppOAuthConfig
from cumulusci.core.config import FlowConfig
from cumulusci.core.config import OrgConfig
from cumulusci.core... | Joble/CumulusCI | cumulusci/cli/cli.py | Python | bsd-3-clause | 27,515 |
# -*- coding: utf-8 -*-
"""
Jinja Documentation Extensions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for automatically documenting filters and tests.
:copyright: Copyright 2008 by Armin Ronacher.
:license: BSD.
"""
import collections
import os
import re
import inspect
import jinja2
from itertools imp... | jackTheRipper/iotrussia | web_server/lib/jinja2-master/docs/jinjaext.py | Python | gpl-2.0 | 6,923 |
#
# Copyright John Reid 2007, 2008
#
"""
Code to build HMM models of PSSMs of various Markov orders.
"""
import hmm, numpy, pickle
def _load_model_parameters(model, f):
parameters = pickle.load(f)
if len(parameters) != len(model.parameters):
raise RuntimeError('Different number of parameters in fil... | JohnReid/biopsy | Python/hmm/pssm/model_builder.py | Python | mit | 5,519 |
import unittest
import numpy as np
import numpy.testing as np_test
from pgmpy.inference import VariableElimination
from pgmpy.inference import BeliefPropagation
from pgmpy.models import BayesianModel, MarkovModel
from pgmpy.models import JunctionTree
from pgmpy.factors import TabularCPD
from pgmpy.factors import Facto... | anaviltripathi/pgmpy | pgmpy/tests/test_inference/test_ExactInference.py | Python | mit | 21,305 |
#!/usr/bin/env python
# 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 ... | youtube/cobalt | third_party/libxml/port.py | Python | bsd-3-clause | 3,830 |
from django import forms
class WakeOnLan(forms.Form):
computer_name = forms.CharField(max_length=30, required=False, help_text='Enter your ip or hostname') | Oleh-Hrebchuk/WakeOnLanDjango | wakeonlanapp/forms.py | Python | gpl-3.0 | 161 |
# Google Home page example
#
# Author: Dnpwwo, 2017 - 2018
#
# Demonstrates HTTP/HTTPS connectivity.
# After connection it performs a GET on www.google.com and receives a 302 (Page Moved) response
# It then does a subsequent GET on the Location specified in the 302 response and receives a 200 response.
#
"""
<pl... | gordonb3/domoticz | plugins/examples/HTTP.py | Python | gpl-3.0 | 8,304 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
#
# Invenio 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... | dset0x/invenio-deposit | setup.py | Python | gpl-2.0 | 4,296 |
import decimal
import logging
from decimal import Decimal
from django.db import models, transaction
from django.contrib.auth.models import User, Group
from django.db.models.signals import post_save # pre_save,
from django.dispatch import receiver
LOGGER = logging.getLogger(__name__)
# Model Product
class Product(mo... | 0rent/0rent | orentapp/models.py | Python | agpl-3.0 | 7,518 |
#!/usr/bin/env python
'''
WebSocket client based on ws4py
Initial design inspired by:
https://ws4py.readthedocs.org/en/latest/sources/clienttutorial/
Another library Autobahn worth checking:
http://autobahn.ws/python/
'''
import json
import os
import sys
import time
import logging
import argparse
from collections ... | MikaelSmith/cpp-pcp-client | scripts/cthun_test.py | Python | apache-2.0 | 6,944 |
# Copyright 2012 OpenStack 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 applicable law or agreed to in... | jumpstarter-io/keystone | keystone/tests/unit/test_auth.py | Python | apache-2.0 | 56,629 |
#! /usr/bin/env python
# coding = utf-8
__author__ = 'jeff.yu'
from random import choice
from string import lowercase
from string import digits
import datetime
"""
{"time_stamp":"2014-01-02T01:10:00Z",
"click_id":"43306130-ff65-436b-9851-1e2650000021",
"campaign_id":"t_571",
"offer_id":109,
"ref_site":"",
"site":""... | yfsuse/Traxex | com/yeahmobi/common/dataProducer.py | Python | gpl-2.0 | 8,757 |
#
# Copyright (c) 2008--2015 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 c... | mcalmer/spacewalk | spacewalk/certs-tools/sslToolConfig.py | Python | gpl-2.0 | 26,685 |
# Copyright 2014 Mellanox Technologies, Ltd
#
# 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 t... | cloudbase/neutron | neutron/plugins/ml2/drivers/mech_sriov/agent/eswitch_manager.py | Python | apache-2.0 | 17,105 |
VERSION = (0, 5, 1)
from .decorators import job
from .queues import enqueue, get_connection, get_queue, get_scheduler
from .workers import get_worker
| meteozond/django-rq | django_rq/__init__.py | Python | mit | 151 |
# Software License Agreement (BSD License)
#
# Copyright (c) 2013, Eric Perko
# 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 copyrigh... | suzlab/Autoware | ros/src/sensing/drivers/gnss/packages/javad_navsat_driver/lib/libjavad_navsat_driver/driver.py | Python | bsd-3-clause | 7,841 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import babel.dates
import collections
from datetime import datetime, timedelta
from dateutil import parser
from dateutil import rrule
from dateutil.relativedelta import relativedelta
import logging
from operator import i... | hip-odoo/odoo | addons/calendar/models/calendar.py | Python | agpl-3.0 | 72,599 |
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Test cases for dirdbm module.
"""
from twisted.trial import unittest
from twisted.persisted import dirdbm
import os, shutil, glob
class DirDbmTestCase(unittest.TestCase):
def setUp(self):
self.path = self.mktemp()
... | tquilian/exeNext | twisted/test/test_dirdbm.py | Python | gpl-2.0 | 5,257 |
#!/usr/bin/env python
#coding: UTF-8
#
# (c) 2014 Samuel Groß <dev@samuel-gross.de>
#
import os
import sys
import importlib
from time import sleep
try:
import concurrent.futures
except ImportError:
pass
#
# Functions
#
def warn(msg):
sys.stderr.write('WARNING: ' + msg + '\n')
def err(msg):
sys.stderr.... | saelo/sekretaer | sekretaer/core.py | Python | mit | 5,590 |
import cProfile
import data_loader
import data_manipulator
import data_saver
import neural_net
def main():
test_batch, train_batch = data_loader.load_data()
data_manipulator.categorize(train_batch, test_batch)
model = neural_net.get_trained_model(train_batches=train_batch,
... | maciewar/AGH-Deep-Learning-CIFAR10 | cifar.py | Python | mit | 764 |
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or impli... | beav/pulp | nodes/test/unit/test_extensions_sync_schedules.py | Python | gpl-2.0 | 5,703 |
"""Test file anonymization."""
# Copyright 2018 Intentionet
#
# 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 ... | intentionet/netconan | tests/unit/test_anonymize_files.py | Python | apache-2.0 | 6,740 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2015 clowwindy
#
# 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 b... | meowlab/shadowsocks-comment | shadowsocks/shell.py | Python | apache-2.0 | 12,526 |
from .dual import DualGraph
from .graph import Graph, NetworkGraph
from .graph_convention import ConventionConverter, GraphConvention
from .hex import DualHexGraph, TriGraph
from .radial import DualRadialGraph, RadialGraph
from .structured_quad import (
DualRectilinearGraph,
DualStructuredQuadGraph,
DualUni... | cmshobe/landlab | landlab/graph/__init__.py | Python | mit | 887 |
#!/usr/bin/env python
from __future__ import print_function
import requests
import requests_cache
import bz2
import configparser
import re
from pprint import pprint
#from cStringIO import StringIO
from io import BytesIO
import tarfile
# only other sort-of-trustable mirror
# BASE_URL = "http://mirrors.dotsrc.org/cy... | iljau/cyg_fetcher | fetch_package_list.py | Python | mit | 5,401 |
# pylint: disable=g-bad-file-header
# 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/LICENS... | dhalleine/tensorflow | tensorflow/python/client/quantize_training_test.py | Python | apache-2.0 | 1,626 |
from django.contrib.auth import get_user_model
from rest_framework_json_api import relations
from rest_framework_json_api.serializers import DurationField, IntegerField, Serializer
from timed.projects.models import Customer, Project, Task
from timed.serializers import TotalTimeRootMetaMixin
class YearStatisticSerial... | adfinis-sygroup/timed-backend | timed/reports/serializers.py | Python | agpl-3.0 | 2,106 |
from django.core.management.base import BaseCommand, CommandError
from optparse import make_option
from django_extensions.management.modelviz import generate_dot
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--disable-fields', '-d', action='store_true', dest='disable_f... | shash/IconDB | django_extensions/management/commands/graph_models.py | Python | agpl-3.0 | 3,657 |
# Copyright 2018 ForgeFlow, S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, models
class OutstandingStatement(models.AbstractModel):
"""Model of Outstanding Statement"""
_inherit = "statement.common"
_name = "report.partner_sta... | OCA/account-financial-reporting | partner_statement/report/outstanding_statement.py | Python | agpl-3.0 | 7,210 |
from bigsi.bloom.bloomfilter import generate_hashes
from bigsi.bloom.bloomfilter import BloomFilter
| Phelimb/cbg | bigsi/bloom/__init__.py | Python | mit | 100 |
import wave
import struct
import math
SAMPLE_LEN = 15000
noise_output = wave.open('noise.wav', 'w')
noise_output.setparams((2, 2, 44100, 0, 'NONE', 'not compressed'))
for i in range(0, SAMPLE_LEN):
value = int(math.sin(i)*400)
packed_value = struct.pack('h', value)
noise_output.writeframes(pa... | dasMalle/AScriptADay2016 | January/10-NoiseCreator/sound.py | Python | gpl-2.0 | 401 |
import sys
import xbmc
import platform
def get_platform():
ret = {
"arch": sys.maxsize > 2 ** 32 and "x64" or "x86",
"os": "",
"version": platform.release()
}
if xbmc.getCondVisibility("system.platform.android"):
ret["os"] = "android"
if "arm" in platform.machine() ... | afedchin/xbmctorrent | resources/site-packages/xbmctorrent/osarch.py | Python | gpl-3.0 | 1,418 |
from collections import OrderedDict
GENDERS = (
'male',
'female',
'unknown'
)
AFFECTED_STATUSES = (
'affected',
'unaffected',
'unknown'
)
class Individual():
def __init__(self, indiv_id, **kwargs):
self.indiv_id = indiv_id
self.project_id = kwargs.get('project_id', '.')
... | macarthur-lab/xbrowse | xbrowse/core/samples.py | Python | agpl-3.0 | 3,504 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | sxjscience/tvm | python/tvm/tir/op.py | Python | apache-2.0 | 28,372 |
"""Defined search unit tests."""
# Copyright 2015 Solinea, 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 appli... | slashk/goldstone-server | goldstone/core/tests_saved_search_view.py | Python | apache-2.0 | 8,909 |
# Copyright (c) 2013-2016 Molly White
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software
# and associated documentation files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use, copy, modify, merge, publish,
# di... | quanticle/GorillaBot | gorillabot/plugins/info.py | Python | mit | 6,878 |
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from __future__ import with_statement
import os
import sys
from datetime import datetime
# workaround on osx, disable kqueue
if sys.platform == "darwin":
os.environ['EVENT_NOKQUEUE'] = "... | samabhi/pstHealth | venv/lib/python2.7/site-packages/gunicorn/workers/ggevent.py | Python | mit | 3,735 |
x = []
n = int(raw_input())
for j in range(n):
a = str(raw_input())
if(a=='pwd'):
if(len(x)==0):
print '/'
else:
print '/'+'/'.join(x)+'/'
else:
a = a[3:]
b = map(str,a.split('/'))
if(a[0]=='/'):
x = []
for i in b:
if(len(i) is not 0):
if(i == '..'):
x.pop(len(x)-1)
else:
x.... | Sarthak30/Codeforces | cd_and_pwd_commands.py | Python | gpl-2.0 | 334 |
#!/usr/bin/env python
from PyQt5.QtWidgets import QTextEdit, QMenu, QFileDialog, QSizePolicy
import mooseutils
class TerminalTextEdit(QTextEdit):
"""
A readonly text edit that replaces terminal codes with appropiate html codes.
Also uses fixed font.
"""
def __init__(self, **kwds):
super(Ter... | backmari/moose | python/peacock/Execute/TerminalTextEdit.py | Python | lgpl-2.1 | 1,846 |
#! /usr/bin/python
## \file menu.py
# \brief General Menu Class
# \author Scott Barlow
# \date 2009
# \version 1.0.3
#
# This is a menu class written for pygame/Python. The menu is designed to work
# with a program using a finite state machine (but it could also be easily
# modified to have the 'buttons' retu... | dhatch/PyRunner | menu.py | Python | gpl-2.0 | 32,636 |
import pytest
from model.knowledge_representation import Competency, Fact, Curriculum, get_available_facts
__author__ = 'e.kolpakov'
class TestCurriculum:
@pytest.fixture
def curriculum(self):
return Curriculum()
def test_empty_curriculum_all_lookups_return_none(self, curriculum):
asser... | e-kolpakov/study-model | tests/test_knowledge_representation.py | Python | mit | 2,826 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dc_campaign_finance_data_processor.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| codefordc/dc-campaign-finance-data-processor | dc_campaign_finance_data_processor/manage.py | Python | mit | 277 |
from django import forms
class PutForm(forms.Form):
body = forms.CharField(widget=forms.Textarea())
tube = forms.CharField(initial='default')
priority = forms.IntegerField(initial=2147483648)
delay = forms.IntegerField(initial=0)
ttr = forms.IntegerField(initial=120)
| andreisavu/django-jack | jack/beanstalk/forms.py | Python | apache-2.0 | 291 |
import os
from glob import iglob
for file in iglob('./**/*.md', recursive=True):
print(file.replace('\\','/')[1:-3])
path = False
pastFirstLine = False
with open(file, "r") as f:
try:
lines = f.readlines()
except:
print("Error with " + file)
continue
... | FRCTeam2984/Website | src/markdown-pages/convert.py | Python | mit | 912 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2003-2006 Donald N. Allingham
# 2009 Gary Burton
#
# 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... | SNoiraud/gramps | gramps/gui/selectors/selectrepository.py | Python | gpl-2.0 | 2,510 |
# -*- coding: utf-8 -*-
import csv
import json
from cStringIO import StringIO
from datetime import datetime
from django.conf import settings
from django.core import mail
from django.core.cache import cache
import mock
from pyquery import PyQuery as pq
from olympia import amo
from olympia.amo.tests import TestCase
fr... | andymckay/addons-server | src/olympia/zadmin/tests/test_views.py | Python | bsd-3-clause | 77,618 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.