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
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # salty/main.py # # Copyright 2015 gkmcd <saltystats@tuta.io> # # 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 Lice...
gkmcd/salty-stats
salty.py
Python
gpl-2.0
9,378
# coding=utf-8 """ The CPUCollector collects CPU utilization metric using /proc/stat. #### Dependencies * /proc/stat """ import diamond.collector import os import time from diamond.collector import str_to_bool try: import psutil except ImportError: psutil = None class CPUCollector(diamond.collector.Col...
baris/fullerite
src/diamond/collectors/cpu/cpu.py
Python
apache-2.0
8,748
__author__ = 'vcaen'
vcaen/personalwebsite
app/filter/__init__.py
Python
cc0-1.0
21
from django.conf.urls.defaults import * from multilingual.flatpages.views import * urlpatterns = patterns('', url(r'^(?P<url>.*)$', MultilingualFlatPage , name="multilingual_flatpage"), )
fabiocorneti/django-multilingual
multilingual/flatpages/urls.py
Python
mit
193
#!/usr/bin/env python from gevent import monkey monkey.patch_all() import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hanuman.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
sunlightlabs/hanuman
gevent_manage.py
Python
bsd-3-clause
296
# -*- 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...
janocat/odoo
addons/purchase/purchase.py
Python
agpl-3.0
91,352
""" Tests of the code in uncertainties/unumpy/__init__.py. These tests can be run through the Nose testing framework. (c) 2010-2016 by Eric O. LEBIGOT (EOL). """ from __future__ import division # 3rd-party modules: try: import numpy except ImportError: import sys sys.exit() # There is no reason to test...
fedebell/Laboratorio3
uncertainties/uncertainties-py27/unumpy/test_unumpy.py
Python
gpl-3.0
10,520
# Copyright 2018-present Kensho Technologies, LLC. import random from .utils import create_edge_statement, create_vertex_statement, get_random_limbs, get_uuid SPECIES_LIST = ( "Nazgul", "Pteranodon", "Dragon", "Hippogriff", ) FOOD_LIST = ( "Bacon", "Lembas", "Blood pie", ) NUM_FOODS = 2 ...
kensho-technologies/graphql-compiler
scripts/generate_test_sql/species.py
Python
apache-2.0
1,853
# This file is part of Indico. # Copyright (C) 2002 - 2022 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from sqlalchemy import func from indico.modules.rb.models.rooms import Room from indico.modules.rb.operat...
indico/indico
indico/modules/rb/user_prefs.py
Python
mit
2,767
from django.contrib.auth.models import User from django.db import models from d51.django.apps.email_capture import managers class EmailAddress(models.Model): email = models.CharField(max_length=200) user = models.ForeignKey(User, null=True, blank=True) def __unicode__(self): return self.email
domain51/d51.django.apps.email_capture
d51/django/apps/email_capture/models.py
Python
gpl-3.0
317
#!/usr/bin/env python """ An alarm can be executed when an error condition occurs Author: Elias Bakken Redeem 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 opti...
intelligent-agent/redeem
redeem/Alarm.py
Python
gpl-3.0
6,796
import os import sys import numpy as np from os.path import dirname from abc import ABC, abstractmethod from src import Utils from src.play.model.Move import Move class BaseNNBot(ABC): def __init__(self): if Utils.in_pyinstaller_mode(): # path to root dir, expects data to be added like this ...
nathbo/GO_DILab
src/learn/BaseNNBot.py
Python
mit
1,904
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyRequestsFutures(PythonPackage): """Asynchronous Python HTTP Requests for Humans using Fu...
LLNL/spack
var/spack/repos/builtin/packages/py-requests-futures/package.py
Python
lgpl-2.1
836
emoji_name = 'visto' async def execute(message, client): print ('MENTION: Executing... Requested by {}'.format(message.author)) emojis = message.server.emojis for e in emojis: if e.name == emoji_name: await client.add_reaction(message, ':{name}:{id}' .format(name=e.name, id=e.id))
Aaron23145/Sergis-Bot
bot/commands/mention.py
Python
mit
303
""" Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example, Given nums = [0, 1, 3] return 2. Note: Your algorithm should run in linear runtime complexity. Could you implement it using only constant extra space complexity? Credits: ...
ufjfeng/leetcode-jf-soln
python/268_missing_numbers.py
Python
mit
614
# Copyright 2017 the V8 project 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 os from testrunner.local import testsuite from testrunner.objects import testcase proposal_flags = [{ 'name': 'reference-types...
wiltonlazary/arangodb
3rdParty/V8/v7.9.317/test/wasm-spec-tests/testcfg.py
Python
apache-2.0
1,810
""" Django settings for todo project. Generated by 'django-admin startproject' using Django 1.9.2. For more information on this file, see https://docs.djangoproject.com/en/1.9/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.9/ref/settings/ """ import os # Bu...
jacoboamn87/todolist
todo/settings.py
Python
gpl-3.0
3,308
# 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 ...
Azure/azure-sdk-for-python
sdk/cognitiveservices/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/operations/images_operations.py
Python
mit
19,173
#!/usr/bin/python # Copyright 2017 Mender Software AS # # 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...
pasinskim/deployments
tests/tests/test_deployment.py
Python
apache-2.0
18,217
from django import forms from django.conf import settings from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ from django.contrib.admin.widgets import ForeignKeyRawIdWidget generic_script = """ <script type="text/javascript"> function showGenericRelatedObjectLookupPop...
mythmon/kitsune
authority/widgets.py
Python
bsd-3-clause
2,627
"""Module to create and parse tichu game logs.""" import json from . import constructed_constants class Parser(): def __init__(self, deck=None, *args, **kwargs): self.deck = sorted(deck) self._str_deck = [str(card) for card in self.deck] super().__init__(*args, **kwargs) def parse(s...
julka2010/games
games/tichu/logs.py
Python
mpl-2.0
3,732
#!/usr/bin/env python # tile-generator # # Copyright (c) 2015-Present Pivotal Software, 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...
alex-slynko/tile-generator
sample/src/app/app.py
Python
apache-2.0
3,178
# Copyright 2021, Kay Hayen, mailto:kay.hayen@gmail.com # # Python tests originally created or extracted from other peoples work. The # parts were too small to be protected. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the ...
kayhayen/Nuitka
tests/syntax/LateFutureImport.py
Python
apache-2.0
900
''' the model implementation ''' import numpy as np import itertools class model: ''' this creates an object which holds all the curves and allows them to be updated easily ''' def __init__(self): self.model = [] self.model_params = [] self.num_params = []# starts with 0 for ea...
parsonsaaron/FlexFit
flexfit/model.py
Python
mit
3,156
# -*- coding: utf-8 -*- # 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 "Li...
bernard357/shellbot
shellbot/listener.py
Python
apache-2.0
11,724
"""The tests the cover command line platform.""" import logging import unittest from homeassistant.core import callback from homeassistant import setup import homeassistant.components.cover as cover from homeassistant.const import STATE_OPEN, STATE_CLOSED from tests.common import ( get_test_home_assistant, asser...
ct-23/home-assistant
tests/components/cover/test_template.py
Python
apache-2.0
26,113
#!/usr/bin/python #Built-in Imports import time import sys #Libraries import RPi.GPIO as GPIO import neopixel as npx import ff_sim as ffs # Global for hardware system PINS = [18, 27, 23, 25] KEEP_GOING = True last_press = 10 strip_handle = [] period_range = 1.0 mode = 0 ff_num = 0 strip_num = 0 def runner(grid): ...
wannabeCitizen/FireflySim
control_user_input.py
Python
mit
3,619
import cassiopeia as cass from cassiopeia import Summoner, Match from cassiopeia.data import Season, Queue from collections import Counter def print_newest_match(name: str, region: str): # Notice how this function never makes a call to the summoner endpoint because we provide all the needed data! summoner =...
robrua/cassiopeia
examples/match.py
Python
mit
3,367
import bpy from bpy import context import os import sys import argparse ## Example call from commandline: blender -b -P decimate_mesh_blender.py -- -f mesh.obj -o mesh_dec.obj -r 0.5 -i 2 -n 4 -l 0.5 ## Blender will ignore all options after -- so parameters can be passed to python script. # get the args passed to ble...
IBT-FMI/SAMRI
samri/plotting/blender_visualization.py
Python
gpl-3.0
11,136
class FailedBackendError(Exception): pass
ponty/pyscreenshot
pyscreenshot/err.py
Python
bsd-2-clause
46
__license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>' import os try: from PIL import ImageFont ImageFont except ImportError: import ImageFont ''' Default fonts used in the PRS500 ''' SYSTEM_FONT_PATH = '/usr/share/fonts/truetype/ttf-liberation/' FONT_MAP = { ...
Eksmo/calibre
src/calibre/ebooks/lrf/fonts/__init__.py
Python
gpl-3.0
2,330
# -*- coding: utf-8 -*- from __future__ import unicode_literals from pelican.tests.support import unittest from pelican.urlwrappers import Category, Tag, URLWrapper class TestURLWrapper(unittest.TestCase): def test_ordering(self): # URLWrappers are sorted by name wrapper_a = URLWrapper(name='firs...
gymglish/pelican
pelican/tests/test_urlwrappers.py
Python
agpl-3.0
1,949
#!/usr/bin/env python # # __COPYRIGHT__ # # 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, ...
andrewyoung1991/scons
test/Progress/spinner.py
Python
mit
2,151
import csv import os import os.path import tarfile from urllib.parse import urlparse import numpy as np import torch import torch.utils.data as data from PIL import Image from wildcat import util object_categories = ['aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', 'cat', 'chair',...
durandtibo/wildcat.pytorch
wildcat/voc.py
Python
mit
8,840
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php """ Application that runs a CGI script. """ import os import sys import subprocess from six.moves.urllib.parse import quote try: import select exc...
endlessm/chromium-browser
third_party/catapult/third_party/Paste/paste/cgiapp.py
Python
bsd-3-clause
9,725
""" supergametools docstrings """ # from supergame import supergame from supergametools import *
btengels/supergametools
supergametools/__init__.py
Python
gpl-3.0
98
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('main', '0014_generalsetting_titulo'), ] operations = [ migrations.AlterField( model_name='imagen', n...
nicolas471/Lecole
main/migrations/0015_auto_20160404_1648.py
Python
gpl-3.0
433
# models.py # # Copyright(c) Exequiel Ceasar Navarrete <esnavarrete1@up.edu.ph> # Licensed under MIT # Version 1.0.0-alpha6 from app import db from slugify import slugify class Crop(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(80), unique=False) crop_type = db.Column(db.Str...
ecsnavarretemit/sarai-interactive-maps-backend
app/models.py
Python
mit
2,074
import sys from collections import namedtuple import bin import semantic descriptorDel = "|" def dumpkv(k, v, padding=35): print(" %s %s" % (k.ljust(padding, '-'), v)) class GrammerUnit(): def __init__(self, bs): self.data = self.init(bs) def _ins(self, k, v): if k in self.__dict_...
liuyang1/toy264
grammer.py
Python
mit
22,849
''' Created on Dec 2, 2015 @author: Sameer Adhikari ''' # Class that represents the common operations between # composite and leaf/primitive nodes in the hierarchy # This is a simulation which lacks a lot of operations class Component(object): def __init__(self, name): self.name = name def ...
tri2sing/PyOO
patterns/composite/entities.py
Python
gpl-2.0
1,989
import sys sys.path.insert(0,'../') from fast_guided_filter import blur print("hello")
justayak/fast_guided_filters
test/sample.py
Python
mit
88
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import pytest import unittest import socket import urllib2 import sfml.network as sf @pytest.fixture def ip(): return sf.IpAddress.from_string('127.0.0.1') def test_invalid_address(ip): invalid_ip = sf.IpAddress() assert str(invalid_ip) != str(ip) def test...
Gaulois94/python-sfml
tests/network/test_ipaddress.py
Python
lgpl-3.0
977
from django.core.urlresolvers import reverse from django.test.client import RequestFactory from nose.tools import eq_, ok_ from mkt.site.tests import app_factory, TestCase from mkt.versions.models import Version from mkt.versions.serializers import VersionSerializer class TestVersionSerializer(TestCase): def se...
jamesthechamp/zamboni
mkt/versions/tests/test_serializers.py
Python
bsd-3-clause
1,807
from django.contrib import admin # Register your models here. from .models import Source from .actions import doGraphMerveille class MySource( admin.ModelAdmin ): actions = [ doGraphMerveille ] admin.site.register( Source, MySource )
DarioGT/docker-carra
src/rqEirq/admin.py
Python
mit
247
"""wechatkit message.""" from .utils import RequestUtil class TemplateMessage(object): """Template message.""" send_url = 'https://api.weixin.qq.com/cgi-bin/message/template/send?access_token={}' list_url = 'https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token={}' @classm...
istommao/wechatkit
wechatkit/message.py
Python
mit
671
# -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-03-27 19:06 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('posts', '0005_post_author'), ] operations = [ migrations.CreateModel( ...
jokuf/hack-blog
posts/migrations/0006_auto_20170327_1906.py
Python
mit
843
# Copyright 2013: Mirantis 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 b...
dtudares/hello-world
yardstick/yardstick/common/utils.py
Python
apache-2.0
2,390
from setuptools import setup setup(name = 'jupyter-publication-scripts', version = '0.1-dev', description = 'Useful scripts for Making publication ready Python Notebooks', maintainer = 'Alexander Schlaich', maintainer_email = 'aschlaich@physik.fu-berlin.de', download_url = 'https://github....
schlaicha/jupyter-publication-scripts
setup.py
Python
bsd-2-clause
2,327
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('article', '0009_add_stream_fields_for_modular_article_content'), ] operations = [ migrations.AddField( model_nam...
PARINetwork/pari
article/migrations/0010_add_show_modular_content_field.py
Python
bsd-3-clause
445
#! /usr/bin/python import datetime import logging import select import socket import time from engine import Engine from manager import Manager from endpoint import Endpoint logging.basicConfig(level=logging.DEBUG) class Server(object): def __init__(self): self._engines = {} # name: engine s...
da4089/exsim
exsim/server.py
Python
gpl-3.0
7,105
import tacticenv import unittest from pyasm.security import Batch Batch() from pyasm.biz.snapshot_test import SnapshotTest unittest.main()
Southpaw-TACTIC/TACTIC
src/test/snapshot_test.py
Python
epl-1.0
144
# 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...
horance-liu/tensorflow
tensorflow/python/keras/_impl/keras/preprocessing/text_test.py
Python
apache-2.0
2,769
import re import math import json import operator from collections import Counter import collections from lxml import etree as ET import urllib.request import urllib.parse tree = ET.parse('workingDirectory/skos_without_duplicates.rdf') root = tree.getroot() namespaces = {"skos": "http://www.w3.org/2004/02/skos/core#"...
KarlPineau/patrimeph
uriseTerms.py
Python
mit
2,798
from path import * from durationinequality import * from parseeldi import Coefficientlocation, Ldi from chopinequality import locatechops, ADDinequations, TDinequations, splitpath, ldftoineq, ldfstoineqs, buildexist def parseexampleELDI(eldifile): file_object = open(eldifile) eldi = [] try: eldi = file_object.rea...
Leslieaj/VCELDI
project/example9.py
Python
gpl-3.0
4,907
from .api import get_request, get_request_domain
dimagi/commcare-hq
corehq/util/global_request/__init__.py
Python
bsd-3-clause
49
import sys, os from glob import glob import pandas as pd scoresdir = sys.argv[1] sub_type = sys.argv[2] assert( sub_type == 'space' or sub_type == 'ground' ) def print_ID_and_score( tprfile='tpr_filenames.txt', outfile1='avestruz_space_submission_ordered_by_id.txt', outfile2='avestruz_space_submission_ordered_by_sc...
cavestruz/StrongCNN
data/print_IDs_score.py
Python
mit
1,025
# force floating point division. Can still use integer with // from __future__ import division # This file is used for importing the common utilities classes. import numpy as np import matplotlib.pyplot as plt import sys sys.path.append("../../../../") import BellZhurkov.Python.TestExamples.TestUtil.Bell_Test_Data as ...
prheenan/BioModel
BellZhurkov/Python/TestExamples/Examples/Bell_Examples.py
Python
gpl-2.0
3,266
import os import utils.builtin from sources.industry_id import * def convert_rawhtml_from_repojt(instance): repojt = instance.repojt filenames = repojt.interface.lsfiles('JOBTITLES', '*.yaml') for filename in filenames: id = filename.replace('.yaml', '') info = repojt.get(id) if ...
followcat/predator
tools/batching.py
Python
lgpl-3.0
1,630
import os def agts(queue): if 1: queue.add('dam_break_long.py', queueopts=['-l', 'nodes=4:ppn=4'], ncpus=1, walltime=6, deps=[])
marcindulak/accts
accts/OpenFoam/2.2.2/submit.agts.py
Python
gpl-3.0
178
# RandTalkBot Bot matching you with a random person on Telegram. # Copyright (C) 2016 quasiyoke # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import logging from .errors import StrangerSenderServiceError from .strang...
quasiyoke/RandTalkBot
randtalkbot/stranger_sender_service.py
Python
agpl-3.0
1,336
import pandas as pd import plotly.graph_objs as go import dash_core_components as dcc from parsl.monitoring.web_app.utils import timestamp_to_float from parsl.monitoring.web_app.app import get_db, close_db from parsl.monitoring.web_app.plots.base_plot import BasePlot # TODO y_axis labels can't be set with callback fr...
swift-lang/swift-e-lab
parsl/monitoring/web_app/plots/default/resource_usage.py
Python
apache-2.0
2,760
#!/usr/bin/env python # -*- coding: utf-8 -*- # Created by Nick on 2016/5/29日15点53分 import dbutils ''' 添加用户信息 返回值: True/False ''' def add_users(username, password, age): sql = 'insert into user(username, password, age) values(%s,md5(%s),%s)' args = (username, password, age) _count, _rt_list = dbutils.execu...
51reboot/actual_09_homework
09/tanshuai/cmdb_v6/user/users.py
Python
mit
3,033
from flask import ( Blueprint, abort, current_app, jsonify, redirect, render_template, request, session, url_for, ) from flask_user import roles_required from ..database import db from ..date_tools import localize_datetime from ..extensions import oauth, recaptcha from ..models.app_...
uwcirg/true_nth_usa_portal
portal/eproms/views.py
Python
bsd-3-clause
16,493
# see http://pytest.org/latest/example/simple.html#detect-if-running-from-within-a-py-test-run def pytest_configure(config): import ductus ductus._called_from_test = True def pytest_unconfigure(config): import ductus del ductus._called_from_test
wikiotics/ductus1
ductus/conftest.py
Python
gpl-3.0
264
mpfit_messages={ -16:"""A parameter or function value has become infinite or an undefined number. This is usually a consequence of numerical overflow in the user's model function, which must be avoided.""", 0: "Improper input parameters.", 1: """Both actual and predicted relative reductions in the sum of squares...
keflavich/pyspeckit-obsolete
pyspeckit/spectrum/models/__init__.py
Python
mit
1,891
import argparse from textwrap import dedent from .runner import get_ledger_command, get_ledger_output def get_args(args): program = "ledgerbil/main.py pass" description = dedent( """\ Pass through args to ledger, running ledger with config from settings.py """ ) parser = a...
scarpent/ledgerbil
ledgerbil/ledgershell/passthrough.py
Python
gpl-3.0
999
''' The Jpeg_identifier class which serves to identify jpeg files. ''' from datetime import datetime from PIL import Image import identifiers class jpeg_identifier (identifiers.FileIdentifier): # -------------------------------------------------- # required properties: # - name: str # - extens...
jdthorpe/archiver
identifiers/jpeg_identifier.py
Python
mit
7,508
# 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, software # ...
openstack/ironic
ironic/tests/unit/api/test_proxy_middleware.py
Python
apache-2.0
2,349
from rest_framework import serializers from stationspinner.statistics.models import WalletBalanceEntry, \ AssetWorthEntry class CharacterWalletBalanceEntrySerializer(serializers.ModelSerializer): class Meta(object): model = WalletBalanceEntry fields = ('registered', 'value', 'name') class Cor...
kriberg/stationspinner
stationspinner/statistics/serializers.py
Python
agpl-3.0
687
# coding:utf-8 # 测试map函数的用法 ''' Docstring: map(function, sequence[, sequence, ...]) -> list Return a list of the results of applying the function to the items of the argument sequence(s). If more than one sequence is given, the function is called with an argument list consisting of the corresponding item of ...
dnxbjyj/python-basic
useful-func/map/test_map.py
Python
mit
1,900
import objc NSObject = objc.lookUpClass('NSObject') from core.mainwindow import MainWindow from core.textholder import TextHolder class PyMainWindow(NSObject): def init(self): self = super(PyMainWindow, self).init() self.model = MainWindow() return self def setNameHolder_andMsgHol...
hsoft/pluginbuilder
examples/simple_pyobjc/pyplugin.py
Python
mit
962
import copy a = [[2, 3, 5], [1, 3, 5]] b = copy.deepcopy(a) b[0][1] = 100 print(a) #https://pt.stackoverflow.com/q/341040/101
bigown/SOpt
Python/Collection/ListReference.py
Python
mit
128
# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2016-09-22 14:22 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_depende...
kaiyujin/buono
buono/migrations/0003_vote_user.py
Python
mit
665
#!/usr/bin/python import sys sys.path.insert(0, '/usr/local/lib/python2.7/site-packages/') import mraa import time from twython import Twython # Authentication - Obtain Authorization URL APP_KEY = 'lXZFwVtC8CGPKs4LOuv2m7WGS' APP_SECRET = 'AoToSyNNyhzg2EhN38Edx6bQ59wPSLH8ztLZNZkWt1us7IzKUl' OAUTH_TOKEN = '2892359329-f...
HelloTechie/tweeting_turkey
turkey_tweet.py
Python
mit
1,243
import sys from os import walk, getcwd from os.path import join, isdir, expanduser, relpath, normpath, basename import os.path from operator import itemgetter import datetime import time import re import json import uuid import boto import boto.ec2 from boto.route53.record import ResourceRecordSets from boto.ec2.elb i...
jschementi/riker
riker/api.py
Python
gpl-2.0
47,641
from twisted.internet.protocol import Protocol, ClientFactory from twisted.internet import reactor, error from twisted.python import log from jq.common import VariablePacketProtocol import pickle import functools class ConsumerClientProtocol(VariablePacketProtocol): def connectionMade(self): data = pickle....
santisiri/popego
envs/ALPHA-POPEGO/lib/python2.5/site-packages/jq-0.1-py2.5.egg/jq/queue/consumerend.py
Python
bsd-3-clause
1,699
import PyQtExtras from PyQt5.QtWidgets import QFrame, QApplication import sys def main(args): app = QApplication([]) main_frame = QFrame() list_view = PyQtExtras.ListScrollArea(main_frame) list_view.add_item_by_string('Item 1') list_view.add_item_by_string('Item 2') list_view.add_item_by_s...
jhavstad/model_runner
src/ScrollListViewTest.py
Python
gpl-2.0
469
# partial unit test for gmpy2 threaded mpz functionality # relies on Tim Peters' "doctest.py" test-driver import gmpy2 as _g, doctest, sys, operator, gc, queue, threading from functools import reduce __test__={} def _tf(N=2, _K=1234**5678): """Takes about 100ms on a first-generation Macbook Pro""" for i in ra...
andreamartire/gmpy
test3/gmpy_test_thr.py
Python
lgpl-3.0
3,614
"""Tests for tools for manipulation of rational expressions. """ from sympy.polys.rationaltools import together from sympy import S, symbols, Rational, sin, exp, Eq, Integral, Mul from sympy.abc import x, y, z A, B = symbols('A,B', commutative=False) def test_together(): assert together(0) == 0 assert toge...
wxgeo/geophar
wxgeometrie/sympy/polys/tests/test_rationaltools.py
Python
gpl-2.0
2,135
# businessid.py - functions for handling Austrian company register numbers # # Copyright (C) 2015 Holvi Payment Services Oy # Copyright (C) 2012, 2013 Arthur de Jong # # 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 t...
t0mk/python-stdnum
stdnum/at/businessid.py
Python
lgpl-2.1
2,268
__author__ = 'ggdhines' from ouroboros_api import MarkingProject from agglomerative import Agglomerative from plankton import PlanktonPortal project = PlanktonPortal() project.__gold_sample__([],["cguigand"])
camallen/aggregation
blog/experts.py
Python
apache-2.0
211
# -*- coding: utf-8 -*- import logging if __name__ == '__main__': logging.basicConfig() _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.binding.datatypes as xsd import pyxb.utils.domutils from xml.dom import Node import os.path schema_path = os.path.abspath(os.path.join(os.path.dirname(...
pabigot/pyxb
tests/drivers/test-ctd-simple.py
Python
apache-2.0
1,997
''' Created on 2013-07-31 @author: Yi Li ''' import sys import numpy as np from pyloh import constants from pyloh.preprocess.data import Data from pyloh.model.model_base import * from pyloh.model.utils import * class PoissonProbabilisticModel(ProbabilisticModel): def __init__(self, allelenumber_max): Pr...
uci-cbcl/PyLOH
pyloh/model/poisson_model.py
Python
gpl-2.0
17,809
# coding=utf-8 # # 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");...
RyanSkraba/beam
sdks/python/apache_beam/examples/snippets/transforms/elementwise/regex_test.py
Python
apache-2.0
4,640
#!/usr/bin/env python from distutils.core import setup setup(name='py-aluminium', description = 'a lite easy practical Python library', version='0.8.0', url='http://py-aluminium.googlecode.com', author='Dai,Nan', author_email='dainan13@gmail.com', license = 'BSD', ...
hackshel/py-aluminium
setup.py
Python
bsd-3-clause
459
from djforms.polisci.model_united_nations import COUNTRIES from djforms.polisci.model_united_nations.models import Country # delete all countries Country.objects.all().delete() # load new country set from tuple of tuples for c in COUNTRIES: obj = Country(name=c[0]) obj.save()
carthagecollege/django-djforms
djforms/bin/countries.py
Python
unlicense
287
import argparse from decimal import Decimal import gzip import os import PDBUtils import pdbparser import sys from time import time # Parse the arguments to get the output directory where the dictionary must be created parser = argparse.ArgumentParser(description='This Python script is a crawler/parser that ' \ ...
gpalex07/phonetic-dictionary
run.py
Python
cc0-1.0
3,601
#-*- coding:utf-8 -*- ############################################################################## # # Copyright (C) 2013 Michael Telahun Makonnen <mmakonnen@gmail.com>. # All Rights Reserved. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero G...
cartertech/odoo-hr-ng
hr_report_manpower/wizard/daily_manpower.py
Python
agpl-3.0
1,629
#!/usr/bin/env python # encoding: utf-8 import logging from raven.contrib.flask import Sentry from framework.sessions import get_session from website import settings logger = logging.getLogger(__name__) sentry = Sentry(dsn=settings.SENTRY_DSN) # Nothing in this module should send to Sentry if debug mode is on # ...
aaxelb/osf.io
framework/sentry/__init__.py
Python
apache-2.0
1,162
# -*- coding: utf-8 -*- # # 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 #...
lxneng/incubator-airflow
airflow/__init__.py
Python
apache-2.0
3,035
# Copyright 2021 Camptocamp SA # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) from . import measuring_device
OCA/stock-logistics-warehouse
stock_measuring_device_zippcube/models/__init__.py
Python
agpl-3.0
131
#!/usr/bin/env python def inc_str(text='AAAA'): try: if not text.isalpha(): raise ValueError OrdA = ord('A') OrdZ = ord('Z') changed = False values = [ord(c) for c in reversed(text.upper())] for i in range(len(values)): if values[i] < OrdZ: ...
opensvn/RGP_PyQt
chap02/inc_str.py
Python
gpl-2.0
987
"""Support for PCA 301 smart switch.""" import logging import pypca from serial import SerialException from homeassistant.components.switch import ATTR_CURRENT_POWER_W, SwitchDevice from homeassistant.const import EVENT_HOMEASSISTANT_STOP _LOGGER = logging.getLogger(__name__) ATTR_TOTAL_ENERGY_KWH = "total_energy_k...
leppa/home-assistant
homeassistant/components/elv/switch.py
Python
apache-2.0
2,682
#!/usr/bin/env python # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai from __future__ import with_statement __license__ = 'GPL v3' __copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>' __docformat__ = 'restructuredtext en' from setup.installer import VMInstaller class OSX(VMInstaller): description = ...
sharad/calibre
setup/installer/osx/__init__.py
Python
gpl-3.0
585
# This work was created by participants in the DataONE project, and is # jointly copyrighted by participating institutions in DataONE. For # more information on DataONE, see our web site at http://dataone.org. # # Copyright 2009-2019 DataONE # # Licensed under the Apache License, Version 2.0 (the "License"); # you ma...
DataONEorg/d1_python
gmn/src/d1_gmn/app/object_format_cache.py
Python
apache-2.0
1,629
# -*- coding: utf-8 -*- # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
googleads/google-ads-python
google/ads/googleads/v9/services/services/customer_user_access_service/client.py
Python
apache-2.0
23,363
def appendAtBeginningFront(x, L): return [x + element for element in L] def bitStrings(n): if n == 0: return [] if n == 1: return ["0", "1"] else: return (appendAtBeginningFront("0", bitStrings(n - 1)) + appendAtBeginningFront("1", bitStrings(n - 1))) print bitStrings(4) def bitStrings2(n): if ...
applecool/Practice
Python/LinkedLists/sequentialbits.py
Python
mit
508
#!/usr/bin/env python # -*- coding: utf-8 -*- # # This file is part of PHYMOBAT 1.2. # Copyright 2016 Sylvio Laventure (IRSTEA - UMR TETIS) # # PHYMOBAT 1.2 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, eit...
SylvioL/PHYMOBAT
Segmentation.py
Python
gpl-3.0
15,675
class ParserError(Exception): """ Raised when a text parser fails to understand a file it been passed or the resulting parsed text is invalid """ pass class ParserUnknownFile(Exception): pass
appsembler/mayan_appsembler
apps/ocr/parsers/exceptions.py
Python
gpl-3.0
218
""" Fan utils. Bruce Wernick 10 June 2021 """ __all__ = ['refrho', 'refspeed', 'refpole', 'pole2sync', 'pole2speed', 'loose_speed2pole', 'get_pole', 'fancode', 'toSPL', 'toSWL', 'SWL_pole', 'approx_SWL'] from math import log10, pi refrho = 1.2 # standard air density # ref motor, 4-pole 50 Hz refs...
bru32/magz
magz/fan_utils.py
Python
mit
2,280