code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
import mimetypes
import posixpath
import urllib
import os
from operator import concat
from django.http import HttpResponse
from django.views.static import serve as django_serve
from django_bundles.core import get_bundles
from django_bundles.processors import processor_pipeline
from django_bundles.utils.files import Fi... | sdcooke/django_bundles | django_bundles/views.py | Python | mit | 2,308 |
#!/usr/bin/env python
#
# entropy_plot.py
#
import matplotlib.pyplot as plt
import numpy as np
# import csv
fig = plt.figure()
# Reading data
redent = (np.loadtxt('RED-ENTROPY.dat')).T
cpent = (np.loadtxt( 'CP-ENTROPY.dat')).T
redprod = (np.loadtxt('RED-ENTROPY-PROD.dat')).T
cpprod = (np.loadtxt('CP-ENTROPY-PRO... | j-silver/quantum_dots | entropy_plot.py | Python | bsd-2-clause | 1,809 |
# -*- coding: utf-8 -*-
"""
@brief test log(time=92s)
"""
import unittest
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import get_temp_folder, add_missing_development_version
import ensae_teaching_cs
class TestNotebookRunner1a_soft_sql(unittest.TestCase):
def setUp(self):
add_m... | sdpython/ensae_teaching_cs | _unittests/ut_dnotebooks/test_1A_notebook_soft_sql.py | Python | mit | 1,241 |
#PBS -N UnBalance
#PBS -m ae
#PBS -q long
#PBS -l nodes=1:opteron:ppn=2
"""Test handling of extreme load-unbalancing."""
from asap3 import *
from asap3.md import MDLogger
from ase.lattice.cubic import FaceCenteredCubic
import numpy as np
from asap3.mpi import world
#DebugOutput("UnBalance.%d.out")
#set_verbose(1)
pr... | auag92/n2dm | Asap-3.8.4/Debug/UnBalance.py | Python | mit | 1,763 |
# Django settings for testproject
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
#BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'ae0g37((kp655_*4wbtj999azzo)xw6)9*mv3n@&e6k&7&*#z3'
# SECURITY WA... | jromich/django-aws-manager | testproject/settings.py | Python | mit | 1,753 |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
import json
from frappe import _
from frappe.utils import cstr, cint
from frappe.model.document import Document
from erpne... | saurabh6790/erpnext | erpnext/healthcare/doctype/patient_history_settings/patient_history_settings.py | Python | gpl-3.0 | 6,153 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" Merges 3 CSV files into 1.
The two first columns identify the records.
First file: numerators
Columns: user, template, nc, na
Second file: denominators
Columns: user, template, denominator
Third file: strengths
Columns: user... | hypermindr/barbante | barbante/scripts/merge_user_user_collections.py | Python | mit | 5,107 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | hivam/l10n_co_doctor | report/doctor_disability_half.py | Python | agpl-3.0 | 3,267 |
# -*- coding: utf-8 -*-
u"""
.. module:: offers
"""
from django.conf import settings
from django.contrib import messages
from django.contrib.admin.models import ADDITION, CHANGE
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.http import Http404, HttpResponseForbid... | stxnext-csr/volontulo | apps/volontulo/views/offers.py | Python | mit | 17,750 |
"""
Tests for .objective package.
"""
| Xion/taipan | tests/test_objective/__init__.py | Python | bsd-2-clause | 38 |
"""
MythTV Backend Represntation
This is very basic at the moment, it just stores the backend location and
returns the requested service.
"""
from mythtvlib.settings import settings
from mythtvlib.services import MythTVServiceAPI
class MythTVBackend(object):
_default = None
def __init__(self, hostname=Non... | akgrant43/mythtv_cli_extensions | mythtvlib/backend.py | Python | gpl-2.0 | 1,485 |
import subprocess
#import ipaddress
import re
import pprint
import telnetlib
def decodeTopology(output):
#var
startRow = 0
listIP = []
#regular expression
rule1 = re.compile('Router Link States')
rule2 = re.compile('Link ID')
rule3 = re.compile('\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}')
#... | PP90/ANAWS-project-on-Traffic-Engineering | Old_project/buildTopology.py | Python | bsd-3-clause | 4,940 |
# -*- coding: utf-8 -*-
#
# Copyright 2015-2022 BigML
#
# 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 ... | bigmlcom/python | bigml/tests/test_44_compare_predictions.py | Python | apache-2.0 | 22,664 |
import os
import pdb
import copy
import random
import xml.dom.minidom
import microdom
import types
import common
from module import Module
import svg
import entity
from entity import Entity
import generate
import share
import wx
VERSION = "7.0"
MAX_RECURSIVE_INSTANTIATION_DEPTH = 5
defaultForBuiltinType = {
"b... | OpenClovis/SAFplus-Availability-Scalability-Platform | src/ide/model.py | Python | gpl-2.0 | 38,478 |
# ***** BEGIN GPL LICENSE BLOCK *****
#
# 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 ... | Gamebasis/3DGamebasisServer | GameData/blender-2.71-windows64/2.71/scripts/modules/bl_i18n_utils/settings.py | Python | gpl-3.0 | 20,044 |
from NativDebugging.Patterns.PE import *
from NativDebugging.Win32.MemoryReader import *
from NativDebugging.Patterns.Finder import *
from NativDebugging.Win32.InjectDll import *
import codecs
import os
import sys
import time
NtDLLCopy = os.path.abspath('.') + '\\NtCopy.dll'
targetPid = int(sys.argv[1])
... | assafnativ/NativDebugging | samples/UserlandRootkitRemover.py | Python | gpl-3.0 | 4,674 |
""" leng - высота цифр, s - число, цифры которого надо напечатать
"""
from time import sleep
leng=int(input())
s=input()
import turtle
t=turtle.Turtle()
t.shape("turtle")
t.color("darkgreen","yellow")
t.shapesize(1)
t.speed(10)
t.penup()
t.backward(300)
def digit(a,b):
"""
Рисование цифр числа начинается
... | zernukovag/fox2016 | task_3.py | Python | gpl-3.0 | 2,004 |
# -*- mode: python; indent-tabs-mode: nil -*-
# Part of mlat-server: a Mode S multilateration server
# Copyright (C) 2015 Oliver Jowett <oliver@mutability.co.uk>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the ... | bmeyang/mlat-server | mlat/server/clocknorm.py | Python | agpl-3.0 | 9,256 |
from changes.testutils import APITestCase, SAMPLE_DIFF
from changes.api.project_source_details import ProjectSourceDetailsAPIView
class ProjectSourceDetailsTest(APITestCase):
def test_simple(self):
project = self.create_project()
source = self.create_source(project)
path = '/api/0/project... | dropbox/changes | tests/changes/api/test_project_source_details.py | Python | apache-2.0 | 1,018 |
# Copyright 2020 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, ... | googleinterns/IBRNet | ibrnet/data_loaders/data_verifier.py | Python | apache-2.0 | 5,377 |
__author__ = 'magic'
| elenay/python_training | generator/__init__.py | Python | apache-2.0 | 21 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.21 on 2019-12-20 18:03
from __future__ import unicode_literals
import uuid
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("studies", "0054_new-analytics-permissions")]
operations = [
migrations.Add... | CenterForOpenScience/lookit-api | studies/migrations/0055_study_salt.py | Python | apache-2.0 | 467 |
from nose.tools import * # flake8: noqa
from api.base.settings.defaults import API_BASE
from website.files.models.osfstorage import OsfStorageFile
from website.settings import API_DOMAIN
from tests.base import ApiTestCase
from tests.factories import (AuthUserFactory, ProjectFactory, RegistrationFactory,
... | zamattiac/osf.io | api_tests/guids/views/test_guid_redirect.py | Python | apache-2.0 | 5,068 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def foo():
return ['xyz', 100000, -98.6]
def bar():
return 'abc', [42, 'python'], "Guido"
if __name__ == '__main__':
print(foo())
print(bar())
x, y, z = bar()
print(x, y, z)
print(type(foo()))
| Furzoom/learnpython | pythonCore/ch11/return_type.py | Python | mit | 273 |
#!/usr/bin/env python
import sys
for line in open(sys.argv[1], "r"):
print line.strip().split(' ')[-2]
| keyboardsage/codeeval | easy/penultimateword.py | Python | gpl-3.0 | 109 |
from hubcheck.pageobjects.basepagewidget import BasePageWidget
from hubcheck.pageobjects.basepageelement import Link
from hubcheck.pageobjects.basepageelement import TextReadOnly
class GroupsMenu1(BasePageWidget):
def __init__(self, owner, locatordict={}):
super(GroupsMenu1,self).__init__(owner,locatordict... | codedsk/hubcheck | hubcheck/pageobjects/widgets/groups_menu.py | Python | mit | 11,007 |
#!/usr/bin/env python
#
# x17c.c
# The C demo doesn't work yet, and even if it did it probably could
# not be converted to pure Python since it seems to require the Tcl/Tk
# driver.
| pemryan/DAKOTA | packages/plplot/examples/python/x17.py | Python | lgpl-2.1 | 183 |
import os
import sys
import unittest
sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../..")))
import base_test
class AlertsQuitTest(base_test.WebDriverBaseTest):
def setUp(self):
self.wait = wait.WebDriverWait(self.driver, 5, ignored_exceptions=[exceptions.NoSuchAlertException])
self.... | cr/fxos-certsuite | web-platform-tests/tests/webdriver/modal/alerts_quit_test.py | Python | mpl-2.0 | 738 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
url(r'^$', 'aadrest.views.index', name='index'),
url(r'^step1/$', 'aadrest.views.step1', name='step1'),
url(r'^step2/$', 'aadrest.views.step2', name='step2'),
url(r'^step3/$', 'aadrest.views.step3', n... | sebastus/azure-python-authenticate | djangoSite/aadrest/urls.py | Python | apache-2.0 | 675 |
import os.path
from .sqlite import * # noqa
SLUMBER_USERNAME = 'test'
SLUMBER_PASSWORD = 'test'
SLUMBER_API_HOST = 'http://localhost:8000'
# A bunch of our tests check this value in a returned URL/Domain
PRODUCTION_DOMAIN = 'readthedocs.org'
GROK_API_HOST = 'http://localhost:8888'
try:
from local_settings impor... | sils1297/readthedocs.org | readthedocs/settings/test.py | Python | mit | 361 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.test import TestCase
from physical.models import Volume
from physical.tests import factory as physical_factory
from logical.tests import factory as logical_factory
from ..tasks_disk_resize import update_disk
from .factory import TaskHistoryFacto... | globocom/database-as-a-service | dbaas/notification/tests/test_disk_resize.py | Python | bsd-3-clause | 2,733 |
#!/usr/bin/env python3
###############################################################################
# Copyright 2017 The Apollo 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... | ApolloAuto/apollo | modules/tools/routing/util.py | Python | apache-2.0 | 3,562 |
# Authors: Denis A. Engemann <denis.engemann@gmail.com>
# Teon Brooks <teon.brooks@gmail.com>
#
# simplified BSD-3 license
import datetime
import time
import numpy as np
from .egimff import _read_raw_egi_mff
from .events import _combine_triggers
from ..base import BaseRaw
from ..utils import _read... | Teekuningas/mne-python | mne/io/egi/egi.py | Python | bsd-3-clause | 11,044 |
#!/usr/bin/env python
# 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>'
from functools import partial
from PyQt4.Qt import (
Qt, QMenu, QPoint, ... | kobolabs/calibre | src/calibre/gui2/search_restriction_mixin.py | Python | gpl-3.0 | 24,447 |
"""
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 ... | joshlk/scrapy | scrapy/settings/default_settings.py | Python | bsd-3-clause | 7,772 |
# Copyright 2020, The TensorFlow Federated 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/federated | tensorflow_federated/python/learning/reconstruction/reconstruction_utils.py | Python | apache-2.0 | 7,804 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import string, xbmc, xbmcgui, xbmcplugin, xbmcaddon, os, sys, urllib, urllib2, cookielib, time, codecs, datetime, re
import socket
import sqlite3 as db
from BeautifulSoup import BeautifulSoup, BeautifulStoneSoup
import calendar
socket.setdefaulttimeout(35000)
PLUGIN_NAME =... | sshnaidm/ru | script.module.YaTv/lib/YaTv.py | Python | gpl-2.0 | 65,597 |
from django.conf.urls import url, include
urlpatterns = [
url(r'^bookmarks/', include('bookmarks.api_urls', namespace='bookmarks')),
url(r'^tags/', include('wptags.api_urls', namespace='tags')),
]
| hellsgate1001/waypoints | waypoints/waypoints/api_urls.py | Python | mit | 206 |
# In Python 3.2 JUMP_ABSOLUTE's (which can
# turn into COME_FROM's) are not optimized as
# they are in later Python's.
#
# So an if statement can jump to the end of a for loop
# which in turn jump's back to the beginning of that loop.
#
# Should handle in Python 3.2
#
# 98 JUMP_BACK '16' statement afte... | rocky/python-uncompyle6 | test/simple_source/looping/10_for_if_loopback.py | Python | gpl-3.0 | 1,639 |
"""
Testing for (Mean) Average Precision metric.
"""
from . import helpers
import itertools
import numpy as np
import pyltr
class TestAP(helpers.TestMetric):
def get_metric(self):
return pyltr.metrics.AP(k=4)
def get_queries_with_values(self):
yield [], 0.0
yield [0], 0.0
y... | jma127/pyltr | pyltr/metrics/tests/test_ap.py | Python | bsd-3-clause | 691 |
# 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/LICENSE-2.0
#
# Unless required by applica... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/tensorflow/models/resnet/cifar_input.py | Python | bsd-2-clause | 4,463 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_http_listener_py3.py | Python | mit | 3,718 |
#/###################/#
# Import modules
#
#ImportModules
import ShareYourSystem as SYS
#/###################/#
# Build the model
#
#set
BrianingDebugVariable=25.
#set
AgentUnitsInt=1000
#Define
MyPredicter=SYS.PredicterClass(
).mapSet(
{
'BrianingStepTimeFloat':0.01,
'-Populations':[
('|Sensor',{
... | Ledoux/ShareYourSystem | Pythonlogy/ShareYourSystem/Specials/Predicters/Predicter/tests/02_tests_auto_spike/07_test_spike_multiagents_homogeneous_twosensors_ExampleCell.py | Python | mit | 2,921 |
#!/usr/bin/env python
strings=['hey','guys','i','am','a','string']
parameter_list=[[strings]]
def features_string_char (strings):
from shogun import StringCharFeatures, RAWBYTE
from numpy import array
#create string features
f=StringCharFeatures(strings, RAWBYTE)
#and output several stats
#print("max string l... | lambday/shogun | examples/undocumented/python/features_string_char.py | Python | bsd-3-clause | 792 |
"""
Created by Manuel Peuster <manuel@peuster.de>
This is a stupid MANO plugin used for testing.
"""
import logging
import json
import time
import sys
import os
import yaml
import uuid
sys.path.append("../son-mano-base")
from sonmanobase.plugin import ManoBasePlugin
logging.basicConfig(level=logging.INFO)
LOG = log... | sonata-nfv/son-tests | int-slm-infrabstractV1/test-cleaner/test-cleaner/exampleplugin.py | Python | apache-2.0 | 4,340 |
# Copyright 2014 Hewlett-Packard Development Company, L.P.
# 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... | virtualopensystems/neutron | neutron/db/dvr_mac_db.py | Python | apache-2.0 | 6,855 |
#!/usr/bin/env python
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import re
import os.path
from io import open
from setuptools import find_packages, setup
PACKAGE_NAME = "azure-identity"
PACKAGE_PPRINT_NAME = "I... | Azure/azure-sdk-for-python | sdk/identity/azure-identity/setup.py | Python | mit | 2,651 |
"""
The algorithm finds the pattern in given text using following rule.
The bad-character rule considers the mismatched character in Text.
The next occurrence of that character to the left in Pattern is found,
If the mismatched character occurs to the left in Pattern,
a shift is proposed that aligns text block and pa... | TheAlgorithms/Python | strings/boyer_moore_search.py | Python | mit | 2,738 |
# Have the function SimpleSymbols(str) take the str parameter being passed and
# determine if it is an acceptable sequence by either returning the string true
# or false. The str parameter will be composed of + and = symbols with several
# letters between them (ie. ++d+===+c++==a) and for the string to be true each
# l... | serdardalgic/coderbyte-challenges | easy-07-simple-symbols.py | Python | gpl-2.0 | 1,044 |
# -*- coding: utf-8 -*-
import base64
from django.conf.urls import url
from tastypie.authentication import ApiKeyAuthentication
from tastypie.authorization import DjangoAuthorization
from tastypie.exceptions import ImmediateHttpResponse
from tastypie.http import HttpBadRequest
from tastypie.resources import ModelReso... | NealSun96/High5App | src/employee_title/api.py | Python | gpl-2.0 | 3,099 |
from __future__ import annotations
import logging
import sys
import traceback
from typing import Any, Mapping, TYPE_CHECKING
from ai.backend.common.events import AgentErrorEvent
from ai.backend.common.logging import BraceStyleAdapter
from ai.backend.common.types import (
AgentId,
LogSeverity,
)
from ai.backen... | lablup/backend.ai-manager | src/ai/backend/manager/plugin/error_monitor.py | Python | lgpl-3.0 | 3,974 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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... | rwl/PyCIM | CIM14/IEC61968/PaymentMetering/CashierShift.py | Python | mit | 5,075 |
import pymongo
import datetime
def shareFeedback():
client = pymongo.MongoClient('mongodb://54.86.201.60:27000/')
database = client['music']
collection = database['feedback']
post = {
"authorName" : "Jeremy Offer",
"authorMessage" : "Supper dooppeeer",
"mobileDevice" : "iOS",
... | groschovskiy/lerigos_music | Server/API/module/feedback.py | Python | apache-2.0 | 496 |
import os
COMPUTER_NAME = os.environ['COMPUTERNAME']
print("Computer: ", COMPUTER_NAME)
WORKER_POOL_SIZE = 8
TARGET_VOXEL_MM = 1.00
MEAN_PIXEL_VALUE_NODULE = 41
LUNA_SUBSET_START_INDEX = 0
SEGMENTER_IMG_SIZE = 320
BASE_DIR_SSD = "C:/werkdata/kaggle/ndsb3/"
BASE_DIR = "D:/werkdata/kaggle/ndsb3/"
EXTRA_DA... | juliandewit/kaggle_ndsb2017 | settings.py | Python | mit | 659 |
from xml.etree import ElementTree
from .models import Product, Program
def _simple_fixture_generator(user, name, fields, data_fn, last_sync=None):
project = user.project
if not project or not project.commtrack_enabled:
return []
# expand this here to prevent two separate couch calls
data = da... | SEL-Columbia/commcare-hq | corehq/apps/commtrack/fixtures.py | Python | bsd-3-clause | 2,684 |
"""
A simple PyUSBTMC-based interface for the Rigol DS1102E Oscilloscope.
"""
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
setup(
name='Rigol_USBTMC',
version='0.0.2',
description='A simple PyUSBTMC-based interface fo... | AIMAtlanta/Rigol_USBTMC | setup.py | Python | mit | 1,044 |
# -*- coding: utf-8 -*-
# This source file is part of mc4p,
# the Minecraft Portable Protocol-Parsing Proxy.
#
# Copyright (C) 2011 Matthew J. McGill, Simon Marti
#
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it un... | sadimusi/mc4p | mc4p/debug.py | Python | gpl-2.0 | 22,431 |
# Lint as: python2, python3
# 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
#
... | annarev/tensorflow | tensorflow/lite/python/metrics_nonportable.py | Python | apache-2.0 | 1,871 |
import logging
from lml.plugin import PluginInfo
from moban import constants
LOG = logging.getLogger(__name__)
class ContentProcessor(PluginInfo):
"""
@ContentProcessor('strip', 'Stripping', 'Stripped'):
def strip(template_file: str) -> str:
ret = template_file.strip()
return ret
""... | chfw/moban | moban/core/content_processor.py | Python | mit | 1,622 |
# https://oj.leetcode.com/problems/remove-element/
# 12:38 - 12:44
class Solution:
# @param A a list of integers
# @param elem an integer, value need to be removed
# @return an integer
def removeElement(self, A, elem):
aLen = len(A)
if aLen > 0:
i = 0
while i < aLen:
... | yaoxuanw007/forfun | leetcode/python/removeElement.py | Python | mit | 555 |
from bdnyc_app import app_bdnyc
import os
if __name__ == '__main__':
port = int(os.environ.get('PORT', 5000))
app_bdnyc.run(host='0.0.0.0', port=port, debug=False) | dr-rodriguez/AstrodbWeb | runapp.py | Python | mit | 172 |
#!/usr/bin/env python3
# Copyright 2022 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Rebuilds PNG files intended for use as icon images on the Mac. It is
# reasonably robust, but is not designed to be robust against ... | chromium/chromium | tools/mac/icons/png_fix.py | Python | bsd-3-clause | 4,042 |
"""
Exercise the Website class to insure the methods operate
as expected.
"""
# pylint: disable=C0301,W0622
import unittest
if __name__ == "__main__" and __package__ is None:
__package__ = "apiary.tests"
from apiary.tasks.bot.notify_segment import NotifySegment
class TestNotifySegment(unittest.TestCase):
"""... | apexkid/Wikiapiary | apiary/tests/bot/notify_segment_tests.py | Python | gpl-2.0 | 746 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2011 DeneroTeam. (<http://www.deneroteam.com>)
# Copyright (C) 2011 Didotech Inc. (<http://www.didotech.com>)
# All Rights Reserved
#
# This program is free software: you can redistribute... | dhp-denero/LibrERP | product_catalog_extend_livelucky/__init__.py | Python | agpl-3.0 | 1,117 |
#coding=utf-8
# Copyright (C) 2014 by Víctor Romero Blanco <info at playcircular dot com>.
# http://playcircular.com/
# It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
# You can get copies of the licenses here: http://www.affero.org/oagpl.html
# AFFERO GENERAL PUBLIC LICENSE is also in... | PlayCircular/play_circular | apps/paginas/admin.py | Python | agpl-3.0 | 12,654 |
# Copyright 2008 Felix Marczinowski <fmarczin@physnet.uni-hamburg.de>
#
# This file is part of PySXM.
#
# PySXM 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
# ... | fmarczin/pysxm | SXM/Omikron.py | Python | gpl-3.0 | 10,263 |
import sys
import numpy as np
#from ase import Atoms
from ase.units import Bohr
from ase.dft.kpoints import kpoint_convert
from gpaw import debug
from gpaw.mpi import world, distribute_cpus
from gpaw.utilities import gcd
#from gpaw.utilities.tools import md5_array
from gpaw.utilities.gauss import gaussian_wave
from g... | robwarm/gpaw-symm | gpaw/test/parallel/ut_gucops.py | Python | gpl-3.0 | 14,751 |
#! /usr/bin/env python
"""
Author: Jeremy M. Stober
Program: FIND_DUPLICATES.PY
Date: Thursday, November 1 2012
Description: Find duplicate images.
"""
import numpy as np
duplicates = []
imgs = np.load("observations.npy")
#imgs = np.load("imgs.npy")
for (i,p) in enumerate(imgs):
for (j,q) in enumerate(imgs[i:]):... | stober/lspi | bin/find_duplicates.py | Python | bsd-2-clause | 533 |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import test_framework.loginit
from test_framework.test_framework import ComparisonTestFramework
from test_... | BitcoinUnlimited/BitcoinUnlimited | qa/rpc-tests/bipdersig-p2p.py | Python | mit | 6,817 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-2015 Elico Corp (<http://www.elico-corp.com>)
# Authors: Siyuan Gu
#
# This program is free software: you can redistribute it and/or modify... | Elico-Corp/odoo-addons | product_multiprices/__openerp__.py | Python | agpl-3.0 | 1,514 |
# coding: utf-8
import os
for parent, subdir, files in os.walk("../pymatgen"):
for fn in files:
if fn.endswith(".py") and fn != "__init__.py":
fp = os.path.join(parent, fn)
with open(fp) as f:
contents = f.read()
if "unicode_literals" not in contents:
... | gmatteo/pymatgen | dev_scripts/force_unicode.py | Python | mit | 1,075 |
# -*- coding: utf-8 -*-
""" Commonly used band frequencies
For your convenience we have predefined some widely adopted brain rhythms.
You can access them with
.. code-block:: python
:linenos:
from dyconnmap.bands import *
print(bands['alpha'])
============= ================== =================
brain... | makism/dyfunconn | dyconnmap/bands.py | Python | bsd-3-clause | 1,162 |
import pygame
from pygame.locals import *
from OpenGL.GL import *
from OpenGL.GLU import *
vertices = (
(1, -1, -1),
(1, 1, -1),
(-1, 1, -1),
(-1, -1, -1),
(1, -1, 1),
(1, 1, 1),
(-1, -1, 1),
(-1, 1, 1)
)
edges = (
(0, 1),
(0, 3),
(0, 4),
(2, 1),
(2, 3),
(2,... | quanhua92/learning-notes | libs/pyopengl/pygame/01_navigate.py | Python | apache-2.0 | 2,078 |
# -*- encoding: utf-8 -*-
"""
Usage::
hammer capsule [OPTIONS] SUBCOMMAND [ARG] ...
Parameters::
SUBCOMMAND subcommand
[ARG] ... subcommand arguments
Subcommands::
content Manage the capsule content
create Creat... | ares/robottelo | robottelo/cli/capsule.py | Python | gpl-3.0 | 3,537 |
# encoding: UTF-8
import json
import shelve
import sys
import traceback
import time; # 引入time模块
import datetime
import pandas as pd
import uuid
from vnpy.event import Event
from vnpy.DAO import *
from vnpy.trader.vtConstant import (DIRECTION_LONG, DIRECTION_SHORT,
OFFSET_OPEN, OF... | cmbclh/vnpy1.7 | vnpy/trader/app/spreadTrading/stEngine.py | Python | mit | 32,762 |
# Copyright 2018-2021 The Matrix.org Foundation C.I.C.
#
# 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... | matrix-org/synapse | tests/rest/media/v1/test_media_storage.py | Python | apache-2.0 | 21,400 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import re
def IsTimelineInteractionRecord(event_name):
return event_name.startswith('Interaction.')
class TimelineInteractionRecord(object):
"""Repre... | patrickm/chromium.src | tools/perf/metrics/timeline_interaction_record.py | Python | bsd-3-clause | 3,083 |
import boto3
import json
import time
import dateutil.parser
import datetime
import calendar
# Helper class to convert a DynamoDB item to JSON.
class DecimalEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, decimal.Decimal):
if o % 1 > 0:
return floa... | Signiant/aws-ses-recorder | lambda-functions/storeSESDelivery/src/storeSESDelivery_lambda.py | Python | mit | 3,903 |
"""
auth.py
author: Akash Gaonkar
Methods to help with user authentication.
Some useful methods:
create_user: add a new user to the users document
check_password: check a username and password
create_auth_token: create an authorization token
@require_auth_header: ensure an auth token i... | ByronBecker/rmp | focus_server/auth.py | Python | mit | 4,912 |
from __future__ import print_function
import argparse
import sys
import traceback
from subprocess import CalledProcessError
from bloom.git import ensure_git_root
from bloom.git import get_root
from bloom.logging import error
from bloom.util import add_global_arguments
from bloom.util import handle_global_arguments
... | vrabaud/bloom | bloom/commands/git/patch/patch_main.py | Python | bsd-3-clause | 1,979 |
from emit import Router
from emit.multilang import ShellNode
router = Router()
@router.node(('n',))
class PythonShellNode(ShellNode):
command = 'python test.py'
@router.node(('n',))
class RubyShellNode(ShellNode):
command = 'bundle exec ruby test.rb'
| BrianHicks/emit | examples/multilang/graph.py | Python | mit | 264 |
# Copyright 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | gaolichuang/py-essential | tests/testmods/fbar_foo_opt.py | Python | apache-2.0 | 719 |
from js9 import j
import tarantool
import pystache
import os
JSBASE = j.application.jsbase_get_class()
class TarantoolDB(JSBASE):
def __init__(self, name="test", path="$DATADIR/tarantool/$NAME", adminsecret="admin007", port=3301):
JSBASE.__init__(self)
self.path = j.dirs.replace_txt_dir_vars(pat... | Jumpscale/core9 | JumpScale9/clients/tarantool/TarantoolDB.py | Python | apache-2.0 | 3,082 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('primary', '0006_weight'),
]
operations = [
migrations.AddField(
model_name='usersettings',
name='mot... | ThirdCoalition/primary | primary/migrations/0007_auto_20150512_0301.py | Python | mit | 757 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: play_response.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as ... | mmcloughlin/finsky | finsky/protos/play_response_pb2.py | Python | mit | 6,214 |
"""Assign a WFO to sites in the metadata tables that have no WFO set."""
from pyiem.util import get_dbconn, logger
LOG = logger()
def main():
"""Go Main"""
mesosite = get_dbconn("mesosite")
postgis = get_dbconn("postgis")
mcursor = mesosite.cursor()
mcursor2 = mesosite.cursor()
pcursor = pos... | akrherz/iem | scripts/dbutil/set_wfo.py | Python | mit | 2,127 |
from unittest import TestCase
import pandas as pd
from .test_trading_calendar import ExchangeCalendarTestBase
from zipline.utils.calendars.exchange_calendar_ice import ICEExchangeCalendar
class ICECalendarTestCase(ExchangeCalendarTestBase, TestCase):
answer_key_filename = 'ice'
calendar_class = ICEExchangeC... | humdings/zipline | tests/calendars/test_ice_calendar.py | Python | apache-2.0 | 1,818 |
# -*- coding: utf-8 -*-
"""
Copyright (c) 2011, Max Leuthaeuser
License: GPL (see LICENSE.txt for details)
"""
__author__ = 'Max Leuthaeuser'
__license__ = 'GPL'
from abc import ABCMeta
class NamedElement:
'''
NamedElement defines a simple meta class for all elements
in a meta language based object orien... | max-leuthaeuser/naoservice | CodeGeneration/AbstractMetaModel/NamedElement.py | Python | gpl-3.0 | 1,929 |
# Generated by Django 3.2.7 on 2021-11-05 08:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('a4comments', '0008_comment_is_deleted_empty_text'),
]
operations = [
migrations.AddField(
model_name='comment',
name... | liqd/adhocracy4 | adhocracy4/comments/migrations/0009_comment_is_blocked.py | Python | agpl-3.0 | 406 |
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
import os
import unittest
import doctest
from itertools import chain
from lxml import etree
from decimal import Decimal
from io import BytesIO
from mock import Mock, patch
im... | kret0s/gnuhealth-live | tryton/server/trytond-3.8.3/trytond/modules/account_payment_sepa/tests/test_account_payment_sepa.py | Python | gpl-3.0 | 15,736 |
# -*- coding: utf-8 -*-
# Copyright(c) 2016-2020 Jonas Sjöberg <autonameow@jonasjberg.com>
# Source repository: https://github.com/jonasjberg/autonameow
#
# This file is part of autonameow.
#
# autonameow is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public L... | jonasjberg/autonameow | tests/unit/test_util_disk_sanitize.py | Python | gpl-2.0 | 4,830 |
"""
"""
from nose.plugins import Plugin
from .notifications import Notification
class AlertPlugin(Plugin):
"""
Plugin that should fire os level notification after tests are finished.
"""
name = 'alert'
def get_notification(self, result):
"""
Returns ``Notification`` instance for g... | lukaszb/nose-alert | nosealert/plugin.py | Python | bsd-2-clause | 1,243 |
# Copyright (c) 2018 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... | chengduoZH/Paddle | python/paddle/fluid/tests/unittests/test_ir_memory_optimize_transformer.py | Python | apache-2.0 | 1,817 |
# Prime Palindrome Challenge
# Solution 06: Using Sieve of Atkin
if __name__ == "__main__":
# Not Implemented yet
| madoodia/codeLab | python/codeeavl.com/Easy/Prime Palindrome/solution_06.py | Python | mit | 120 |
#!venv/bin/python3
# whats_on_tv.py - randomly selects media files to play from input directory
import sys
import os
import logging
import argparse
import random
import subprocess
import shlex
import re
import videoLister
import mff
def main():
# set up logging
logger = logging.getLogger(__name__)
loggin... | samcheck/PyMedia | whats_on_tv.py | Python | mit | 3,488 |
from robot.utils import normalizing
def _int_any_base(i, base=0):
try:
return int(i, base)
except TypeError:
return i
def int_any_base(i, base=0):
try:
return _int_any_base(i, base)
except ValueError:
raise RuntimeError('Could not parse integer "%s"' % i)
def list_any_... | kontron/robotframework-aardvarklibrary | src/AardvarkLibrary/utils.py | Python | apache-2.0 | 832 |
import yaml
from pydrive2.files import GoogleDriveFile
with open('config/settings.yaml', 'r') as yaml_config:
config_map = yaml.load(yaml_config, Loader=yaml.SafeLoader)
def delete_drive_permission_job(context):
job_data = context.job.context
drive_root_folder: GoogleDriveFile = job_data['folder_obj']
... | UNICT-DMI/Telegram-DMI-Bot | module/utils/drive_contribute_utils.py | Python | gpl-3.0 | 648 |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Tavendo GmbH
#
# 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 with... | hzruandd/AutobahnPython | examples/twisted/wamp/rpc/timeservice/frontend.py | Python | mit | 2,292 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'DocumentSetFormEntry.document'
db.alter_column(u'crowdataapp_documentsetformentry', 'docu... | the-engine-room/crowdata | crowdataapp/migrations/0004_auto__chg_field_documentsetformentry_document.py | Python | mit | 10,383 |
# -*- coding: utf-8 -*-
from decimal import Decimal
from django.db import models
from django.utils.translation import ugettext_lazy as _
from mptt.models import MPTTModel, TreeForeignKey
from fuzzy_modeling.models.norms import NormModel
from fuzzy_modeling.utils import get_class_by_python_path
from fuzzy_modeling.... | arruda/cloudfuzzy | fuzzy_modeling/models/operators.py | Python | mit | 6,898 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.