repo_name
stringlengths
5
100
ref
stringlengths
12
67
path
stringlengths
4
244
copies
stringlengths
1
8
content
stringlengths
0
1.05M
showyou/anzu
refs/heads/master
generator/tmpgenerator.py
1
#!/usr/bin/env python # -*- coding: utf-8 -*- import os exec_path = os.path.abspath(os.path.dirname(__file__)).rsplit("/",1)[0] conf_path = exec_path+"/common/config.json" import sys sys.path.insert(0,exec_path) from common import auth_api, model from common import readReplyTable import reply # 解析結果に基づいて文章生成(または行動を起...
gribovskiy/CATS2
refs/heads/master
scripts/settings-interface/settings_interface.py
1
import zmq import threading import time class Request: """Set/get request for CATS2 settings variable.""" def __init__(self, requestType = '', requestData = ''): self.requestType = requestType self.requestData = requestData class CatsSettingsInterface: """Provides the read/write ...
alex/warehouse
refs/heads/master
warehouse/utils/compression.py
3
# 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 # distributed under the Li...
alexkogon/ansible
refs/heads/devel
v1/ansible/module_common.py
83
# (c) 2013-2014, Michael DeHaan <michael.dehaan@gmail.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) an...
ThangBK2009/android-source-browsing.platform--external--gtest
refs/heads/master
test/gtest_env_var_test.py
2408
#!/usr/bin/env python # # Copyright 2008, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
hxford/bcloud
refs/heads/master
bcloud/const.py
10
# Copyright (C) 2014-2015 LiuLang <gsushzhsosgsu@gmail.com> # Use of this source code is governed by GPLv3 license that can be found # in http://www.gnu.org/licenses/gpl-3.0.html ''' 这个模块保存着网络连接时需要共用的一些常量. 与界面相关的常量, 都位于Config.py. ''' from bcloud import Config _ = Config._ BAIDU_URL = 'http://www.baidu.com/' PASSPOR...
Cuuuurzel/KiPyCalc
refs/heads/master
sympy/vector/functions.py
66
from sympy.vector.coordsysrect import CoordSysCartesian from sympy.vector.dyadic import Dyadic from sympy.vector.vector import Vector, BaseVector from sympy.vector.scalar import BaseScalar from sympy import sympify, diff, integrate, S def express(expr, system, system2=None, variables=False): """ Global functi...
diofeher/django-nfa
refs/heads/master
build/lib/django/contrib/localflavor/nl/nl_provinces.py
15
from django.utils.translation import ugettext_lazy as _ PROVINCE_CHOICES = ( ('DR', _('Drente')), ('FL', _('Flevoland')), ('FR', _('Friesland')), ('GL', _('Gelderland')), ('GR', _('Groningen')), ('LB', _('Limburg')), ('NB', _('Noord-Brabant')), ('NH', _('Noord-Holland')), ('OV', _('...
kitanata/resume
refs/heads/master
env/lib/python2.7/site-packages/pip/index.py
343
"""Routines related to PyPI, indexes""" import sys import os import re import mimetypes import posixpath from pip.log import logger from pip.util import Inf, normalize_name, splitext, is_prerelease from pip.exceptions import (DistributionNotFound, BestVersionAlreadyInstalled, InstallationE...
sbbic/core
refs/heads/master
wizards/com/sun/star/wizards/web/data/CGPublish.py
9
# # This file is part of the LibreOffice project. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # # This file incorporates work covered by the following license noti...
inoue0124/TensorFlow_Keras
refs/heads/master
chapter4/leaky_relu_tensorflow.py
1
import numpy as np import tensorflow as tf from sklearn import datasets from sklearn.model_selection import train_test_split from sklearn.utils import shuffle np.random.seed(0) tf.set_random_seed(123) ''' Generate data ''' mnist = datasets.fetch_mldata('MNIST original', data_home='.') n = len(mnist.dat...
SelvorWhim/competitive
refs/heads/master
Codewars/Kebabize.py
1
def capital_to_kebab(c): return "-" + c.lower() if c.isupper() else c if c.isalpha() else "" def kebabize(s): return "".join(capital_to_kebab(c) for c in s).lstrip("-")
Jusedawg/SickRage
refs/heads/develop
lib/sqlalchemy/dialects/mysql/zxjdbc.py
78
# mysql/zxjdbc.py # Copyright (C) 2005-2014 the SQLAlchemy authors and contributors <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """ .. dialect:: mysql+zxjdbc :name: zxjdbc for Jython :dbapi: zxjdbc :co...
laurent-george/bokeh
refs/heads/master
bokeh/util/string.py
43
""" Functions useful for string manipulations or encoding. """ from __future__ import absolute_import def encode_utf8(u): """ Encode a UTF-8 string to a sequence of bytes. Args: u (str) : the string to encode Returns: bytes """ import sys if sys.version_info[0] == 2: ...
apocalypsebg/odoo
refs/heads/8.0
addons/base_report_designer/plugin/openerp_report_designer/bin/script/AddAttachment.py
384
######################################################################### # # Copyright (c) 2003-2004 Danny Brewer d29583@groovegarden.com # Copyright (C) 2004-2010 OpenERP SA (<http://openerp.com>). # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser Gene...
vmax-feihu/hue
refs/heads/master
desktop/core/ext-py/Django-1.6.10/tests/admin_scripts/management/commands/base_command.py
131
from optparse import make_option from django.core.management.base import BaseCommand class Command(BaseCommand): option_list = BaseCommand.option_list + ( make_option('--option_a','-a', action='store', dest='option_a', default='1'), make_option('--option_b','-b', action='store', dest='option_b', ...
PHSCRC/phsled
refs/heads/master
scrollText.py
1
#!/usr/bin/env python import time, sys from Adafruit_LEDBackpack import LEDBackpack from LEDLetterValues import * from timeit import default_timer grids = [LEDBackpack(address=i) for i in range(0x70, 0x74)] wait_time = float(sys.argv[2] if len(sys.argv) > 2 else raw_input("Wait time: ")) text = sys.argv[1] if len(sys...
sunlightlabs/openstates
refs/heads/master
scrapers/hi/events.py
2
from utils import LXMLMixin import datetime as dt from openstates.scrape import Scraper, Event from .utils import get_short_codes from requests import HTTPError import pytz URL = "http://www.capitol.hawaii.gov/upcominghearings.aspx" TIMEZONE = pytz.timezone("Pacific/Honolulu") class HIEventScraper(Scraper, LXMLMix...
servo/servo
refs/heads/master
tests/wpt/web-platform-tests/resource-timing/resources/gzip_xml.py
7
import gzip as gzip_module import os from six import BytesIO from wptserve.utils import isomorphic_decode def main(request, response): dir_path = os.path.dirname(os.path.realpath(isomorphic_decode(__file__))) file_path = os.path.join(dir_path, u'resource_timing_test0.xml') f = open(file_path, u'rb') ...
baylee-d/cos.io
refs/heads/develop
common/blocks/collapsebox.py
1
from wagtail.wagtailcore.blocks import RichTextBlock, CharBlock, ListBlock, \ StructBlock class CollapseEntryBlock(StructBlock): title = CharBlock() content = RichTextBlock() class Meta: form_template = 'common/block_forms/collapse_entry.html' template = 'common/blocks/collapse_entry...
bealdav/OCB
refs/heads/patch-1
addons/mrp/wizard/stock_move.py
78
# -*- 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...
petrus-v/odoo
refs/heads/8.0
addons/sale/report/invoice_report.py
336
# -*- 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...
tos-kamiya/pyrem_torq
refs/heads/master
src/test/test_pyrem_torq_treeseq.py
1
import sys, os import unittest sys.path.append(os.path.join(os.path.dirname(__file__), "..")) from pyrem_torq.treeseq import * class TestTorqTreeseq(unittest.TestCase): def testRemoveStrattrs(self): seq = [ 'a', 1, 'b', 2, 'c' ] self.assertEquals(seq_remove_strattrs(seq), [ 'a', 'b', 'c' ]) ...
noahwilliamsson/micropython
refs/heads/wpa-enterprise
tests/basics/fun2.py
119
# calling a function from a function def f(x): print(x + 1) def g(x): f(2 * x) f(4 * x) g(3)
DARKPOP/external_chromium_org
refs/heads/dark-5.1
chrome/common/extensions/docs/server2/fail_on_access_file_system.py
121
# Copyright 2013 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. from file_system import FileSystem class FailOnAccessFileSystem(FileSystem): # All this needs to do is implement GetIdentity. All other methods will # a...
forbidden-ali/LaZagne
refs/heads/master
Linux/src/softwares/chats/jitsi.py
11
from base64 import b64decode import hashlib, os, re import binascii, array from Crypto.Cipher import AES from config.header import Header from config.constant import * from config.write_output import print_debug, print_output from config.moduleInfo import ModuleInfo # From https://github.com/mitsuhiko/python-pbkdf2 fr...
40223244/cdb-2
refs/heads/master
static/Brython3.1.1-20150328-091302/Lib/logging/handlers.py
736
# Copyright 2001-2013 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and that # both that copyright notice and this permissio...
zhjunlang/kbengine
refs/heads/master
kbe/res/scripts/common/Lib/site-packages/pip/_vendor/requests/packages/chardet/mbcharsetprober.py
2923
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All R...
atsolakid/edx-platform
refs/heads/master
lms/djangoapps/mobile_api/test_milestones.py
30
""" Milestone related tests for the mobile_api """ from mock import patch from courseware.tests.helpers import get_request_for_user from courseware.tests.test_entrance_exam import answer_entrance_exam_problem, add_entrance_exam_milestone from util.milestones_helpers import ( add_prerequisite_course, fulfill_co...
tdegrunt/or-tools
refs/heads/master
examples/python/secret_santa2.py
34
# Copyright 2010 Hakan Kjellerstrand hakank@bonetmail.com # # 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 ...
feigames/Odoo
refs/heads/master
addons/base_gengo/wizard/__init__.py
434
# -*- 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...
mensler/ansible
refs/heads/devel
lib/ansible/modules/cloud/profitbricks/profitbricks_nic.py
69
#!/usr/bin/python # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansible is distributed...
TwinkleChawla/nova
refs/heads/master
nova/db/sqlalchemy/migrate_repo/versions/248_add_expire_reservations_index.py
146
# 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 to in...
da1z/intellij-community
refs/heads/master
python/testData/mover/commentIntoCompound_afterDown.py
83
def f(): #comment if True: a = 1 else: a = 2
invenfantasy/kubernetes
refs/heads/master
examples/cluster-dns/images/frontend/client.py
504
#!/usr/bin/env python # Copyright 2015 The Kubernetes 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 appli...
code-for-india/sahana_shelter_worldbank
refs/heads/hackathon
modules/s3/s3codecs/pdf.py
1
# -*- coding: utf-8 -*- """ S3 Adobe PDF codec @copyright: 2011-13 (c) Sahana Software Foundation @license: MIT 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 ...
anthcp/cdap
refs/heads/develop
cdap-docs/integrations/source/conf.py
1
# -*- coding: utf-8 -*- import sys import os # Import the common config file # Note that paths in the common config are interpreted as if they were # in the location of this file sys.path.insert(0, os.path.abspath('../../_common')) from common_conf import * # Override the common config html_short_title_toc = man...
lanyuwen/openthread
refs/heads/master
tools/harness-automation/cases_R140/leader_9_2_19.py
9
#!/usr/bin/env python # # Copyright (c) 2016, The OpenThread Authors. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright # notic...
mrquim/repository.mrquim
refs/heads/master
repo/script.module.schism.common/lib/js2py/constructors/jsobject.py
29
from js2py.base import * #todo Double check everything is OK @Js def Object(): val = arguments.get('0') if val.is_null() or val.is_undefined(): return PyJsObject(prototype=ObjectPrototype) return val.to_object() @Js def object_constructor(): if len(arguments): val = arguments.get('0'...
Immortalin/python-for-android
refs/heads/master
python3-alpha/python3-src/Doc/includes/mp_webserver.py
48
# # Example where a pool of http servers share a single listening socket # # On Windows this module depends on the ability to pickle a socket # object so that the worker processes can inherit a copy of the server # object. (We import `multiprocessing.reduction` to enable this pickling.) # # Not sure if we should synch...
tndatacommons/tndata_backend
refs/heads/master
tndata_backend/config/settings/base.py
2
""" Django settings file this project. This file contains settings that are usable for both a production and a development environment. You'll need to export the appropriate values as environment variables, however. The following environment variables should be set prior to running the project: * DEBUG -- 1 or 0, def...
duanhjlt/gyp
refs/heads/master
test/mac/gyptest-framework-headers.py
344
#!/usr/bin/env python # Copyright (c) 2012 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Verifies that mac_framework_headers works properly. """ import TestGyp import sys if sys.platform == 'darwin': # TODO(thakis): Make...
opencord/voltha
refs/heads/master
voltha/adapters/tellabs_olt/tellabs_resource_manager.py
1
# Copyright 2018-present Tellabs, 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 agreed to in wri...
sgargan/ansible
refs/heads/devel
v2/test/plugins/__init__.py
7690
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) an...
sstocker46/OctoPrint
refs/heads/master
tests/util/__init__.py
47
# coding=utf-8 """ Unit tests for ``octoprint.util``. """ from __future__ import absolute_import __author__ = "Gina Häußge <osd@foosel.net>" __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the A...
fangeugene/the-blue-alliance
refs/heads/master
datafeeds/usfirst_event_offseason_list_parser.py
1
from datetime import datetime import urlparse import logging from consts.event_type import EventType from datafeeds.parser_base import ParserBase from helpers.event_helper import EventHelper class UsfirstEventOffseasonListParser(ParserBase): @classmethod def parse(self, html): """ Parse the ...
lfsimoes/beam_paco__gtoc5
refs/heads/master
paco/paco.py
1
# # Copyright (c) 2017 Luis F. Simoes (github: @lfsimoes) # # Licensed under the MIT License. See the LICENSE file for details. from collections import deque import numpy as np # ==================================== ## ==================================== # class tsp_path(object): """ Handler for Travelling ...
RLReed/libdetran
refs/heads/master
src/python/pydetranutils/quad_plot.py
2
# This provides utilities for plotting things on a # 1D or 2D mesh or a slice of a 3D mesh. try : import numpy as np except ImportError : print "Error importing Numpy" try : import mpl_toolkits.mplot3d.axes3d as p3 import matplotlib.pyplot as plt except ImportError : print "Error importing matplotlib" glob...
borisz264/mod_seq
refs/heads/master
mod_seq_multi.py
1
import os, sys, subprocess folder, threads = sys.argv[1:] for file_name in os.listdir(folder): full_path = os.path.join(folder, file_name) print full_path command_to_run = 'python mod_seq_main.py %s --threads %s' % (full_path, threads) subprocess.Popen(command_to_run, shell=True).wait()
valurhrafn/chrome-sync-server
refs/heads/master
google/protobuf/python/google/protobuf/service.py
590
# Protocol Buffers - Google's data interchange format # Copyright 2008 Google Inc. All rights reserved. # http://code.google.com/p/protobuf/ # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions o...
wolfskaempf/ga_statistics
refs/heads/master
lib/python2.7/site-packages/django/contrib/contenttypes/management.py
476
from django.apps import apps from django.db import DEFAULT_DB_ALIAS, router from django.utils import six from django.utils.six.moves import input def update_contenttypes(app_config, verbosity=2, interactive=True, using=DEFAULT_DB_ALIAS, **kwargs): """ Creates content types for models in the given app, removin...
ahealy19/F-IDE-2016
refs/heads/master
benchexec/tools/impara.py
3
""" BenchExec is a framework for reliable benchmarking. This file is part of BenchExec. Copyright (C) 2007-2015 Dirk Beyer 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 ...
ryankanno/honolulu-makerfaire-raffle
refs/heads/master
hnlmakerfaire/uwsgi.py
1
import logging from logging.handlers import RotatingFileHandler from app import app if __name__ == '__main__': handler = RotatingFileHandler('/var/log/flask-hnlmakerfaire.log', maxBytes=1024*1024*5, backupCount=30) handler.setLevel(logging.DEBUG) app.logger.addHandler(han...
jobiols/odoomrp-wip
refs/heads/8.0
machine_manager_preventive/models/mrp_repair.py
5
# -*- coding: utf-8 -*- # Copyright 2016 Daniel Campos - Avanzosc S.L. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from openerp import models, fields, api class MrpRepair(models.Model): _inherit = 'mrp.repair' preventive_operations = fields.Many2many( comodel_name='preventive.mac...
pklaus/silhouette
refs/heads/master
src/silhouette.py
1
import time import usb.core import usb.util from warnings import warn from . import gpgl class SilhouetteException(Exception): pass class Silhouette(object): def __init__(self, **kw): self.vendor_id = kw.get('vendor_id', 0x0b4d) self.product_id = kw.get('product_id', None) self.output...
40223211/2015cd_midterm2
refs/heads/master
static/Brython3.1.1-20150328-091302/Lib/errno.py
624
""" This module makes available standard errno system symbols. The value of each symbol is the corresponding integer value, e.g., on most systems, errno.ENOENT equals the integer 2. The dictionary errno.errorcode maps numeric codes to symbol names, e.g., errno.errorcode[2] could be the string 'ENOENT'. Symbols that ar...
doronkatz/firefox-ios
refs/heads/master
scripts/xliff-to-strings.py
5
#!/usr/bin/env python # # xliff-export.py l10n-repository export-directory # # Convert the l10n repository from the following format: # # en/firefox-ios.xliff # fr/firefox-ios.xliff # # To the following format: # # Client/en-US.lproj/Localizable.strings # Client/fr.lproj/Localizable.strings # ShareTo/en-US.lproj/...
stainbank/simulocloud
refs/heads/master
simulocloud/tiles.py
1
""" tiles """ import numpy as np import itertools import simulocloud.pointcloud import simulocloud.exceptions class Tile(simulocloud.pointcloud.PointCloud): """An immmutable pointcloud.""" def __init__(self, xyz, header=None): """See documentation for `simulocloud.pointcloud.Pointcloud`.""" sup...
fmarchenko/i3pystatus
refs/heads/master
docs/module_docs.py
9
import pkgutil import importlib import sphinx.application from docutils.parsers.rst import Directive from docutils.nodes import paragraph from docutils.statemachine import StringList import i3pystatus.core.settings import i3pystatus.core.modules from i3pystatus.core.imputil import ClassFinder from i3pystatus.core.co...
ieguinoa/tools-iuc
refs/heads/master
deprecated/tools/rglasso/rgToolFactory.py
25
# rgToolFactory.py # see https://bitbucket.org/fubar/galaxytoolfactory/wiki/Home # # copyright ross lazarus (ross stop lazarus at gmail stop com) May 2012 # # all rights reserved # Licensed under the LGPL # suggestions for improvement and bug fixes welcome at https://bitbucket.org/fubar/galaxytoolfactory/wiki/Home # # ...
suncycheng/intellij-community
refs/heads/master
python/testData/refactoring/changeSignature/duplicateNamesOfStarredParameters.py
79
def func(*foo, **bar): pass
kk47/C-Cpp
refs/heads/master
deppends/python/requests/packages/charade/codingstatemachine.py
206
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. ...
shybovycha/buck
refs/heads/master
test/com/facebook/buck/cli/bootstrapper/class_loader_test.py
21
import os import shutil import subprocess import sys import tempfile import unittest from project_workspace import ProjectWorkspace class ClassLoaderTest(unittest.TestCase): def test_should_not_pollute_classpath_when_processor_path_is_set(self): """ Tests that annotation processors get their own ...
abhishekgahlot/youtube-dl
refs/heads/master
youtube_dl/extractor/youjizz.py
148
from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( ExtractorError, ) class YouJizzIE(InfoExtractor): _VALID_URL = r'https?://(?:\w+\.)?youjizz\.com/videos/[^/#?]+-(?P<id>[0-9]+)\.html(?:$|[?#])' _TEST = { 'url': 'http://www.youjizz.com/video...