text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
# Copyright (c) 2015, Simone Margaritelli <evilsocket at gmail dot com>
# 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 notic... | evilsocket/arminject | trace_pid.py | Python | bsd-3-clause | 2,396 | 0.005426 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-11-30 15:02
from __future__ import unicode_literals
from django.db import migrations, utils
from django.db import transaction
def copy_previous_pgrm_to_current_lunit(apps, model):
base = apps.get_app_config('base')
ProgramManager = base.get_model('... | uclouvain/osis_louvain | base/migrations/0198_auto_20171130_1602.py | Python | agpl-3.0 | 1,184 | 0.002534 |
# Copyright 2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | kogotko/carburetor | openstack_dashboard/dashboards/project/security_groups/panel.py | Python | apache-2.0 | 783 | 0 |
import os
import pytest
@pytest.mark.bashcomp(cmd="pkgconf")
class TestPkgconf:
@pytest.mark.complete("pkgconf ")
def test_1(self, completion):
assert completion
@pytest.mark.complete("pkgconf -", require_cmd=True)
def test_2(self, completion):
assert completion
@pytest.mark.com... | algorythmic/bash-completion | test/t/test_pkgconf.py | Python | gpl-2.0 | 548 | 0 |
# #
# Copyright 2009-2019 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (... | gppezzi/easybuild-framework | easybuild/tools/build_log.py | Python | gpl-2.0 | 13,380 | 0.00299 |
"""Blocking and non-blocking HTTP client interfaces.
This module defines a common interface shared by two implementations,
``simple_httpclient`` and ``curl_httpclient``. Applications may either
instantiate their chosen implementation class directly or use the
`AsyncHTTPClient` class from this module, which selects an... | mr-ping/tornado | tornado/httpclient.py | Python | apache-2.0 | 27,522 | 0.000145 |
# -*- coding: utf-8 -*-
# Copyright 2018 Lorenzo Battistini - Agile Business Group
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
{
"name": "Causali pagamento per ritenute d'acconto",
"version": "10.0.1.0.0",
"development_status": "Beta",
"category": "Hidden",
"website": "https://g... | linkitspa/l10n-italy | l10n_it_withholding_tax_causali/__manifest__.py | Python | agpl-3.0 | 677 | 0 |
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import os
import pytest
import ... | srvg/ansible | test/units/galaxy/test_collection.py | Python | gpl-3.0 | 38,071 | 0.002789 |
#!/usr/bin/env python
# Tag Highlighter:
# Author: A. S. Budden <abudden _at_ gmail _dot_ com>
# Copyright: Copyright (C) 2009-2011 A. S. Budden
# Permission is hereby granted to use and distribute this code,
# with or without modifications, provided that this copyright
# notice is c... | radio-ho0/dotfiles | _vim/plugin/TagHighlight/module/utilities.py | Python | gpl-2.0 | 5,265 | 0.003609 |
###############################################################################
# This file is part of openWNS (open Wireless Network Simulator)
# _____________________________________________________________________________
#
# Copyright (C) 2004-2007
# Chair of Communication Networks (ComNets)
# Kopernikusstr. 16, D-... | creasyw/IMTAphy | framework/library/PyConfig/openwns/probebus.py | Python | gpl-2.0 | 9,523 | 0.006826 |
#! /usr/bin/env python
"""
Module for stats of a fits-cube.
"""
from __future__ import division
__author__ = 'C. Gomez @ ULg'
__all__ = ['cube_stats_aperture',
'cube_stats_annulus']
import numpy as np
import scipy.stats
from matplotlib import pyplot as plt
from ..var import get_annulus, get_circle, get_... | henry-ngo/VIP | vip_hci/stats/cube_stats.py | Python | mit | 9,662 | 0.009004 |
#!/usr/bin/env python
from requests.exceptions import HTTPError
from datetime import datetime
import ystockquote
from m2x.client import M2XClient
def post_stock_price(symbol, apikey, devicename):
'''
Retrieve the stock price for the given ticker symbol ("T" for AT&T) and
post it in the correct M2X data ... | attm2x/m2x-demo-heroku-python | stockreport.py | Python | mit | 1,141 | 0.000876 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
from six import text_type
from sacremoses.corpus import Perluniprops
from sacremoses.corpus import NonbreakingPrefixes
from sacremoses.util import is_cjk
from sacremoses.indic import VIRAMAS, NUKTAS
perluniprops = Perluniprops()
nonbreaking_prefixes = Nonbrea... | alvations/sacremoses | sacremoses/tokenize.py | Python | mit | 31,370 | 0.000893 |
import matplotlib.pyplot as plt
import tensorflow as tf
from softmax_del import Softmax
from lib import mytool
'''
gildong = MnistClassifier()
gildong.learn(3, 100) # epoch, partial_size
gildong.evaluate() # for all test data
gildong.classify_random_image() # classify a randomly selected image
#gildong.show_errors()
... | JNU-Include/CNN | lib/mnist_classifier_del.py | Python | mit | 2,492 | 0.005659 |
# -*- coding: utf-8 -*-
# tools, 5 juin 2017
import string
import math
import random
import argparse
from argparse import RawTextHelpFormatter
CONSO_MAJ = u"C"
CONSO_MIN = u"c"
VOWEL_MAJ = u"V"
VOWEL_MIN = u"v"
LETTER_MAJ = u"L"
LETTER_MIN = u"l"
NUMBER = u"n"
PONCTION = u"P"
PONCTION_SMA = u"p"
VALID_CHARSET = {
... | Aidturith/python-training | utils/random_pass/random_password.py | Python | mit | 4,858 | 0.005569 |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | kubeflow/kfp-tekton-backend | sdk/python/kfp/components_tests/test_structure_model_base.py | Python | apache-2.0 | 9,140 | 0.003392 |
from django.conf.urls import patterns, url
urlpatterns = patterns('',
url(r'^$', 'charts.views.charts', name='charts'),
)
| zknyoyo/chartkick.py | examples/demo/charts/urls.py | Python | mit | 128 | 0.007813 |
import plivo, plivoxml
auth_id = "MAODU4MTK1MDC0NTBMMM"
auth_token = "MWVkNWNlZWFlYjRmYmViNDBiZDAwNjA0NjA5OTQz"
p = plivo.RestAPI(auth_id, auth_token)
params = {
'to': '14153163136', # The phone numer to which the all has to be placed
'from' : '1111111111', # The phone number to be used as the caller id
... | lucyzee/plivo_apps | outbound_call.py | Python | mit | 871 | 0.014925 |
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'ssssss.views.home', name='home'),
# ... | huaijiefeng/contact-sync-server | contactsync/urls.py | Python | apache-2.0 | 759 | 0.003953 |
# coding=utf-8
#------------------------------------------------------------------------------#
import os
import time
import fuse
import errno
from .item import RelFuseItem
from .static_dir import StaticDirectory
#------------------------------------------------------------------------------#
class MountRoot(RelFuseIte... | matus-chochlik/various | relfs/relfs/fuse/mount_root.py | Python | mit | 2,188 | 0.003199 |
import os
def Dir_toStdName(path):
if not (path[-1]=="/" or path[-1] == "//"):
path=path+"/"
return path
def Dir_getFiles(path):
path=Dir_toStdName(path)
allfiles=[]
files=os.listdir(path)
for f in files:
abs_path = path + f
if os.path.isdir(abs_path):
sub_files=Dir_getFiles(abs_path)
sub_fil... | FSource/Faeris | tool/binpy/libpy/files/Dir.py | Python | mit | 703 | 0.069701 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-04 13:35
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('marketplace', '0011_auto_20170526_1215'),
]
operations = [
migrations.Alter... | MOOCworkbench/MOOCworkbench | marketplace/migrations/0012_auto_20170604_1335.py | Python | mit | 925 | 0.002162 |
# -*- coding: utf-8 -*-
# © 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from openerp import api, models
class WebsiteMenu(models.Model):
_inherit = "website.menu"
@api.multi
def get_parents(self, revert=False, inclu... | Tecnativa/website | website_breadcrumb/models/website.py | Python | agpl-3.0 | 1,026 | 0 |
from examples import acquire_token_by_username_password
from office365.graph_client import GraphClient
client = GraphClient(acquire_token_by_username_password)
groups = client.groups.get().top(1).execute_query()
for cur_grp in groups:
cur_grp.delete_object()
client.execute_batch()
| vgrem/Office365-REST-Python-Client | examples/directory/delete_groups_batch.py | Python | mit | 289 | 0.00346 |
import logging
import os.path
import shutil
import sys
import tempfile
import fiona
def test_options(tmpdir=None):
"""Test that setting CPL_DEBUG=ON works"""
if tmpdir is None:
tempdir = tempfile.mkdtemp()
logfile = os.path.join(tempdir, 'example.log')
else:
logfile = str(tmpdir.j... | johanvdw/Fiona | tests/test_drivers.py | Python | bsd-3-clause | 760 | 0.001316 |
# #START_LICENSE###########################################################
#
#
# This file is part of the Environment for Tree Exploration program
# (ETE). http://etetoolkit.org
#
# ETE is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# t... | sauloal/cnidaria | scripts/venv/lib/python2.7/site-packages/ete2/__init__.py | Python | mit | 2,644 | 0.008699 |
import os
import shutil
import numpy as np
import flopy
from flopy.utils.util_array import Util2d, Util3d, Transient2d
out_dir = "temp"
if os.path.exists(out_dir):
shutil.rmtree(out_dir)
os.mkdir(out_dir)
def test_transient2d():
ml = flopy.modflow.Modflow()
dis = flopy.modflow.ModflowDis(ml, nlay=10, nro... | mrustl/flopy | autotest/t004_test.py | Python | bsd-3-clause | 19,118 | 0.004551 |
from odoo import fields, models
class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'
bom_id = fields.Many2one(
comodel_name='mrp.bom',
readonly=True
)
| pledra/odoo-product-configurator | product_configurator_sale_mrp/models/sale.py | Python | agpl-3.0 | 193 | 0 |
from __future__ import absolute_import, division, print_function, unicode_literals
from gratipay.elsewhere import PlatformOAuth2
from gratipay.elsewhere._extractors import any_key, key
from gratipay.elsewhere._paginators import query_param_paginator
class Google(PlatformOAuth2):
# Platform attributes
name =... | eXcomm/gratipay.com | gratipay/elsewhere/google.py | Python | cc0-1.0 | 1,648 | 0.001214 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import cgi, cgitb
import sys
sys.path.insert(0, "../planetoplot/modules")
import ppplot
import ppclass
########################################
import numpy as np
xx = np.arange(25)
yy = 3.*xx
fig = ppplot.figuref(x=8,y=6)
pl = ppplot.plot1d()
pl.fig = fig # have ... | aymeric-spiga/planetoplot | html/cgi-bin/maincgi.py | Python | gpl-2.0 | 1,620 | 0.025926 |
from __future__ import absolute_import
from sentry.testutils import AcceptanceTestCase
class AuthTest(AcceptanceTestCase):
def enter_auth(self, username, password):
# disable captcha as it makes these tests flakey (and requires waiting
# on external resources)
with self.settings(RECAPTCHA... | mitsuhiko/sentry | tests/acceptance/test_auth.py | Python | bsd-3-clause | 1,321 | 0.000757 |
# -*- coding: utf-8 -*-
from pyload.plugin.internal.DeadHoster import DeadHoster
class BayfilesCom(DeadHoster):
__name = "BayfilesCom"
__type = "hoster"
__version = "0.09"
__pattern = r'https?://(?:www\.)?bayfiles\.(com|net)/file/(?P<ID>\w+/\w+/[^/]+)'
__config = [] #@TODO: Remove in 0.4... | ardi69/pyload-0.4.10 | pyload/plugin/hoster/BayfilesCom.py | Python | gpl-3.0 | 468 | 0.014957 |
"""
sentry.utils.auth
~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import six
import logging
from django.conf import settings
from django.contrib.auth import login as _login
from d... | fotinakis/sentry | src/sentry/utils/auth.py | Python | bsd-3-clause | 6,403 | 0.000156 |
# -*- coding: utf-8 -*-
from time import time
from module.network.RequestFactory import getURL
from module.plugins.Hook import Hook
class AndroidPhoneNotify(Hook):
__name__ = "AndroidPhoneNotify"
__type__ = "hook"
__version__ = "0.04"
__config__ = [("apikey" , "str" , "API key" ... | mobo95/pyload | module/plugins/hooks/AndroidPhoneNotify.py | Python | gpl-3.0 | 2,646 | 0.016251 |
import sys
from .calc import *
from .colls import *
from .tree import *
from .decorators import *
from .funcolls import *
from .funcs import *
from .seqs import *
from .types import *
from .strings import *
from .flow import *
from .objects import *
from .namespaces import namespace
from .debug import *
from .primitiv... | musicpax/funcy | funcy/py2.py | Python | bsd-3-clause | 765 | 0.003922 |
import time
import net.mapserv as mapserv
import net.charserv as charserv
import commands
import walkto
import logicmanager
import status
import plugins
from collections import deque
from net.inventory import get_item_index, get_storage_index
from utils import extends
from actor import find_nearest_being
from chat impo... | mekolat/manachat | plugins/manaboy.py | Python | gpl-2.0 | 11,836 | 0.004562 |
# -*- coding: utf-8 -*-
import markupsafe
from modularodm import fields
from framework.auth.decorators import Auth
from website.models import NodeLog
from website.addons.base import exceptions
from website.addons.base import AddonNodeSettingsBase, AddonUserSettingsBase
from website.addons.base import StorageAddonBas... | zachjanicki/osf.io | website/addons/figshare/model.py | Python | apache-2.0 | 13,145 | 0.000685 |
from pposgd_mpi.common.mpi_running_mean_std import RunningMeanStd
import pposgd_mpi.common.tf_util as U
import tensorflow as tf
import gym
from pposgd_mpi.common.distributions import make_pdtype
class CnnPolicy(object):
recurrent = False
def __init__(self, name, ob_space, ac_space, kind='large'):
with ... | nottombrown/rl-teacher | agents/pposgd-mpi/pposgd_mpi/cnn_policy.py | Python | mit | 2,355 | 0.005945 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Ansible module to manage elasticsearch shield role
(c) 2016, Thierno IB. BARRY @barryib
Sponsored by Polyconseil http://polyconseil.fr.
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 Publ... | jcftang/ansible | lib/ansible/modules/database/misc/kibana_plugin.py | Python | gpl-3.0 | 7,030 | 0.003414 |
# coding: utf-8
# @ 2015 Valentin CHEMIERE @ Akretion
# ©2016 @author Mourad EL HADJ MIMOUNE <mourad.elhadj.mimoune@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import logging
from base64 import b64decode
import hashlib
from .common import TestConnection, ContextualStringIO
from .m... | ClearCorp/server-tools | external_file_location/tests/test_ftp.py | Python | agpl-3.0 | 3,525 | 0 |
from __future__ import unicode_literals
from django.db import models
from jsonfield import JSONField
SEVERITY_CHOICES = [('c', "critical"), ('w', "warning"), ('i', "info")]
class Event(models.Model):
description = models.TextField(max_length=500, default='')
severity = models.CharField(('severity'), choices=... | antipoachingmap/django-app | antipoaching/models.py | Python | mit | 909 | 0.018702 |
#
# Copyright 2016-2017 Red Hat, 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 2 of the License, or
# (at your option) any later version.
#
# This program is distributed ... | oVirt/vdsm | lib/vdsm/metrics/hawkular.py | Python | gpl-2.0 | 2,524 | 0 |
"""
A socket wrapper that uses Event IO.
"""
import socket
import event
import time
import logging
import errno
import traceback
import os
from collections import deque
# TODO: Use new io objects from 2.6
# 26 July 10 - I looked into this and a potential problem with io.StringIO is
# that it assumes all text is unico... | agoragames/py-eventsocket | eventsocket.py | Python | bsd-3-clause | 20,384 | 0.01771 |
"""Utility functions for handling and fetching repo archives in zip format."""
from __future__ import absolute_import
import os
import tempfile
from zipfile import ZipFile
import requests
try:
# BadZipfile was renamed to BadZipFile in Python 3.2.
from zipfile import BadZipFile
except ImportError:
from z... | luzfcb/cookiecutter | cookiecutter/zipfile.py | Python | bsd-3-clause | 4,640 | 0 |
# -*- coding: utf-8 -*-
import cereconf
__version__ = "1.5"
IP_NUMBER = 'IPNumber'
IPv6_NUMBER = 'IPv6Number'
DNS_OWNER='DnsOwner'
REV_IP_NUMBER = 'IPNumber_rev'
A_RECORD = 'ARecord'
AAAA_RECORD = 'AAAARecord'
HOST_INFO = 'HostInfo'
MX_SET = 'MXSet'
SRV_TARGET = "SRV_target"
SRV_OWNER = "SRV_owner"
GENERAL_DNS_RECOR... | unioslo/cerebrum | Cerebrum/modules/dns/__init__.py | Python | gpl-2.0 | 561 | 0.003565 |
#!/usr/bin/env python3
# -*- mode: python -*-
import os, sys
if __name__ != '__main__':
sys.exit(1)
from argparse import ArgumentParser
_NAME_ = "pbench-base.py"
parser = ArgumentParser(_NAME_)
parser.add_argument(
"-C", "--config", dest="cfg_name",
help="Specify config file")
parser.set_defaults(cfg_na... | k-rister/pbench | server/bin/pbench-base.py | Python | gpl-3.0 | 2,404 | 0.00624 |
import sys
import numpy as np
#from OpenGL.GL import *
#from OpenGL.GLU import *
try:
import wx
from wx import glcanvas
from wx.glcanvas import GLCanvas
except ImportError:
raise ImportError, "Required dependency wx.glcanvas not present"
try:
from OpenGL.GL import *
from OpenGL.GLU import glu... | fboers/jumegX | tsvgl/old/jumeg_tsv_wx02.py | Python | bsd-3-clause | 11,636 | 0.019337 |
# -*- coding: utf-8 -*-
from couchdb.design import ViewDefinition
from couchdb.http import HTTPError
from time import sleep
from random import randint
import os
def add_index_options(doc):
doc['options'] = {'local_seq': True}
start_date_chronograph = ViewDefinition(
'chronograph',
'start_date',
open... | openprocurement/openprocurement.auction | openprocurement/auction/design.py | Python | apache-2.0 | 2,643 | 0.001135 |
# -*- coding: utf-8 -*-
import cStringIO
import contextlib
import datetime
import hashlib
import inspect
import logging
import math
import mimetypes
import unicodedata
import os
import re
import time
import urlparse
from PIL import Image
from sys import maxint
import werkzeug
# optional python-slugify import (https:/... | ubic135/odoo-design | addons/website/models/website.py | Python | agpl-3.0 | 36,133 | 0.003709 |
import collections
import requests
MovieResult = collections.namedtuple(
'MovieResult',
"imdb_code,title,duration,director,year,rating,imdb_score,keywords,genres")
def find_movies(search_text):
if not search_text or not search_text.strip():
raise ValueError("Search text is required")
# This... | mikeckennedy/python-jumpstart-course-demos | apps/10_movie_search/final/movie_svc.py | Python | mit | 715 | 0 |
from flask import render_template, redirect, request, url_for, flash
from flask.ext.login import login_user, current_user, logout_user, login_required
from . import auth
from ..models import User, AnonymousUser
from .forms import LoginForm, RegistrationForm, ChangePasswordForm, \
PasswordResetRequestForm, PasswordR... | AguNnamdi/flask_microblog | app/auth/views.py | Python | mit | 5,982 | 0.003176 |
#!/usr/bin/env python
import os
import sys
from swampdragon.swampdragon_server import run_server
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "flat.settings")
host_port = sys.argv[1] if len(sys.argv) > 1 else None
run_server(host_port=host_port)
| bilbeyt/ITURO-Giant_Flat | flat/server.py | Python | mit | 254 | 0 |
"""
This module signs newly installed client puppet certificates if the
puppet master server is running on the same machine as the cobbler
server.
Based on:
http://www.ithiriel.com/content/2010/03/29/writing-install-triggers-cobbler
"""
from builtins import str
import re
import cobbler.utils as utils
def register():... | jmaas/cobbler | cobbler/modules/installation/post_puppet.py | Python | gpl-2.0 | 1,712 | 0.002336 |
# Principal Component Analysis Code :
from numpy import mean,cov,double,cumsum,dot,linalg,array,rank,size,flipud
from pylab import *
import numpy as np
import matplotlib.pyplot as pp
#from enthought.mayavi import mlab
import scipy.ndimage as ni
import roslib; roslib.load_manifest('sandbox_tapo_darpa_m3')
import ro... | tapomayukh/projects_in_python | sandbox_tapo/src/skin_related/BMED_8813_HAP/Features/single_feature/results/cross_validate_categories_BMED_8813_HAP_scaled_method_II_force.py | Python | mit | 4,029 | 0.018119 |
import collections
import re
#imports
class Jison:#extends
symbols = {}
terminals = {}
productions = {}
table = {}
default_actions = {}
version = '0.3.12'
debug = False
action_none = 0
action_shift = 1
action_deduce = 2
action_accept = 3
unput_stack = []
def trace(self):
"""trace"""
def __init__(s... | Bovid/Bovid.python | template.py | Python | mit | 7,644 | 0.039508 |
# -*- coding: utf-8 -*-
#
# Fuel documentation build configuration file, created by
# sphinx-quickstart2 on Wed Oct 8 17:59:44 2014.
#
# 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.
#
# All... | mducoffe/fuel | docs/conf.py | Python | mit | 9,405 | 0.005853 |
from multiprocessing import Pool
class Process:
def __init__(self, processes=8):
self.p = Pool(processes)
def Exec(self, f, data):
return self.p.map(f, data)
| chengluyu/SDU-Computer-Networks | assignment-2/multiprocesser.py | Python | mit | 185 | 0 |
# -*- coding: utf-8 -*-
"""
requests.api
~~~~~~~~~~~~
This module implements the Requests API.
:copyright: (c) 2012 by Kenneth Reitz.
:license: Apache2, see LICENSE for more details.
"""
from . import sessions
def request(method, url, **kwargs):
"""Constructs and sends a :class:`Request <Reque... | adazey/Muzez | libs/requests/api.py | Python | gpl-3.0 | 6,115 | 0.005724 |
import inspect
import re
import sys
import traceback
from inspect import CO_VARARGS
from inspect import CO_VARKEYWORDS
from traceback import format_exception_only
from types import TracebackType
from typing import Generic
from typing import Optional
from typing import Pattern
from typing import Tuple
from typing import... | tomviner/pytest | src/_pytest/_code/code.py | Python | mit | 36,328 | 0.000853 |
# -*- coding: utf-8 -*-
"""
Copyright 2013 Ryan Olson
This file is part of CloudApp.
CloudApp 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 versio... | ryanolson/CloudApp | cloudapp/identity.py | Python | gpl-3.0 | 3,128 | 0.012148 |
i,j=1,2
sum=0
while j <4000000:
i,j=j,i+j
if i%2==0:
sum=sum+i
print sum | uthaipon/SkillsWorkshop2017 | Week01/Problem02/chaoyichang_02.py | Python | bsd-3-clause | 76 | 0.197368 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import json
import frappe.utils
from frappe.utils import cstr, flt, getdate, comma_and, cint
from frappe import _
from frappe.model.utils ... | mbauskar/erpnext | erpnext/selling/doctype/sales_order/sales_order.py | Python | gpl-3.0 | 26,900 | 0.027918 |
#####################################################################
# linktest_rsp_header.py
#
# (c) Copyright 2021, Benjamin Parzella. All rights reserved.
#
# This library 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... | bparzella/secsgem | secsgem/hsms/linktest_rsp_header.py | Python | lgpl-2.1 | 1,587 | 0.00063 |
def main() -> None:
N = int(input())
A = [int(x) for x in input().split()]
rev_A = A[:]
left = [-1] * N
left_cnt = [0] * N
A_left = [A[0]]
for i in range(1, N):
if rev_A[i-1] < rev_A[i]:
cnt = 0
while rev_A[i-1]
pass
elif rev_A[i-1] < rev_A... | knuu/competitive-programming | atcoder/corp/caddi2018_e.py | Python | mit | 1,094 | 0.002742 |
# AlexMunoz905 | 1/1/17
answer = "Hello 2017!"[::-1]
print(answer)
| DakRomo/2017Challenges | challenge_1/python/alexmunoz905/main.py | Python | mit | 68 | 0 |
'''This module contains functions related to raw metrics.
The main function is :func:`~radon.raw.analyze`, and should be the only one
that is used.
'''
import tokenize
import operator
import collections
try:
import StringIO as io
except ImportError: # pragma: no cover
import io
__all__ = ['OP', 'COMMENT', ... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/radon/raw.py | Python | agpl-3.0 | 6,458 | 0 |
import sys, os
import pygame as pg
import tilerender
"""Initialize pygame, create a clock, create the window
with a surface to blit the map onto."""
pg.init()
fps_clock = pg.time.Clock()
main_surface = pg.display.set_mode((420, 420))
main_rect = main_surface.get_rect()
"""Load the tmx file from the current directory... | justinmeister/PyTMX-Examples | Make Collideable Rects/main.py | Python | mit | 3,683 | 0.002987 |
from datetime import datetime
from django.core.exceptions import ValidationError
from django.db import models
def validate_answer_to_universe(value):
if value != 42:
raise ValidationError('This is not the answer to life, universe and everything!', code='not42')
class ModelToValidate(models.Model):
... | mattseymour/django | tests/validation/models.py | Python | bsd-3-clause | 4,761 | 0.003781 |
#------------------------------------------------------------------------------
# Name: pychrono example
# Purpose:
#
# Author: Alessandro Tasora
#
# Created: 1/01/2019
# Copyright: (c) ProjectChrono 2019
#------------------------------------------------------------------------------
print ("First tu... | projectchrono/chrono | src/demos/python/core/demo_CH_coords.py | Python | bsd-3-clause | 2,825 | 0.024425 |
"""Support for Vera devices."""
from __future__ import annotations
import asyncio
from collections import defaultdict
import logging
from typing import Any, Generic, TypeVar
import pyvera as veraApi
from requests.exceptions import RequestException
import voluptuous as vol
from homeassistant import config_entries
fro... | sander76/home-assistant | homeassistant/components/vera/__init__.py | Python | apache-2.0 | 9,850 | 0.000609 |
#!/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 distributed... | andreaso/ansible | lib/ansible/modules/cloud/amazon/cloudfront_facts.py | Python | gpl-3.0 | 31,932 | 0.005386 |
from __future__ import unicode_literals
from moto.core.responses import BaseResponse
from .models import kinesisvideoarchivedmedia_backends
import json
class KinesisVideoArchivedMediaResponse(BaseResponse):
SERVICE_NAME = "kinesis-video-archived-media"
@property
def kinesisvideoarchivedmedia_backend(self... | william-richard/moto | moto/kinesisvideoarchivedmedia/responses.py | Python | apache-2.0 | 3,369 | 0.002671 |
class TNumberDataLines(object):
"""
Adapter used in
TTableClipboard
Requires:
getNumberDataRows or GetNumberRows
getNumberDataCols or GetNumberCols
Provides:
_getNumberDataRows
_getNumberDataCols
_getBaseDataRow
_getBaseDataCol
"""
def _getBaseDataRow(self):
if hasattr(self, 'getBaseData... | onoga/toolib | toolib/wx/grid/table/TNumberDataLines.py | Python | gpl-2.0 | 844 | 0.043839 |
#!/usr/bin/env python
# Copyright 2016 Criteo
#
# 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 agree... | Thib17/biggraphite | biggraphite/drivers/_delayed_writer.py | Python | apache-2.0 | 5,350 | 0.000187 |
"""
A fake time series data server used during development to serve up JSON
for live updating plot rendering in the browser. The test datafile has
25000 points and cycles through this entire series every 60 minutes.
Examples
--------
>>> python fake_dataserver.py
>>> import requests; requests.get('http://127.0.0.1:500... | pomeslab/matplotdash | server/fake_dataserver.py | Python | mit | 2,830 | 0.00318 |
## @file
# This file is used to define class objects of INF file [Ppis] section.
# It will consumed by InfParser.
#
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License whi... | carmark/vbox | src/VBox/Devices/EFI/Firmware/BaseTools/Source/Python/UPT/Object/Parser/InfPpiObject.py | Python | gpl-2.0 | 12,929 | 0.009204 |
#
# Copyright 2015-2016 Red Hat, Inc.
#
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program is distr... | mojaves/convirt | tests/xmlfile_test.py | Python | lgpl-2.1 | 3,016 | 0 |
"""
sentry.options.store
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2015 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
import logging
import six
from collections import namedtuple
from time import time
from ran... | alexm92/sentry | src/sentry/options/store.py | Python | bsd-3-clause | 10,280 | 0.000778 |
#!/usr/bin/env python3
"""pgm2jack
Convert a P1 pbm (monochome ascii, a.k.a. "Plain PBM") file to a
jack array (nand2tetris).
One word is 16bits in jack, so image width must be a multiple!
Copyright 2013-2016 Gavin Stewart.
You are required to give attribution to the author (Gavin Stewart) for any
use of this prog... | gav-/Nand2Tetris-Games_and_Demos | bin/pbm2jack.image.py | Python | gpl-3.0 | 6,471 | 0.007418 |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | PaddlePaddle/Paddle | python/paddle/fluid/tests/custom_op/custom_relu_setup.py | Python | apache-2.0 | 1,325 | 0 |
"""
saltrepo
~~~~~~~~
SaltStack Repository Sphinx directives
"""
def source_read_handler(app, docname, source):
if "|repo_primary_branch|" in source[0]:
source[0] = source[0].replace(
"|repo_primary_branch|", app.config.html_context["repo_primary_branch"]
)
def setup(app... | saltstack/salt | doc/_ext/saltrepo.py | Python | apache-2.0 | 498 | 0.002008 |
__all__ = ['pwnedapi', 'utils']
from .pwnedapi import HaveIBeenPwnedApi
| ericfourrier/pwnedapi | pwnedapi/__init__.py | Python | mit | 72 | 0 |
# RABDAM
# Copyright (C) 2020 Garman Group, University of Oxford
# This file is part of RABDAM.
# RABDAM 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 License, or (at your... | GarmanGroup/RABDAM | tests/test_bnet_calculation.py | Python | lgpl-3.0 | 8,856 | 0.000452 |
import sys
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import matplotlib.ticker
import numpy as np
#import pandas as pd
import astropy
from astropy.table import Table
from scipy import stats, interpolate, special
from scipy.stats import gaussian_kde
infile = 'candels_restframe_phot_weight... | vrooje/gzcandels_datapaper | plotting/plot_mags_z_thresholds.py | Python | mit | 11,858 | 0.00818 |
from streamline import RouteBase
class MyRoute(RouteBase):
path = '/'
def get(self):
self.response.headers['foo'] = 'bar'
return 'Hello world!'
class MyOtherRoute(RouteBase):
path = '/other'
def post(self):
return 'Posted'
def delete(self):
return 'Deleted'
... | Outernet-Project/bottle-streamline | tests/sample_apps/base_only.py | Python | bsd-2-clause | 488 | 0 |
import json
import os
from errata_tool import ErrataConnector, Erratum
from errata_tool.products import ProductList
import requests
import pytest
TESTS_DIR = os.path.dirname(os.path.abspath(__file__))
FIXTURES_DIR = os.path.join(TESTS_DIR, 'fixtures')
class MockResponse(object):
status_code = 200
encoding = ... | mmuzila/errata-tool | errata_tool/tests/conftest.py | Python | mit | 2,567 | 0 |
# -*- encoding: utf-8 -*-
'''
Given an array of integers, every element appears three times except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
'''
class Solution(object):
def singleNumber(self, nums):
"""
... | weixsong/algorithm | leetcode/137.py | Python | mit | 614 | 0.008143 |
# -*- coding: utf-8 -*-
"""
pygments.lexers._mapping
~~~~~~~~~~~~~~~~~~~~~~~~
Lexer mapping definitions. This file is generated by itself. Everytime
you change something on a builtin lexer definition, run this script from
the lexers folder to update it.
Do not alter the LEXERS dictionary by ha... | fearthecowboy/pygments | Pygments/pygments-lib/pygments/lexers/_mapping.py | Python | bsd-2-clause | 45,831 | 0.007571 |
import subprocess
import os
import errno
def download_file(url, local_fname=None, force_write=False):
# requests is not default installed
import requests
if local_fname is None:
local_fname = url.split('/')[-1]
if not force_write and os.path.exists(local_fname):
return local_fname
dir_name = os.pat... | yancz1989/lr_semi | common/util.py | Python | mit | 1,092 | 0.016484 |
#!/usr/bin/env python
#coding=utf-8
from toughradius.radiusd.plugins import error_auth
from toughradius.radiusd import utils
def process(req=None,resp=None,user=None,radiusd=None,**kwargs):
store = radiusd.store
if store.is_white_roster(req.get_mac_addr()):
return resp
if not user:
return... | vzer/ToughRADIUS | toughradius/radiusd/plugins/auth_user_filter.py | Python | agpl-3.0 | 785 | 0.017834 |
"""
Primary orchestration and control point for Gooey.
"""
import sys
from itertools import chain
import wx
from gooey.gui import events
from gooey.gui.components.header import FrameHeader
from gooey.gui.components.footer import Footer
from gooey.gui.util import wx_util
from gooey.gui.components.config ... | codingsnippets/Gooey | gooey/gui/containers/application.py | Python | mit | 8,890 | 0.002362 |
def getLocations(listrep, checkFunc):
t = listrep
locs = []
for i in range(len(t)):
for j in range(len(t[0])):
locs.append((i,j))
places = filter(lambda (i,j): checkFunc(listrep[i][j]), locs)
return places
| Tritlo/Stundatafla | StundatofluUtil.py | Python | gpl-2.0 | 246 | 0.00813 |
# coding: utf-8
from .base import Base
from .config_auth import ConfigAuth
from .config import Config
from .user import User
from .resource import Resource
from .common import VisibilityFlags
from .meta import ItemMeta
from .meta import PageMeta
from .story import Story
from .module_config import ModuleConfig
| tiberiucorbu/av-website | main/model/__init__.py | Python | mit | 314 | 0 |
# Outspline - A highly modular and extensible outliner.
# Copyright (C) 2011-2014 Dario Giovannetti <dev@dariogiovannetti.net>
#
# This file is part of Outspline.
#
# Outspline 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 Softw... | xguse/outspline | src/outspline/info/extensions/organism_alarms.py | Python | gpl-3.0 | 1,392 | 0.000718 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright 2012 Camptocamp SA
# Copyright 2012 Endian Solutions BV
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License ... | acsone/margin-analysis | product_cost_incl_costs_with_bom/product.py | Python | agpl-3.0 | 2,373 | 0.00295 |
# CC150 8.1
# Design the data structure for a generic deck of cards.
class suit():
def __init__(self, v):
self.value = v
| cyandterry/Python-Study | Ninja/Concept_Implement/OOD.py | Python | mit | 134 | 0 |
from office365.runtime.queries.service_operation_query import ServiceOperationQuery
from office365.sharepoint.base_entity_collection import BaseEntityCollection
from office365.sharepoint.webs.web import Web
class WebCollection(BaseEntityCollection):
"""Web collection"""
def __init__(self, context, resource_p... | vgrem/Office365-REST-Python-Client | office365/sharepoint/webs/web_collection.py | Python | mit | 1,240 | 0.004032 |
#!/usr/bin/env python
# -*- coding: utf-8
from __future__ import print_function
import argparse
import codecs
import cPickle as pickle
import numpy as np
import os
from load_tweets import load_tweets
NAME='ef_list_punctuation'
prefix='list_punctuation'
if __name__ == "__main__":
# Las opciones de línea de coman... | alonsopg/AuthorProfiling | src/ef_list_punctuation.py | Python | gpl-2.0 | 3,045 | 0.018421 |
"""Test package"""
import os.path
import sys
def setup_package():
# insert top-level dir to python path
# so we could easily import stuff from
# tests
sys.path.insert(0, os.path.abspath("../"))
| novel/lc-tools | test/__init__.py | Python | apache-2.0 | 212 | 0.004717 |
from game.models import User
# 存储在内存中的所有房间
rooms_list = []
class Room(object):
id = int # 房间id
name = str # 房间名
owner = int # 房主id
users = [] # 成员id
users_status = {} # 成员准备状态
status = False # 状态
def __init__(self, id, name):
self.id = id
self.name =... | sdu14SoftwareEngineering/GameOfLife_WEB | game/tool/room_tool.py | Python | apache-2.0 | 1,016 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.