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 -*-
##
##
## This file is part of Indico.
## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
##
## Indico is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; eith... | pferreir/indico-backup | indico/MaKaC/webinterface/rh/CFADisplay.py | Python | gpl-3.0 | 21,395 |
from django.contrib import admin
from explorer.models import Query
from explorer.actions import generate_report_action
class QueryAdmin(admin.ModelAdmin):
list_display = ('title', 'description', 'created_by_user', 'schedule')
list_filter = ('title',)
actions = [generate_report_action()]
admin.site.r... | sevikkk/django-sql-explorer | explorer/admin.py | Python | mit | 347 |
import csv
import StringIO
import datetime
from django.db.models import ForeignKey
from django.http import HttpResponse, HttpResponseForbidden, HttpResponseBadRequest
from django.contrib.auth import authenticate, login
from piston.handler import BaseHandler
from piston.emitters import Emitter
from django_fixmystreet... | IMIO/django-fixmystreet | django_fixmystreet/fixmystreet/api.py | Python | agpl-3.0 | 8,053 |
#
# 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... | sekikn/incubator-airflow | airflow/providers/amazon/aws/hooks/sns.py | Python | apache-2.0 | 3,399 |
# -*- coding: utf-8 -*-
# pylint: disable=C0301,W0105,W0401,W0614
"""
Tests for tarantool.request module
"""
import binascii
import unittest
from txtarantool import Request
from txtarantool import RequestInsert
from txtarantool import RequestDelete
from txtarantool import RequestSelect
from txtarantool import Request... | zlobspb/txtarantool | tests/test_request.py | Python | bsd-2-clause | 10,973 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# 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... | r-icarus/openstack_microserver | openstack_dashboard/api/ceilometer.py | Python | apache-2.0 | 27,443 |
"""
For fixed hazard rate, click rates, and trial duration,
generate num_trials dynamic clicks trials, and computes
the ideal observer's performance, with delta function on
h.
Stores data with seed in SQLite database
"""
import dataset
import numpy as np
import datetime
import matplotlib.pyplot as plt
debug = False
... | aernesto/change-rate-inference | ClickTask/Python/Performances/generate_performance_data_clicks_compute11_test.py | Python | mit | 10,843 |
"""
This module contains the default values for all settings used by Scrapy.
For more information about these settings you can read the settings
documentation in docs/topics/settings.rst
Scrapy developers, if you add a setting here remember to:
* add it in alphabetical order
* group similar settings without leaving ... | w495/scrapy | scrapy/settings/default_settings.py | Python | bsd-3-clause | 8,273 |
import re
from thefuck.utils import get_all_matched_commands, replace_command
from thefuck.specific.git import git_support
@git_support
def match(command):
return (" is not a git command. See 'git --help'." in command.output
and ('The most similar command' in command.output
or 'Did yo... | scorphus/thefuck | thefuck/rules/git_not_command.py | Python | mit | 666 |
from model.group import Group
import string
import random
import os.path
import jsonpickle
import getopt
import sys
try:
opts, args = getopt.getopt(sys.argv[1:], "n:f:", ["number of groups", "file"])
except getopt.GetoptError as err:
getopt.usage()
sys.exit(2)
n = 6
f = "data/groups.json"
for o, a in opt... | checheninao/python_training | generator/group.py | Python | apache-2.0 | 1,002 |
# Copyright 2014: Intel 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 a... | pyKun/rally | rally/plugins/openstack/scenarios/neutron/utils.py | Python | apache-2.0 | 13,261 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def execute():
webnotes.conn.sql("""update `tabItem Price` ip INNER JOIN `tabItem` i
ON (ip.item_code = i.name)
set ip.item_n... | saurabh6790/test-med-app | patches/1312/p02_update_item_details_in_item_price.py | Python | agpl-3.0 | 378 |
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Or Soffer <orso@checkpoint.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
class ModuleDocFragment(object):
# Standard files documentation fragment
DOCUMENTATION = r'''
options:
wait_for_task:
description:... | thaim/ansible | lib/ansible/plugins/doc_fragments/checkpoint_commands.py | Python | mit | 531 |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.views.generic import FormView
from django.http import HttpResponse
from django.template.loader import render_to_string
from django.core.mail import send_mail
from django.utils.translation import ugettext_lazy as _
import json
from .forms import Cont... | creimers/cmsplugin_ajaxcontact | cmsplugin_ajaxcontact/views.py | Python | bsd-2-clause | 2,756 |
from collections import namedtuple
from model.flyweight import Flyweight
from model.static.database import database
class ControlTowerResource(Flyweight):
def __init__(self,control_tower_type_id):
#prevents reinitializing
if "_inited" in self.__dict__:
return
self._inited = None... | Iconik/eve-suite | src/model/static/inv/control_tower_resources.py | Python | gpl-3.0 | 1,085 |
from insights.parsers.nproc import LimitsConf, NprocConf
from insights.tests import context_wrap
LIMITS_CONF_1 = """
#oracle hard nproc 1024
#oracle hard nproc 2024
* - nproc 2048
oracle soft nproc 4096# this is soft
oracle hard nproc 65536
user ... | PaulWay/insights-core | insights/parsers/tests/test_nproc.py | Python | apache-2.0 | 2,258 |
"""Simple script to delete all forms with "PLACEHOLDER" as their transcription
and translation value.
"""
import sys
import json
from old_client import OLDClient
url = 'URL'
username = 'USERNAME'
password = 'PASSWORD'
c = OLDClient(url)
logged_in = c.login(username, password)
if not logged_in:
sys.exit('Could not... | jrwdunham/lingsync2old | delete-empty.py | Python | apache-2.0 | 947 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['BoxCox'] , ['ConstantTrend'] , ['NoCycle'] , ['LSTM'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_BoxCox/model_control_one_enabled_BoxCox_ConstantTrend_NoCycle_LSTM.py | Python | bsd-3-clause | 152 |
def enum(*sequential, **named):
enums = dict(zip(sequential, range(len(sequential))), **named)
reverse = dict((value, key) for key, value in enums.iteritems())
enums[ 'reverse_mapping' ] = reverse
return type( 'Enum', (), enums )
| livef1/Livef1-web | src/enum.py | Python | gpl-2.0 | 252 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import date, datetime
import os
import sys
import traceback
import unittest
import warnings
from django import template
from django.conf import settings
from django.core import urlresolvers
from django.template import (base as template_base... | liavkoren/djangoDev | tests/template_tests/tests.py | Python | bsd-3-clause | 124,554 |
from .conjugate_gradient import ConjugateGradient
from .steepest_descent import SteepestDescent
from .trust_regions import TrustRegions
from .particle_swarm import ParticleSwarm
from .nelder_mead import NelderMead
__all__ = ["ConjugateGradient", "SteepestDescent", "TrustRegions",
"ParticleSwarm", "NelderMea... | tingelst/pymanopt | pymanopt/solvers/__init__.py | Python | bsd-3-clause | 324 |
# 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 use ... | hapylestat/apputils | integration/idea/root0/src/RENAME_TO_PROJECT_NAME/__main__.py | Python | lgpl-3.0 | 1,378 |
import testlib
def run_test(env):
bc = env.bitcoind
lit = env.lits[0]
lit2 = env.lits[1]
# First figure out where we should send the money.
addr = lit.make_new_addr()
print('Got lit1 address:', addr)
# Send a bitcoin.
bc.rpc.sendtoaddress(addr, 1)
env.generate_block()
print('S... | mit-dci/lit | test/itest_send2.py | Python | mit | 1,214 |
# Copyright 2021 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | tensorflow/probability | tensorflow_probability/python/sts/internal/seasonality_util.py | Python | apache-2.0 | 9,393 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | TakayukiSakai/tensorflow | tensorflow/contrib/testing/__init__.py | Python | apache-2.0 | 941 |
# -*- coding: utf-8 -*-
#
# rBuild documentation build configuration file, created by
# sphinx-quickstart on Mon May 4 08:32:54 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
# autogenerated file.
#
# Al... | sassoftware/rbuild | docs/conf.py | Python | apache-2.0 | 11,175 |
import sys
if len(sys.argv) < 2:
print('usage: {} inputs'.format(sys.argv[0]))
exit(1)
for input in sys.argv[1:]:
with open(input) as f:
nums = map(int, f.readlines())
print(sum(nums))
| philipdexter/aperf | examples/sum/gen_answers.py | Python | mit | 215 |
# Generated by Django 2.1.7 on 2019-05-24 05:43
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("invoices", "0002_auto_20190524_1113"),
("common", "0013_auto_20190508_1540"),
]
operations = [
migr... | MicroPyramid/Django-CRM | common/migrations/0014_auto_20190524_1113.py | Python | mit | 1,036 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sqlite3 as sql
import pandas as pd
from DataGeneration.MapLocation import MapLocation
class DatabaseHandler:
def __init__(self, db_file_name='db.sqlite3', full=True):
if full:
self.conn = sql.connect(db_file_name)
self.initiali... | opencleveland/RTAHeatMap | DataGeneration/DatabaseHandler.py | Python | mit | 7,778 |
from __future__ import absolute_import
import sugartensor as tf
from tensorflow.examples.tutorials.mnist import input_data
__author__ = 'mansour'
# constant sg_data to tensor conversion with queue support
def _data_to_tensor(data_list, batch_size, name=None):
r"""Returns batch queues from the whole data.
... | buriburisuri/sugartensor | sugartensor/sg_data.py | Python | mit | 2,304 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Clase (y programa principal) para un servidor de eco en UDP simple
"""
import socketserver
class EchoHandler(socketserver.DatagramRequestHandler):
"""
Echo server class
"""
def handle(self):
"""
handle method of the server class
... | gregoriorobles/ptavi-p4 | server.py | Python | gpl-2.0 | 873 |
#!/usr/bin/env python
import sys
with open(sys.argv[1], 'r') as my_file:
print(my_file.read())
| TheShellLand/pies | v3/Libraries/sys/Open file.py | Python | mit | 102 |
# Copyright (c) 2017-2018 {Flair Inc.} WESLEY PENG
#
# 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... | WesleyPeng/uiXautomation | src/main/python/taf/modeling/svc/__init__.py | Python | apache-2.0 | 629 |
# coding: utf8
class AbstractView(object):
"""Defines interface for View classes"""
def __init__(self, config, **kwargs):
raise NotImplementedError(
"Can't instantiate View interface, use its implementation"
)
def display(self, context):
"""Displays data given to cont... | ondrejkajinek/pyGrim | pygrim/components/view/abstract_view.py | Python | mit | 670 |
import re
import sublime
from sublime_plugin import WindowCommand
from ..git_command import GitCommand
from ...common import util
from ..ui_mixins.quick_panel import show_branch_panel
NEW_BRANCH_PROMPT = "Branch name:"
NEW_BRANCH_INVALID = "`{}` is a invalid branch name.\nRead more on $(man git-check-ref-format)"
_i... | stoivo/GitSavvy | core/commands/checkout.py | Python | mit | 4,441 |
# Copyright 2015 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 agreed ... | jdanbrown/pydatalab | datalab/utils/commands/_extension.py | Python | apache-2.0 | 1,692 |
# -*- coding: utf-8 -*-
#
# document.py
#
# Copyright 2009, 2010 Thomas Jost <thomas.jost@gmail.com>
# Copyright 2015 Cimbali <me@cimba.li>
#
# 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
# ... | Cimbali/pympress | pympress/document.py | Python | gpl-2.0 | 45,534 |
# No views necessary.
| ambv/django-crystal-small | src/django_crystal_small/views.py | Python | lgpl-3.0 | 23 |
"""Django CAS 1.0/2.0 authentication backend"""
from django.conf import settings
__all__ = []
_DEFAULTS = {
'CAS_ADMIN_PREFIX': None,
'CAS_EXTRA_LOGIN_PARAMS': None,
'CAS_IGNORE_REFERER': False,
'CAS_LOGOUT_COMPLETELY': True,
'CAS_REDIRECT_URL': '/',
'CAS_RETRY_LOGIN': False,
'CAS_SERVER_... | byuhbll/django-cas | cas/__init__.py | Python | mit | 836 |
import json
import os
from django.core.management.base import BaseCommand
from django.db.transaction import atomic
from waldur_core.core.utils import is_uuid_like
from waldur_core.structure import models as structure_models
from waldur_mastermind.marketplace import models
from waldur_mastermind.marketplace.serializer... | opennode/nodeconductor-assembly-waldur | src/waldur_mastermind/marketplace/management/commands/import_offering.py | Python | mit | 4,658 |
# -*- coding:utf-8 -*-
'''
Author: Bu Kun
E-mail: bukun@osgeo.cn
CopyRight: http://www.yunsuan.org
'''
import tornado.web
import tornado.escape
from torlite.core import tools
from torlite.core.base_handler import BaseHandler
from torlite.model.mwiki import MWiki
from torlite.model.mcatalog import MCatalog
from torlite... | Geoion/TorCMS | torlite/handlers/wiki_handler.py | Python | mit | 5,496 |
# -*- coding: utf-8 -*-
# © 2017 Today Mourad EL HADJ MIMOUNE @ Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, models
class ProductProduct(models.Model):
_inherit = "product.product"
@api.model
def search(self, args, offset=0, limit=None, order=None, ... | Eficent/purchase-workflow | purchase_allowed_product/models/product.py | Python | agpl-3.0 | 1,228 |
# -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2015 PyBuilder Team
#
# 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/l... | esc/pybuilder | src/unittest/python/core_tests.py | Python | apache-2.0 | 28,147 |
'''@file deepclustering_reconstructor.py
contains the reconstor class using deep clustering'''
from sklearn.cluster import KMeans
import mask_reconstructor
from nabu.postprocessing import data_reader
import numpy as np
import os
import pdb
class DeepattractornoisehardReconstructor(mask_reconstructor.MaskReconstructor... | JeroenZegers/Nabu-MSSS | nabu/postprocessing/reconstructors/deepattractornetnoise_hard_reconstructor.py | Python | mit | 4,078 |
# Initialize Django.
from djangoappengine import main
from importlib import import_module
from django.conf import settings
# Load all models.py to ensure signal handling installation or index
# loading of some apps.
for app in settings.INSTALLED_APPS:
try:
import_module('%s.models' % app)
except Import... | Implisit/djangoappengine | djangoappengine/mapreduce/handler.py | Python | bsd-3-clause | 539 |
#!/usr/bin/env python2
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
import logging
from collections import defaultdict
import cssutils
from lxm... | jelly/calibre | src/calibre/ebooks/oeb/transforms/embed_fonts.py | Python | gpl-3.0 | 10,490 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
"""
重みのヒストグラムを出力
入力:ndarray(in, out)
"""
def draw_histogram(W, out_file_name, bins_arg):
data = W.flatten()
plt.figure(figsize=(20, 10))
plt.xlabel('Weight')
plt.ylabel('Number')
plt.hist(data,bins=bi... | TakuTsuzuki/Hackathon2015 | Doi/scripts/draw_histogram.py | Python | apache-2.0 | 559 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
SagaAlgorithmProvider.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*****************... | NINAnor/QGIS | python/plugins/processing/algs/saga/SagaAlgorithmProvider.py | Python | gpl-2.0 | 6,120 |
import sqlite3
import re
import hashlib
from classes.wechatUtils import WechatUtils
class WechatSqliteUtil(object):
def __init__(self, mmPath, contactPath):
if(mmPath == None):
self._mm_path = './data/MM.sqlite'
else:
self._mm_path = mmPath
if(contactPath == None):
self._contact__path = './data/WCDB... | jambus/wechat-analysis | classes/wechatSqliteUtil.py | Python | apache-2.0 | 2,815 |
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | sarvex/tensorflow | tensorflow/lite/experimental/acceleration/mini_benchmark/metrics/blazeface_metrics.py | Python | apache-2.0 | 5,456 |
from SOAPpy import SOAPProxy
import os, sys
# python sample code for the Currency Exchange service
if len(sys.argv)<>3:
print "usage: %s germany sweden\n\tyou may try other countries"%(sys.argv[0])
sys.exit(-1)
# in some intranets an issue: how to use a web proxy for WS. Here
# we assume a set environment v... | ActiveState/code | recipes/Python/473883_web_sevice_usage_vihttp/recipe-473883.py | Python | mit | 783 |
import argparse
parser = argparse.ArgumentParser(description='Load or create a Blekota model')
parser.add_argument('file',
help='Either a .pkl file containing an existing model or a .wav sound on which to train a new model. If a .wav is provided, other parameters can be used to specify model hyper... | IAmWave/blekota | src/blekota.py | Python | mit | 2,295 |
from django.db.models import Count, Avg, F
import caching.base as caching
import olympia.core.logger
from olympia.addons.models import Addon
from olympia.amo.celery import task
from olympia.amo.decorators import write
from .models import Rating, GroupedRating
log = olympia.core.logger.getLogger('z.task')
@task(ra... | tsl143/addons-server | src/olympia/ratings/tasks.py | Python | bsd-3-clause | 4,263 |
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SO... | Donkyhotay/MoonPy | zope/security/examples/sandbox_security.py | Python | gpl-3.0 | 6,385 |
from tusk import __path__
import json, os
def interp_varname(varname):
first = varname[0]
second = varname[1]
#T - RT in ATUS vars
# TXAGE_EC
if first == 't':
return (varname[1:], 'ATUS-interview', 'summary-file')
else:
fl_types = {
'G': 'CPS-geography',
'H': 'CPS-household',
'P': 'CPS-person',
... | sbirch/TUSK | tusk/variables.py | Python | mit | 6,743 |
'''
This file is part of pyCRPG
Copyright (C) 2010 Christian Schwartz
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 optio... | cschwartz/pycrpg | src/tilemanager.py | Python | gpl-2.0 | 3,608 |
# (C) 2017 Red Hat Inc.
# Copyright (C) 2017 Lenovo.
#
# GNU General Public License v3.0+
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for ... | roadmapper/ansible | lib/ansible/plugins/cliconf/enos.py | Python | gpl-3.0 | 3,648 |
"""Solutie pentru problema cursor"""
def modifica_punct(directie, valoare):
"""Functie de aflare a modificarilor ce trebuie facute asupra punctelor"""
punct = [0, 0]
if directie == "STANGA":
punct[0] = punct[0] - valoare
elif directie == "DREAPTA":
punct[0] = punct[0] + valoare
eli... | c-square/python-lab | python/solutii/vlad_cristia_avram/cursor.py | Python | mit | 1,734 |
#CHIPSEC: Platform Security Assessment Framework
#Copyright (c) 2010-2016, Intel Corporation
#
#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; Version 2.
#
#This program is distributed in the hope... | chipsecintel/chipsec | source/tool/chipsec/modules/tools/vmm/hv/define.py | Python | gpl-2.0 | 23,148 |
# -*- coding: UTF-8 -*-
from django.http import HttpResponseRedirect
from datetime import datetime
from django.core.urlresolvers import reverse
from django.core.paginator import Paginator
from meregistro.shortcuts import my_render
from apps.seguridad.decorators import login_required, credential_required
from apps.segu... | MERegistro/meregistro | meregistro/apps/registro/views/establecimiento_domicilio.py | Python | bsd-3-clause | 7,455 |
from django import template
from django.template import Library, Node
register = Library()
@register.filter
def adjust_date(my_date, user):
from datetime import timedelta
return my_date - timedelta(minutes=user.timezone_offset_mins)
@register.tag
def sorting_header(parser, token):
try:
tag_name, my_n... | taylorhughes/done-zo | dnzo/templating/dnzo_templating.py | Python | mit | 864 |
# class generated by DeVIDE::createDeVIDEModuleFromVTKObject
from module_kits.vtk_kit.mixins import SimpleVTKClassModuleBase
import vtk
class vtkImageHSIToRGB(SimpleVTKClassModuleBase):
def __init__(self, module_manager):
SimpleVTKClassModuleBase.__init__(
self, module_manager,
vtk.... | nagyistoce/devide | modules/vtk_basic/vtkImageHSIToRGB.py | Python | bsd-3-clause | 489 |
from bs4 import BeautifulSoup
from pathlib import Path
import os
from DBConnect import DBService
from store import Store
class FindLevel:
def __init__(self, db_service, store):
self.__cur = db_service.cur
self.__store = store
self.__db = db_service.db
def find(self):
cmd = "SE... | YorovSobir/informational_retrieval | features/find_level_disease.py | Python | mit | 2,450 |
import grace
import grace.times
import grace.ols
import math
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
worldImage = mpimg.imread('equirectangular.png')
days = grace.ols.time_vector()
days_all = np.linspace(np.min(days), np.max(days), np.max(days) - np.min(days))
X_all = grac... | AndreasMadsen/grace | Code/splines_projection.py | Python | mit | 3,818 |
# Copyright 2018 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | tensorflow/probability | tensorflow_probability/python/distributions/binomial_test.py | Python | apache-2.0 | 20,330 |
# add check if requests is installed
import requests
from .models import *
from .endpoints import *
from .errors import *
from functools import partial
from json import dumps
import os
import binascii
class API(object):
def __init__(self, username=None, password=None, device_token=None, DEBUG=False):
s... | davoclavo/vinepy | vinepy/api.py | Python | mit | 5,507 |
n, m = input().split()
mi = min(int(n), int(m))
print("Malvika" if mi % 2 == 0 else "Akshat") | dwiajik/codeforces | 451A.py | Python | gpl-3.0 | 93 |
"""This is a substantially improved version of the older Interpreter.py demo
It creates a simple GUI JPython console window with simple history
as well as the ability to interupt running code (with the ESC key).
Like Interpreter.py, this is still just a demo, and needs substantial
work before serious use.
Than... | DarioGT/OMS-PluginXML | org.modelsphere.sms/lib/jython-2.2.1/Demo/swing/Console.py | Python | gpl-3.0 | 6,112 |
#!/usr/bin/python
# -*- coding:utf-8 -*-
import time
from config import METRICS, STEP, db
#计算物理机的CPU各项使用率
def cpu_util(data, document):
cpu_metrics = ['cpu_user', 'cpu_nice', 'cpu_system', 'cpu_idle',
'cpu_wio', 'cpuintr', 'cpu_sintr']
cpu_total = 0
for metric in cpu_metrics:
cpu_total += data[metric] -... | Tank000/monitor | py/processor.py | Python | gpl-2.0 | 3,991 |
# Generated by Django 2.2 on 2021-04-29 13:04
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('administrator', '0001_initial'),
]
operations = [
... | v0devil/jltom | ltc/analyzer/migrations/0001_initial.py | Python | mit | 9,891 |
#-*- coding:utf-8 -*-
"""
This file is part of OpenSesame.
OpenSesame 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.
OpenSesame is distri... | eort/OpenSesame | openexp/_log/csv.py | Python | gpl-3.0 | 2,165 |
#!/usr/bin/env python
# [SublimeLinter pep8-max-line-length:300]
# -*- coding: utf-8 -*-
"""
fin_deepening is a multi-agent computational model extending
the Kitoyaki/Moore financial deeepening theta-phi model.
Copyright (C) 2015 Pawel Fiedor (Pawel.F.Fiedor@IEEE.org)
This program is free software: you can redistribu... | cogeorg/BlackRhino | examples/simple/abm_template/sample_runner.py | Python | gpl-3.0 | 2,711 |
# -*- coding: utf-8 -*-
import os
print(os.getcwd())
| smartmob-project/gitmesh | tests/pwd.py | Python | mit | 55 |
# Задача 8. Вариант 49
# Доработайте игру "Анаграммы" (см. М.Доусон Программируем на Python. Гл.4)
# так, чтобы к каждому слову полагалась подсказка. Игрок должен получать право
# на подсказку в том случае, если у него нет никаких предположений.
# Разработайте систему начисления очков, по которой бы игроки, отгадав... | Mariaanisimova/pythonintask | IVTa/2014/AMETOVA_M_M/task_8_23.py | Python | apache-2.0 | 1,910 |
# Copyright 2015 The Shaderc 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 applicable... | endlessm/chromium-browser | third_party/shaderc/src/glslc/test/option_dash_o.py | Python | bsd-3-clause | 3,934 |
def test_basic(filetab):
text = filetab.textwidget
text.insert("1.0", 'print("hello")')
text.mark_set("insert", "1.6") # between ( and "
assert text.get("matching_paren.first", "matching_paren.last") == '("hello")'
text.mark_set("insert", "1.0 lineend")
assert text.get("matching_paren.first", "... | Akuli/porcupine | tests/test_matching_paren_plugin.py | Python | mit | 3,359 |
# Copyright 2016 United States Government as represented by the Administrator
# of the National Aeronautics and Space Administration. All Rights Reserved.
#
# Portion of this code is Copyright Geoscience Australia, Licensed under the
# Apache License, Version 2.0 (the "License"); you may not use this file
# except in c... | ceos-seo/data_cube_ui | apps/spectral_anomaly/models.py | Python | apache-2.0 | 10,582 |
# Copyright (c) 2015-2018 Cisco Systems, Inc.
#
# 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... | metacloud/molecule | test/unit/command/init/test_role.py | Python | mit | 5,090 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11b1 on 2017-03-22 13:36
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('documents', '0003_auto_20170322_1430'),
]
operatio... | Sirikam/Gravitas | apps/documents/migrations/0004_auto_20170322_1436.py | Python | mit | 552 |
#!/usr/bin/python
import logging
logging.getLogger ( "scapy.runtime" ).setLevel ( logging.CRITICAL )
from scapy.all import *
load_contrib ( 'ppi_cace' )
import sys, os, argparse
sys.path.insert ( 0, '../lib/' )
from Queries import *
parser = argparse.ArgumentParser ()
parser.add_argument ( '-S', '--ssid', metavar='SS... | Tylous/SniffAir | module/proof_packet.py | Python | mit | 3,961 |
from itertools import permutations
import numpy
from gensim.models import Word2Vec
from .exploder import Exploder
class ClassMatrixBuilder:
"""
Build matrix for NLC classification.
E.g. at input we have
{ 'class1': ['sentence 1', 'sentence 2'],
'class2': ['sentence 3', 'sentence 4'] }
And it... | alex4321/word2vec-nlc | nlc_w2v/class_matrix_builder.py | Python | lgpl-3.0 | 5,597 |
from PySide.QtCore import QThread, Signal
class SimThread(QThread):
tick = Signal()
simstarted = Signal()
simstopped = Signal()
def __init__(self, sim):
QThread.__init__(self)
self._sim = sim
self._running = self._starting = self._stopping = False
self._stop = False
... | tps12/Tec-Nine | simthread.py | Python | gpl-3.0 | 1,068 |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class CarItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
brand = scrapy.Field()
car_title = scra... | MihaiLai/spider | items.py | Python | mit | 363 |
import sys
from injector import Injector
def main():
path_exe = str(sys.argv[1])
path_dll = str(sys.argv[2])
injector = Injector()
pid = injector.create_process(path_exe)
injector.load_from_pid(pid)
injector.inject_dll(path_dll)
injector.unload()
if __name__ == "__main__":
main()
| numaru/injector | injector_cli.py | Python | gpl-3.0 | 318 |
from unittest import TestCase
from nose.tools import eq_, raises
from parsley import ParseError
from mock import patch
from ndn.parsley import calculate
class TestParsleyParse(TestCase):
def test_parse_a_single_number(self):
eq_(1, calculate('1'))
def test_parse_a_decimal_number(self):
eq_(3.... | ErinCall/ParserDemos | test/test_parsley.py | Python | mit | 1,586 |
from portality.models import Journal, Suggestion
def migrate_journal(data):
if "bibjson" not in data:
return Journal(**data)
ap = data.get("bibjson").get("archiving_policy")
if ap is None:
return Journal(**data)
data["bibjson"]["archiving_policy"] = _reformat_data(ap)
return Journa... | DOAJ/doaj | portality/migrate/continuations/restructure_archiving_policy.py | Python | apache-2.0 | 1,097 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from egnyte import exc
from egnyte.tests.config import EgnyteTestCase
FOLDER_NAME = 'Iñtërnâtiônàlizætiøν☃ test'
DESTINATION_FOLDER_NAME = 'destination'
SUB_FOLDER_NAME = 'subfolder'
FILE_IN_FOLDER_NAME = 'test.txt'
FILE_CONTENT = b'TEST FILE CONTENT'
c... | egnyte/python-egnyte | egnyte/tests/test_folders.py | Python | mit | 2,749 |
import sys, traceback, sakura.daemon.conf as conf
from pathlib import Path
from sakura.common.errors import InputUncompatible
from sakura.daemon.processing.operator import Operator
from sakura.daemon.loading import load_datastores
from sakura.daemon.tools import NullContext
from sakura.daemon.code.git import get_worktr... | eduble/panteda | sakura/daemon/engine.py | Python | gpl-3.0 | 7,815 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
'''
使用在python2.3以后自带的difflib模块比较两个字符串的不同
'''
import difflib
text1='''text1:
Python 3.0 was released in 2008. The final 2.x version 2.7 release came out in mid-2010
with a statement of extended support for this end-of-life release.
difflib document v7.4
add string
'''
text1... | zhangyage/Python-oldboy | python-auto/diff.py | Python | apache-2.0 | 840 |
import pytest
from tests.non_secrets.common import *
@pytest.mark.asyncio
async def test_wallet_search_works(wallet_handle):
await non_secrets.add_wallet_record(wallet_handle, type_, id1, value1, tags1)
await non_secrets.add_wallet_record(wallet_handle, type_, id2, value2, tags2)
search_handle = await n... | srottem/indy-sdk | wrappers/python/tests/non_secrets/test_wallet_search.py | Python | apache-2.0 | 2,420 |
# Generated by Django 2.2.8 on 2020-01-12 15:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('restaurant', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='restaurant',
name='address',
... | aroquemaurel/Cuis-In | cuisin/restaurant/migrations/0002_auto_20200112_1639.py | Python | gpl-2.0 | 1,581 |
#!/bin/env python
from sys import argv
from optparse import *
from pyeastwood import *
from os.path import exists, join
from os import makedirs
def openFile(filename):
fname = filename.split(":")
if len(fname) == 2:
f = PakFile(fname[0])
f.open(fname[1])
else:
f = open(fname[0])
... | OmniBlade/libeastwood | python/eastwood.py | Python | gpl-3.0 | 19,573 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Exporting a Text to various formats. This script is also usable from
the command-line.
Usage:
./text_export.py giza <file1> <lang1> <file2> <lang2> \\
<alignment-file> <output1> <output2>
./text_export.py hunalign <input-file> <lang>
... | mik01aj/corthus | corthus/toolkit/text_export.py | Python | apache-2.0 | 2,038 |
class TestFunctionalTest(object):
counter = 0
@classmethod
def setup_class(cls):
cls.counter += 1
@classmethod
def teardown_class(cls):
cls.counter -= 1
def _run(self):
assert self.counter==1
def test1(self):
self._run()
def test2(self):
self._run(... | DESHRAJ/fjord | vendor/packages/nose/functional_tests/test_multiprocessing/support/class.py | Python | bsd-3-clause | 322 |
# -*- coding: utf-8 -*-
# Copyright 2017 by Bearstech <py@bearstech.com>
#
# This file is part of nuka.
#
# nuka 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 o... | bearstech/nuka | nuka/remote/script.py | Python | gpl-3.0 | 3,087 |
from __future__ import absolute_import
from ._BaseClient import BaseClient
from .Repository import Repository
class DockerRegistryClient(object):
def __init__(self, host, verify_ssl=None, api_version=None, username=None,
password=None, auth_service_url="", api_timeout=None):
"""
... | yodle/docker-registry-client | docker_registry_client/DockerRegistryClient.py | Python | apache-2.0 | 3,242 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated Fri Dec 2 15:05:18 2011 by generateDS.py version 2.7b.
#
import sys
import getopt
import re as re_
etree_ = None
Verbose_import_ = False
( XMLParser_import_none, XMLParser_import_lxml,
XMLParser_import_elementtree
) = range(3)
XMLParser_import_li... | Dhandapani/gluster-ovirt | backend/manager/tools/engine-image-uploader/src/ovf/ovfenvelope.py | Python | apache-2.0 | 398,478 |
# -*- coding: utf-8 -*-
import re
import requests
import base64
import struct
import random
from sklearn.cluster import KMeans
from sklearn.preprocessing import scale
from dateutil.parser import parse
class Tweet(object):
def __init__(self, status):
self.screen_name = status['screen_name']
self.tex... | uwekamper/flutterspark | flutterbrain_web/mapview/clustering.py | Python | mit | 3,178 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import mcpi.minecraft as minecraft # import modułu minecraft
import mcpi.block as block # import modułu block
os.environ["USERNAME"] = "Steve" # nazwa użytkownika
os.environ["COMPUTERNAME"] = "mykomp" # nazwa komputera
# utworzenie połaczenia z s... | koduj-z-klasa/python101 | docs/mcpi/podstawy/mcpi-piramida.py | Python | mit | 1,820 |
import _plotly_utils.basevalidators
class TitleValidator(_plotly_utils.basevalidators.TitleValidator):
def __init__(self, plotly_name="title", parent_name="carpet.aaxis", **kwargs):
super(TitleValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/carpet/aaxis/_title.py | Python | mit | 1,219 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.