PageRenderTime 262ms queryTime 62ms sortTime 43ms getByIdsTime 38ms findMatchingLines 43ms

100+ results results for 'import glob lang:python' (262 ms)

Not the results you expected?
nn_triple_sequence.py https://gitlab.com/purdueNlp/DRaiL | Python | 302 lines
                    
1import torch
                    
2import numpy as np
                    
2import numpy as np
                    
3from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
                    
4import torch.nn.functional as F
                    
5
                    
6from drail.neuro.nn_model import NeuralNetworks
                    
7
                    
210        '''
                    
211        # Do global avg pooling over timesteps
                    
212        #lstm_output, _ = torch.max(unpacked_output, dim=1)
                    
                
run-tests.py https://bitbucket.org/mdavid/cherokee-webserver-svnclone.git | Python | 489 lines
                    
11
                    
12import os
                    
13import sys
                    
13import sys
                    
14import time
                    
15import copy
                    
15import copy
                    
16import signal
                    
17import shutil
                    
17import shutil
                    
18import thread
                    
19import string
                    
19import string
                    
20import random
                    
21import tempfile
                    
                
web.py https://github.com/Einarin/Observatory.git | Python | 415 lines
                    
20
                    
21from cStringIO import StringIO
                    
22import os
                    
22import os
                    
23import re
                    
24import sys
                    
24import sys
                    
25import time
                    
26
                    
27try:
                    
28    from urlparse import parse_qs
                    
29except ImportError:
                    
29except ImportError:
                    
30    from lib.dulwich._compat import parse_qs
                    
31from lib.dulwich import log_utils
                    
                
rst_from_bmesh_opdefines.py https://bitbucket.org/brita/blender-gl_debug.git | Python | 383 lines
                    
32
                    
33import os
                    
34
                    
69    is_block = False
                    
70    is_comment = False  # /* global comments only */
                    
71
                    
152        vars_dict[v] = (1 << i)
                    
153    globals().update(vars_dict)
                    
154    # reverse lookup
                    
182        text = "\n".join(b)
                    
183        global_namespace = {
                    
184            "__file__": "generated",
                    
187
                    
188        global_namespace.update(vars_dict)
                    
189
                    
                
PhEDExInjectorSubscriber.py https://github.com/PerilousApricot/WMCore.git | Python | 294 lines
                    
25                                   are requested as soon as the unsuscribed dataset appears in the dbsbuffer table
                    
26                                   and there is at least one file in Global DBS and PhEDEx.
                    
27                                   All non-custodial subscriptions are Replica, and requested at the same time as the custodial ones.
                    
38
                    
39import threading
                    
40import logging
                    
41
                    
42from WMCore.WorkerThreads.BaseWorkerThread import BaseWorkerThread
                    
43
                    
43
                    
44from WMCore.Services.PhEDEx import XMLDrop
                    
45from WMCore.Services.PhEDEx.PhEDEx import PhEDEx
                    
45from WMCore.Services.PhEDEx.PhEDEx import PhEDEx
                    
46from WMCore.Services.PhEDEx.DataStructs.SubscriptionList import PhEDExSubscription
                    
47from WMCore.Services.SiteDB.SiteDB import SiteDBJSON
                    
                
httpauth.py https://github.com/Eckankar/HCI-koldskaal.git | Python | 363 lines
                    
64    # Python 2.5+
                    
65    from hashlib import md5
                    
66except ImportError:
                    
66except ImportError:
                    
67    from md5 import new as md5
                    
68
                    
68
                    
69import time
                    
70import base64
                    
70import base64
                    
71import urllib2
                    
72
                    
93
                    
94    global SUPPORTED_ALGORITHM, DIGEST_AUTH_ENCODERS
                    
95    assert algorithm in SUPPORTED_ALGORITHM
                    
                
__init__.py https://gitlab.com/benbelga/muscleHPC | Python | 429 lines
                    
45try:
                    
46    from StringIO import StringIO
                    
47except ImportError:
                    
47except ImportError:
                    
48    from io import StringIO
                    
49
                    
88import SCons.Subst
                    
89import SCons.Tool
                    
90import SCons.Util
                    
353
                    
354GlobalDefaultBuilders = [
                    
355    # Supported builders.
                    
382
                    
383for name in GlobalDefaultEnvironmentFunctions + GlobalDefaultBuilders:
                    
384    exec ("%s = _SConscript.DefaultEnvironmentCall(%s)" % (name, repr(name)))
                    
                
symbols.py https://gitlab.com/Kissaki/Omni-Bot-0.8 | Python | 462 lines
                    
3from compiler import ast
                    
4from compiler.consts import SC_LOCAL, SC_GLOBAL_IMPLICIT, SC_GLOBAL_EXPLICT, \
                    
5    SC_FREE, SC_CELL, SC_UNKNOWN
                    
9
                    
10import sys
                    
11
                    
80        print >> sys.stderr, self.name, self.nested and "nested" or ""
                    
81        print >> sys.stderr, "\tglobals: ", self.globals
                    
82        print >> sys.stderr, "\tcells: ", self.cells
                    
121
                    
122    def force_global(self, name):
                    
123        """Force name to be global in scope.
                    
335
                    
336    def visitImport(self, node, scope):
                    
337        for name, asname in node.names:
                    
                
osx_defaults.py https://gitlab.com/0072016/ansible-modules-extras | Python | 354 lines
                    
34    required: false
                    
35    default: NSGlobalDomain
                    
36  key:
                    
68- osx_defaults: domain=com.apple.Safari key=IncludeInternalDebugMenu type=bool value=true state=present
                    
69- osx_defaults: domain=NSGlobalDomain key=AppleMeasurementUnits type=string value=Centimeters state=present
                    
70- osx_defaults: key=AppleMeasurementUnits type=string value=Centimeters
                    
77
                    
78from datetime import datetime
                    
79
                    
290            domain=dict(
                    
291                default="NSGlobalDomain",
                    
292                required=False,
                    
352
                    
353from ansible.module_utils.basic import *
                    
354main()
                    
                
core.py https://github.com/astropy/astropy.git | Python | 404 lines
                    
2
                    
3import os
                    
4import sys
                    
4import sys
                    
5from collections import OrderedDict
                    
6
                    
6
                    
7import numpy as np
                    
8
                    
8
                    
9from .base import IORegistryError, _UnifiedIORegistryBase
                    
10
                    
39
                    
40        >>> from astropy.io.registry import UnifiedInputRegistry
                    
41        >>> read_reg = UnifiedInputRegistry()
                    
                
Form.py https://bitbucket.org/rbrault/dolfin.git | Python | 438 lines
                    
24
                    
25import unittest
                    
26import numpy
                    
26import numpy
                    
27import ufl
                    
28from dolfin import *
                    
200
                    
201        # Define global normal and create orientation map
                    
202        global_normal = Expression(("0.0", "1.0", "0.0"))
                    
202        global_normal = Expression(("0.0", "1.0", "0.0"))
                    
203        self.square3d.init_cell_orientations(global_normal)
                    
204
                    
                
symbols.py https://gitlab.com/pmuontains/Odoo | Python | 462 lines
                    
3from compiler import ast
                    
4from compiler.consts import SC_LOCAL, SC_GLOBAL_IMPLICIT, SC_GLOBAL_EXPLICIT, \
                    
5    SC_FREE, SC_CELL, SC_UNKNOWN
                    
9
                    
10import sys
                    
11
                    
80        print >> sys.stderr, self.name, self.nested and "nested" or ""
                    
81        print >> sys.stderr, "\tglobals: ", self.globals
                    
82        print >> sys.stderr, "\tcells: ", self.cells
                    
121
                    
122    def force_global(self, name):
                    
123        """Force name to be global in scope.
                    
335
                    
336    def visitImport(self, node, scope):
                    
337        for name, asname in node.names:
                    
                
__init__.py https://bitbucket.org/zielmicha/freeciv-android.git | Python | 295 lines
                    
12
                    
13import select
                    
14import time
                    
14import time
                    
15import graphics
                    
16
                    
16
                    
17import freeciv.client
                    
18
                    
18
                    
19from freeciv import progress
                    
20from freeciv import monitor
                    
20from freeciv import monitor
                    
21from freeciv import features
                    
22
                    
                
runtime.py https://github.com/araisrobo/linuxcnc.git | Python | 442 lines
                    
19
                    
20import sys, re
                    
21
                    
98		if not filename:
                    
99			global in_name
                    
100			filename="<f.%d>" % in_name
                    
                
fairseq_simul_st_agent.py https://gitlab.com/lwd17/enhanced_examplar_ae | Python | 363 lines
                    
14    from simuleval.states import ListEntry, SpeechStates
                    
15except ImportError:
                    
16    print("Please install simuleval 'pip install simuleval'")
                    
40        self.previous_residual_samples = []
                    
41        self.global_cmvn = args.global_cmvn
                    
42
                    
82    def transform(self, input):
                    
83        if self.global_cmvn is None:
                    
84            return input
                    
144            if "global_cmvn" in config:
                    
145                args.global_cmvn = np.load(config["global_cmvn"]["stats_npz_path"])
                    
146
                    
149                global_cmvn = json.loads(f.read())
                    
150                self.global_cmvn = {"mean": global_cmvn["mean"], "std": global_cmvn["stddev"]}
                    
151
                    
                
accumulators.py https://gitlab.com/nexemjail/mir | Python | 269 lines
                    
18"""
                    
19>>> from pyspark.context import SparkContext
                    
20>>> sc = SparkContext('local', 'test')
                    
38>>> def f(x):
                    
39...     global a
                    
40...     a += x
                    
51
                    
52>>> from pyspark.accumulators import AccumulatorParam
                    
53>>> class VectorAccumulatorParam(AccumulatorParam):
                    
63>>> def g(x):
                    
64...     global va
                    
65...     va += [x] * 3
                    
75>>> def h(x):
                    
76...     global a
                    
77...     a.value = 7
                    
                
inferences.py https://gitlab.com/yogeshc/edward | Python | 357 lines
                    
2import numpy as np
                    
3import tensorflow as tf
                    
4
                    
4
                    
5from edward.data import Data
                    
6from edward.util import kl_multivariate_normal, log_sum_exp
                    
6from edward.util import kl_multivariate_normal, log_sum_exp
                    
7from edward.variationals import PointMass
                    
8
                    
9try:
                    
10    import prettytensor as pt
                    
11except ImportError:
                    
98        self.train = tf.train.AdamOptimizer(learning_rate).minimize(
                    
99            loss, global_step=global_step)
                    
100
                    
                
introspect.py https://github.com/astory/RankPanda.git | Python | 380 lines
                    
7
                    
8import cStringIO
                    
9import inspect
                    
9import inspect
                    
10import sys
                    
11import tokenize
                    
11import tokenize
                    
12import types
                    
13import wx
                    
43                         'func_closure', 'func_code', 'func_defaults',
                    
44                         'func_dict', 'func_doc', 'func_globals', 'func_name']
                    
45        attributes += [attr for attr in special_attrs \
                    
                
config.py https://github.com/kazcw/miro.git | Python | 240 lines
                    
32
                    
33import functools
                    
34import logging
                    
34import logging
                    
35from threading import RLock
                    
36
                    
36
                    
37from miro.appconfig import AppConfig
                    
38from miro import app
                    
38from miro import app
                    
39from miro import prefs
                    
40from miro import signals
                    
40from miro import signals
                    
41from miro.plat import config as platformcfg
                    
42
                    
                
twilltestserver.py https://github.com/SMFOSS/twill.git | Python | 557 lines
                    
4"""
                    
5import sys
                    
6import os
                    
7
                    
8import pkg_resources
                    
9pkg_resources.require('Quixote>=2.4')
                    
10
                    
11from quixote.publish import Publisher
                    
12from quixote.errors import AccessError
                    
12from quixote.errors import AccessError
                    
13from quixote.session import Session, SessionManager
                    
14from quixote.directory import Directory, AccessControlled
                    
14from quixote.directory import Directory, AccessControlled
                    
15from quixote import get_user, get_session, get_session_manager, get_path, \
                    
16     redirect, get_request, get_response
                    
                
Makefile.py https://github.com/daevid/MWFork.git | Python | 389 lines
                    
3# @author Philip
                    
4import tarfile as tf
                    
5import zipfile as zf
                    
5import zipfile as zf
                    
6import os, re, shutil, sys, platform
                    
7
                    
11if pyversion[:3] in ['2.6', '2.7']:
                    
12    import urllib as urllib_request
                    
13    import codecs
                    
22elif pyversion[:2] == '3.':
                    
23    import urllib.request as urllib_request
                    
24    unichr = chr
                    
42        return
                    
43    global islinux
                    
44    if islinux:
                    
                
sandbox.py https://bitbucket.org/ksetyadi/helloworld.git | Python | 361 lines
                    
14"""
                    
15import operator
                    
16from jinja2.environment import Environment
                    
16from jinja2.environment import Environment
                    
17from jinja2.exceptions import SecurityError
                    
18from jinja2.utils import FunctionType, MethodType, TracebackType, CodeType, \
                    
26UNSAFE_FUNCTION_ATTRIBUTES = set(['func_closure', 'func_code', 'func_dict',
                    
27                                  'func_defaults', 'func_globals'])
                    
28
                    
32
                    
33import warnings
                    
34
                    
38
                    
39from collections import deque
                    
40
                    
                
test_peepholer.py https://github.com/albertz/CPython.git | Python | 336 lines
                    
1import dis
                    
2import unittest
                    
3
                    
4from test.bytecode_helper import BytecodeTestCase
                    
5
                    
26
                    
27    def test_global_as_constant(self):
                    
28        # LOAD_GLOBAL None/True/False  -->  LOAD_CONST None/True/False
                    
40        for func, elem in ((f, None), (g, True), (h, False)):
                    
41            self.assertNotInBytecode(func, 'LOAD_GLOBAL')
                    
42            self.assertInBytecode(func, 'LOAD_CONST', elem)
                    
47
                    
48        self.assertNotInBytecode(f, 'LOAD_GLOBAL')
                    
49        self.assertInBytecode(f, 'LOAD_CONST', None)
                    
                
test_netcdf.py https://gitlab.com/pooja043/Globus_Docker_3 | Python | 339 lines
                    
1''' Tests for netcdf '''
                    
2from __future__ import division, print_function, absolute_import
                    
3
                    
3
                    
4import os
                    
5from os.path import join as pjoin, dirname
                    
5from os.path import join as pjoin, dirname
                    
6import shutil
                    
7import tempfile
                    
7import tempfile
                    
8import warnings
                    
9from io import BytesIO
                    
9from io import BytesIO
                    
10from glob import glob
                    
11from contextlib import contextmanager
                    
                
bdist_wheel.py https://github.com/dpritsos/WEGA.git | Python | 365 lines
                    
14from distutils import log as logger
                    
15from glob import iglob
                    
16from shutil import rmtree
                    
16from shutil import rmtree
                    
17from warnings import warn
                    
18
                    
20
                    
21from .pep425tags import get_abbr_impl, get_impl_ver, get_abi_tag, get_platform
                    
22from .pkginfo import write_pkg_info
                    
325            # accordingly.
                    
326            import glob
                    
327            pat = os.path.join(os.path.dirname(egginfo_path), '*.egg-info')
                    
327            pat = os.path.join(os.path.dirname(egginfo_path), '*.egg-info')
                    
328            possible = glob.glob(pat)
                    
329            err = "Egg metadata expected at %s but not found" % (egginfo_path,)
                    
                
hadoop.py https://bitbucket.org/wangqiang8511/mrjob.git | Python | 231 lines
                    
13# limitations under the License.
                    
14import logging
                    
15import posixpath
                    
15import posixpath
                    
16import re
                    
17from subprocess import Popen
                    
17from subprocess import Popen
                    
18from subprocess import PIPE
                    
19from subprocess import CalledProcessError
                    
21try:
                    
22    from cStringIO import StringIO
                    
23    StringIO  # quiet "redefinition of unused ..." warning from pyflakes
                    
23    StringIO  # quiet "redefinition of unused ..." warning from pyflakes
                    
24except ImportError:
                    
25    from StringIO import StringIO
                    
                
request.py https://gitlab.com/goolic/pyramid | Python | 332 lines
                    
1from collections import deque
                    
2import json
                    
3
                    
4from zope.interface import implementer
                    
5from zope.interface.interface import InterfaceClass
                    
6
                    
7from webob import BaseRequest
                    
8
                    
8
                    
9from pyramid.interfaces import (
                    
10    IRequest,
                    
15
                    
16from pyramid.compat import (
                    
17    text_,
                    
22
                    
23from pyramid.decorator import reify
                    
24from pyramid.i18n import LocalizerRequestMixin
                    
                
displayhook.py https://github.com/tinyclues/ipython.git | Python | 329 lines
                    
21#-----------------------------------------------------------------------------
                    
22# Imports
                    
23#-----------------------------------------------------------------------------
                    
24
                    
25import __builtin__
                    
26
                    
26
                    
27from IPython.config.configurable import Configurable
                    
28from IPython.core import prompts
                    
28from IPython.core import prompts
                    
29from IPython.utils import io
                    
30from IPython.utils.traitlets import Instance, List
                    
30from IPython.utils.traitlets import Instance, List
                    
31from IPython.utils.warn import warn
                    
32
                    
                
func_inspect.py https://gitlab.com/github-cloud-corporation/scikit-learn | Python | 355 lines
                    
8
                    
9from itertools import islice
                    
10import inspect
                    
11import warnings
                    
12import re
                    
13import os
                    
15from ._compat import _basestring
                    
16from .logger import pformat
                    
17from ._memory_helpers import open_py_source
                    
17from ._memory_helpers import open_py_source
                    
18from ._compat import PY3_OR_LATER
                    
19
                    
145        # TODO: Maybe add a warning here?
                    
146        if hasattr(func, 'func_globals') and name in func.func_globals:
                    
147            if not func.func_globals[name] is func:
                    
                
sublime_plugin.py https://gitlab.com/MarcuSacramento/ferramentas | Python | 371 lines
                    
1import os
                    
2import sys
                    
2import sys
                    
3import time
                    
4import sublime
                    
4import sublime
                    
5import imp
                    
6
                    
43    if was_loaded:
                    
44        m = __import__(modulename)
                    
45        unload_module(m)
                    
124def show_timeout(plugin_name, elapsed, callback):
                    
125    global first_time_msgs
                    
126    global msgs
                    
145def on_blocking_api_call():
                    
146    global blocking_api_call_count
                    
147    blocking_api_call_count += 1
                    
                
unix.py https://github.com/jcrobak/hue.git | Python | 396 lines
                    
5
                    
6from twisted.conch.error import ConchError
                    
7from twisted.conch.ssh import channel, connection
                    
7from twisted.conch.ssh import channel, connection
                    
8from twisted.internet import defer, protocol, reactor
                    
9from twisted.python import log
                    
9from twisted.python import log
                    
10from twisted.spread import banana
                    
11
                    
11
                    
12import os, stat, pickle
                    
13import types # this is for evil
                    
173
                    
174    def sendGlobalRequest(self, request, data, wantReply = 0):
                    
175        self.sendMessage('sendGlobalRequest', request, data, wantReply)
                    
                
test_xpickle.py https://github.com/seanjensengrey/CPython.git | Python | 260 lines
                    
7
                    
8import cPickle
                    
9import os
                    
9import os
                    
10import os.path
                    
11import pickle
                    
11import pickle
                    
12import subprocess
                    
13import sys
                    
13import sys
                    
14import types
                    
15import unittest
                    
16
                    
17from test import test_support
                    
18
                    
                
manager_worker_broker_unittest.py https://gitlab.com/brian0218/rk3188_r-box_android4.2.2_sdk | Python | 289 lines
                    
28
                    
29import optparse
                    
30import Queue
                    
30import Queue
                    
31import sys
                    
32import unittest
                    
34try:
                    
35    import multiprocessing
                    
36except ImportError:
                    
39
                    
40from webkitpy.common.system import outputcapture
                    
41
                    
41
                    
42from webkitpy.layout_tests import port
                    
43from webkitpy.layout_tests.layout_package import manager_worker_broker
                    
                
toolbox.py https://bitbucket.org/ensta/m3meka.git | Python | 286 lines
                    
28#import Numeric
                    
29import glob
                    
30import datetime
                    
218        path=get_m3_animation_path()[-1]
                    
219        return glob.glob(path+'*.txt')
                    
220
                    
222        path=get_m3_animation_path()[-1]
                    
223        full=glob.glob(path+'*.txt')
                    
224        names=[]
                    
277        path=get_m3_animation_path()[-1]
                    
278        return [glob.glob(p+'*.via')[0] for p in path]
                    
279
                    
281        path=get_m3_animation_path()[-1]
                    
282        full=[glob.glob(p+'*.via')[0] for p in path]
                    
283        names=[]
                    
                
commits-to-changelog.py https://github.com/iainlane/mono.git | Python | 286 lines
                    
2
                    
3from optparse import OptionParser
                    
4import subprocess
                    
4import subprocess
                    
5import re
                    
6import os.path
                    
6import os.path
                    
7import fnmatch
                    
8import os
                    
8import os
                    
9import sys
                    
10
                    
26def changelog_path (changelog):
                    
27    global path_to_root
                    
28    if not path_to_root:
                    
                
bionic_utils.py https://gitlab.com/brian0218/rk3066_r-box_android4.2.2_sdk | Python | 378 lines
                    
2
                    
3import sys, os, commands, string
                    
4
                    
15def D(msg):
                    
16    global verbose
                    
17    if verbose > 0:
                    
20def D2(msg):
                    
21    global verbose
                    
22    if verbose >= 2:
                    
25def D3(msg):
                    
26    global verbose
                    
27    if verbose >= 3:
                    
30def D4(msg):
                    
31    global verbose
                    
32    if verbose >= 4:
                    
                
_base.py https://bitbucket.org/WscriChy/vim-configuration.git | Python | 386 lines
                    
5
                    
6from UltiSnips import _vim
                    
7from UltiSnips.position import Position
                    
42# These classes use their subclasses a lot and we really do not want to expose
                    
43# their functions more globally.
                    
44# pylint: disable=protected-access
                    
                
depends.py https://gitlab.com/areema/myproject | Python | 217 lines
                    
1import sys
                    
2import imp
                    
2import imp
                    
3import marshal
                    
4from imp import PKG_DIRECTORY, PY_COMPILED, PY_SOURCE, PY_FROZEN
                    
4from imp import PKG_DIRECTORY, PY_COMPILED, PY_SOURCE, PY_FROZEN
                    
5from distutils.version import StrictVersion
                    
6
                    
6
                    
7from setuptools.extern import six
                    
8
                    
47        attribute was specified, or the value cannot be determined without
                    
48        importing the module.  The version is formatted according to the
                    
49        requirement's version format (if any), unless it is 'None' or the
                    
57                return default
                    
58            except ImportError:
                    
59                return None
                    
                
mobwrite_appengine.py https://github.com/masyl/wrook.git | Python | 417 lines
                    
27
                    
28import logging
                    
29import cgi
                    
29import cgi
                    
30import urllib
                    
31import datetime
                    
31import datetime
                    
32import re
                    
33import diff_match_patch as dmp_module
                    
33import diff_match_patch as dmp_module
                    
34from google.appengine.ext import db
                    
35from google.appengine import runtime
                    
40
                    
41# Global Diff/Match/Patch object.
                    
42dmp = dmp_module.diff_match_patch()
                    
                
access.py https://bitbucket.org/chaffra/ffc.git | Python | 314 lines
                    
20
                    
21from ufl.corealg.multifunction import MultiFunction
                    
22from ufl.permutation import build_component_numbering
                    
23
                    
24from ffc.log import error, warning
                    
25
                    
25
                    
26from ffc.uflacs.backends.ffc.symbols import FFCBackendSymbols
                    
27from ffc.uflacs.backends.ffc.common import physical_quadrature_integral_types
                    
54        # We shouldn't have derivatives of constants left at this point
                    
55        assert not (mt.global_derivatives or mt.local_derivatives)
                    
56        # NB! UFL doesn't retain float/int type information for zeros...
                    
62        # We shouldn't have derivatives of constants left at this point
                    
63        assert not (mt.global_derivatives or mt.local_derivatives)
                    
64        L = self.language
                    
                
updatelang.py https://gitlab.com/gumiko/evol-tools | Python | 391 lines
                    
6
                    
7import os
                    
8import re
                    
42def collectScriptFileStrings(codeFile, file2):
                    
43    global itemNamesByName
                    
44    with open(file2, "r") as f:
                    
320def loadItemDb(dir):
                    
321    global itemNamesByName
                    
322    with open(dir + "/item_db.conf", "r") as f:
                    
                
test_pkcs1_15.py https://gitlab.com/abhi1tb/build | Python | 358 lines
                    
35from Crypto.Util.py3compat import bchr
                    
36from Crypto.Util.number import bytes_to_long
                    
37from Crypto.Util.strxor import strxor
                    
37from Crypto.Util.strxor import strxor
                    
38from Crypto.SelfTest.st_common import list_test_cases
                    
39from Crypto.SelfTest.loader import load_tests
                    
43from Crypto.PublicKey import RSA
                    
44from Crypto.Signature import pkcs1_15
                    
45from Crypto.Signature import PKCS1_v1_5
                    
51def load_hash_by_name(hash_name):
                    
52    return __import__("Crypto.Hash." + hash_name, globals(), locals(), ["new"])
                    
53
                    
315        if tv.warning and self._wycheproof_warnings:
                    
316            import warnings
                    
317            warnings.warn("Wycheproof warning: %s (%s)" % (self._id, tv.comment))
                    
                
util.py https://bitbucket.org/zzzeek/sqlalchemy.git | Python | 299 lines
                    
1from typing import Any
                    
2from typing import Iterable
                    
2from typing import Iterable
                    
3from typing import Iterator
                    
4from typing import List
                    
4from typing import List
                    
5from typing import Optional
                    
6from typing import overload
                    
6from typing import overload
                    
7from typing import Tuple
                    
8from typing import Type as TypingType
                    
8from typing import Type as TypingType
                    
9from typing import TypeVar
                    
10from typing import Union
                    
11
                    
12from mypy.nodes import ARG_POS
                    
13from mypy.nodes import CallExpr
                    
                
channel.py https://github.com/a4/a4.git | Python | 236 lines
                    
24
                    
25# Imports
                    
26import threading, random, time
                    
26import threading, random, time
                    
27from channelend import ChannelRetireException
                    
28from pycsp.common.const import *
                    
134        # We can avoid protecting the queue operations with this lock
                    
135        # , because of the Global Interpreter Lock preventing us from
                    
136        # updating Python lists simultaneously from multiple threads.
                    
234if __name__ == '__main__':
                    
235    import doctest
                    
236    doctest.testmod()
                    
                
common.py https://github.com/flannery/indico-flannery.git | Python | 351 lines
                    
20
                    
21from persistent import Persistent
                    
22from MaKaC.plugins.Collaboration.base import CollaborationException, CSErrorBase
                    
22from MaKaC.plugins.Collaboration.base import CollaborationException, CSErrorBase
                    
23from MaKaC.plugins.base import PluginsHolder
                    
24from random import Random
                    
24from random import Random
                    
25from MaKaC.common.PickleJar import Retrieves
                    
26from MaKaC.plugins.Collaboration.collaborationTools import CollaborationTools
                    
26from MaKaC.plugins.Collaboration.collaborationTools import CollaborationTools
                    
27from datetime import timedelta
                    
28import socket
                    
28import socket
                    
29import errno
                    
30from MaKaC.common.fossilize import fossilizes, Fossilizable
                    
                
tweens.py https://github.com/archanmishra/pyramid.git | Python | 267 lines
                    
1from zope.interface import implements
                    
2
                    
2
                    
3from pyramid.interfaces import ITweens
                    
4
                    
4
                    
5from pyramid.exceptions import ConfigurationError
                    
6from pyramid.tweens import excview_tween_factory
                    
6from pyramid.tweens import excview_tween_factory
                    
7from pyramid.tweens import MAIN, INGRESS, EXCVIEW
                    
8
                    
8
                    
9from pyramid.config.util import action_method
                    
10
                    
101                'The "tween_factory" argument to add_tween must be a '
                    
102                'dotted name to a globally importable object, not %r' %
                    
103                tween_factory)
                    
                
basic_session_run_hooks.py https://gitlab.com/github-cloud-corporation/tensorflow | Python | 385 lines
                    
19
                    
20from __future__ import absolute_import
                    
21from __future__ import division
                    
110  def begin(self):
                    
111    self._global_step_tensor = contrib_variables.get_global_step()
                    
112    if self._global_step_tensor is None:
                    
166    self._last_saved_step = None
                    
167    self._global_step_tensor = contrib_variables.get_global_step()
                    
168    if self._global_step_tensor is None:
                    
221    self._last_reported_step = None
                    
222    self._global_step_tensor = contrib_variables.get_global_step()
                    
223    if self._global_step_tensor is None:
                    
323    self._request_summary = True
                    
324    self._global_step_tensor = contrib_variables.get_global_step()
                    
325    if self._global_step_tensor is None:
                    
                
histcache.py https://bitbucket.org/beqa/nvdadependencyvirtualenvironment.git | Python | 262 lines
                    
23#-----------------------------------------------------------------------------#
                    
24# Imports
                    
25
                    
26#-----------------------------------------------------------------------------#
                    
27# Globals
                    
28HIST_CACHE_UNLIMITED = -1
                    
                
buildoptions.py https://gitlab.com/actawithamana/poky | Python | 200 lines
                    
1import os
                    
2import re
                    
2import re
                    
3import glob as g
                    
4import shutil
                    
4import shutil
                    
5import tempfile
                    
6from oeqa.selftest.base import oeSelfTest
                    
6from oeqa.selftest.base import oeSelfTest
                    
7from oeqa.selftest.buildhistory import BuildhistoryBase
                    
8from oeqa.utils.commands import runCmd, bitbake, get_bb_var
                    
8from oeqa.utils.commands import runCmd, bitbake, get_bb_var
                    
9import oeqa.utils.ftools as ftools
                    
10from oeqa.utils.decorators import testcase
                    
199        tar_file_glob = str(pkgs_path[0]) + "/xcursor*.tar.gz"
                    
200        self.assertTrue((g.glob(src_file_glob) and g.glob(tar_file_glob)), "Couldn't find .src.rpm and .tar.gz files under tmp/deploy/sources/allarch*/xcursor*")
                    
201
                    
                
TwistedModel.py https://gitlab.com/manoj-makkuboy/magnetism | Python | 325 lines
                    
1import os
                    
2import re
                    
3
                    
4from twisted.words.protocols.jabber import client, jid, xmlstream
                    
5from twisted.words.protocols.jabber.client import IQ
                    
5from twisted.words.protocols.jabber.client import IQ
                    
6from twisted.words.xish import domish
                    
7from twisted.internet import reactor
                    
8
                    
9from mugshot.AbstractModel import *
                    
10from mugshot.Resource import *
                    
10from mugshot.Resource import *
                    
11from mugshot.NotificationSet import *
                    
12from mugshot.Query import *
                    
68        
                    
69        global reactor
                    
70        self.__factory.addBootstrap(xmlstream.STREAM_AUTHD_EVENT, self.__on_auth_succeeded)
                    
                
traceback.py https://gitlab.com/envieidoc/Clover | Python | 319 lines
                    
2
                    
3import linecache
                    
4import sys
                    
4import sys
                    
5import types
                    
6
                    
68        linecache.checkcache(filename)
                    
69        line = linecache.getline(filename, lineno, f.f_globals)
                    
70        if line: _print(file, '    ' + line.strip())
                    
100        linecache.checkcache(filename)
                    
101        line = linecache.getline(filename, lineno, f.f_globals)
                    
102        if line: line = line.strip()
                    
304        linecache.checkcache(filename)
                    
305        line = linecache.getline(filename, lineno, f.f_globals)
                    
306        if line: line = line.strip()
                    
                
multi_transfer_operation.py https://gitlab.com/mikelampert924/ubiquity-python-client | Python | 280 lines
                    
11
                    
12import re  # noqa: F401
                    
13import sys  # noqa: F401
                    
14
                    
15from ubiquity.ubiquity_openapi_client.model_utils import (  # noqa: F401
                    
16    ApiTypeError,
                    
28)
                    
29from ..model_utils import OpenApiModel
                    
30from ubiquity.ubiquity_openapi_client.exceptions import ApiAttributeError
                    
32
                    
33def lazy_import():
                    
34    from ubiquity.ubiquity_openapi_client.model.multi_transfer import MultiTransfer
                    
34    from ubiquity.ubiquity_openapi_client.model.multi_transfer import MultiTransfer
                    
35    globals()['MultiTransfer'] = MultiTransfer
                    
36
                    
                
simconfclser.py https://gitlab.com/betse/betse | Python | 259 lines
                    
14
                    
15# ....................{ IMPORTS                           }....................
                    
16from abc import ABCMeta
                    
16from abc import ABCMeta
                    
17from betse.util.type.decorator.deccls import abstractproperty
                    
18from betse.util.type.types import type_check
                    
18from betse.util.type.types import type_check
                    
19from py._path.local import LocalPath
                    
20
                    
62
                    
63        # Defer heavyweight imports.
                    
64        from betse.util.path import pathnames
                    
81        directory with predictably disastrous outcomes.) While this class could
                    
82        instead globally search-and-replace all relative simulation
                    
83        configuration paths with absolute paths, doing so would be considerably
                    
                
test_support.py https://bitbucket.org/x893/sirflive.git | Python | 341 lines
                    
3if __name__ != 'test.test_support':
                    
4    raise ImportError, 'test_support must be imported from the test package'
                    
5
                    
5
                    
6import sys
                    
7
                    
39def record_original_stdout(stdout):
                    
40    global _original_stdout
                    
41    _original_stdout = stdout
                    
52def forget(modname):
                    
53    '''"Forget" a module was ever imported by removing it from sys.modules and
                    
54    deleting any .pyc and .pyo files.'''
                    
55    unload(modname)
                    
56    import os
                    
57    for dirname in sys.path:
                    
                
version_manager.py https://github.com/openstack/neutron.git | Python | 260 lines
                    
17
                    
18from neutron_lib.plugins import directory
                    
19from oslo_log import log as logging
                    
19from oslo_log import log as logging
                    
20from oslo_utils import importutils
                    
21
                    
28
                    
29# NOTE(mangelajo): if we import this globally we end up with a (very
                    
30#                  long) circular dependency, this can be fixed if we
                    
34def _import_resources():
                    
35    return importutils.import_module('neutron.api.rpc.callbacks.resources')
                    
36
                    
38def _import_agents_db():
                    
39    return importutils.import_module('neutron.db.agents_db')
                    
40
                    
                
types.py https://github.com/albertz/CPython.git | Python | 295 lines
                    
3"""
                    
4import sys
                    
5
                    
55GetSetDescriptorType = type(FunctionType.__code__)
                    
56MemberDescriptorType = type(FunctionType.__globals__)
                    
57
                    
271
                    
272    # Delay functools and _collections_abc import for speeding up types import.
                    
273    import functools
                    
273    import functools
                    
274    import _collections_abc
                    
275    @functools.wraps(func)
                    
294
                    
295__all__ = [n for n in globals() if n[:1] != '_']
                    
296
                    
                
ercaSDLIntShowHide.py https://github.com/boq/moul-scripts.git | Python | 145 lines
                    
51
                    
52from Plasma import *
                    
53from PlasmaTypes import *
                    
53from PlasmaTypes import *
                    
54import string
                    
55
                    
69    def OnFirstUpdate(self):
                    
70        global AgeStartedIn
                    
71        AgeStartedIn = PtGetAgeName()
                    
                
replace_dimensions.py https://bitbucket.org/iimarckus/pokered-greenified.git | Python | 245 lines
                    
3#replace dimensions with constants
                    
4import sys #for non-newline-terminated output :/
                    
5from add_map_labels_to_map_headers import find_with_start_of_line
                    
5from add_map_labels_to_map_headers import find_with_start_of_line
                    
6from pretty_map_headers import map_name_cleaner, spacing, offset_to_pointer, map_constants
                    
7from connection_helper import print_connections
                    
7from connection_helper import print_connections
                    
8from ctypes import c_int8
                    
9
                    
39def load_asm():
                    
40    global asm, asm_lines
                    
41    asm = open("../main.asm", "r").read()
                    
73def find_line_starting_with(value):
                    
74    global asm_lines
                    
75    id = 0
                    
                
apply_function_pullbacks.py https://bitbucket.org/chaffra/ufl.git | Python | 266 lines
                    
23
                    
24from six.moves import xrange as range
                    
25
                    
25
                    
26from ufl.log import error
                    
27
                    
27
                    
28from ufl.core.multiindex import indices
                    
29from ufl.corealg.multifunction import MultiFunction, memoized_handler
                    
29from ufl.corealg.multifunction import MultiFunction, memoized_handler
                    
30from ufl.algorithms.map_integrands import map_integrand_dags
                    
31
                    
31
                    
32from ufl.classes import (ReferenceValue,
                    
33                         Jacobian, JacobianInverse, JacobianDeterminant,
                    
                
localedata.py https://gitlab.com/abhi1tb/build | Python | 238 lines
                    
14
                    
15import os
                    
16import threading
                    
16import threading
                    
17from itertools import chain
                    
18
                    
18
                    
19from babel._compat import pickle, string_types, abc
                    
20
                    
112            else:
                    
113                from babel.core import get_global
                    
114                parent = get_global('parent_exceptions').get(name)
                    
                
generate-js-builtins.py https://gitlab.com/paretje/qtwebkit | Python | 161 lines
                    
29
                    
30import fnmatch
                    
31import logging
                    
31import logging
                    
32import optparse
                    
33import os
                    
35logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.ERROR)
                    
36log = logging.getLogger('global')
                    
37
                    
37
                    
38from lazywriter import LazyFileWriter
                    
39
                    
39
                    
40import builtins
                    
41from builtins import *
                    
                
__init__.py https://bitbucket.org/synic/exaile.git | Python | 311 lines
                    
26
                    
27import gtk
                    
28import gobject
                    
29
                    
30import os
                    
31import os.path
                    
31import os.path
                    
32import datetime
                    
33 
                    
33 
                    
34from xl import (
                    
35    event, 
                    
41
                    
42from xl.playlist import Playlist
                    
43from xl.nls import gettext as _
                    
                
tabnanny.py https://bitbucket.org/x893/sirflive.git | Python | 325 lines
                    
7For the time being this module is intended to be called as a script.
                    
8However it is possible to import it into an IDE and use the function
                    
9check() described below.
                    
22
                    
23import os
                    
24import sys
                    
24import sys
                    
25import getopt
                    
26import tokenize
                    
42def main():
                    
43    global verbose, filename_only
                    
44    try:
                    
295        elif type == DEDENT:
                    
296            # there's nothing we need to check here!  what's important is
                    
297            # that when the run of DEDENTs ends, the indentation of the
                    
                
test_dummy_thread.py https://bitbucket.org/x893/sirflive.git | Python | 181 lines
                    
7"""
                    
8import dummy_thread as _thread
                    
9import time
                    
9import time
                    
10import Queue
                    
11import random
                    
11import random
                    
12import unittest
                    
13from test import test_support
                    
169
                    
170def test_main(imported_module=None):
                    
171    global _thread, DELAY
                    
171    global _thread, DELAY
                    
172    if imported_module:
                    
173        _thread = imported_module
                    
                
test_forms.py https://github.com/praekelt/vumi-go.git | Python | 226 lines
                    
1from decimal import Decimal, Context
                    
2
                    
2
                    
3from go.vumitools.tests.helpers import djangotest_imports
                    
4
                    
4
                    
5with djangotest_imports(globals()):
                    
6    from django.forms.models import modelformset_factory
                    
7
                    
8    from go.base.tests.helpers import GoDjangoTestCase, DjangoVumiApiHelper
                    
9    from go.billing import settings as app_settings
                    
9    from go.billing import settings as app_settings
                    
10    from go.billing.forms import (
                    
11        MessageCostForm, cost_rounded_to_zero, BaseCreditLoadFormSet,
                    
12        CreditLoadForm, TagPoolForm)
                    
13    from go.billing.models import TagPool, Account, Transaction
                    
14
                    
                
__init__.py https://github.com/jobicoppola/django.git | Python | 208 lines
                    
13
                    
14from django.conf import global_settings
                    
15from django.utils.functional import LazyObject, empty
                    
39            # problems with Python's interactive help.
                    
40            raise ImportError("Settings cannot be imported, because environment variable %s is undefined." % ENVIRONMENT_VARIABLE)
                    
41
                    
88        except ImportError, e:
                    
89            raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
                    
90
                    
106            if app.endswith('.*'):
                    
107                app_mod = importlib.import_module(app[:-2])
                    
108                appdir = os.path.dirname(app_mod.__file__)
                    
134            logging_config_path, logging_config_func_name = self.LOGGING_CONFIG.rsplit('.', 1)
                    
135            logging_config_module = importlib.import_module(logging_config_path)
                    
136            logging_config_func = getattr(logging_config_module, logging_config_func_name)
                    
                
test.py https://bitbucket.org/lukeivers/cwdapache.git | Python | 314 lines
                    
2
                    
3import BaseHTTPServer
                    
4import cookielib
                    
4import cookielib
                    
5import errno
                    
6import os
                    
6import os
                    
7import urllib2
                    
8import subprocess
                    
8import subprocess
                    
9import threading
                    
10import time
                    
41def start_httpd(config_file = 'conf/httpd.conf'):
                    
42    global httpd
                    
43    httpd = subprocess.Popen([apache_bin_dir + '/httpd', '-X', '-d', 'httpd', '-e', 'debug', '-f', config_file], stdout = subprocess.PIPE)
                    
                
testsystem.py https://bitbucket.org/ikeydoherty/packagescripts.git | Python | 178 lines
                    
1import sys
                    
2try:
                    
2try:
                    
3	from configobj import ConfigObj
                    
4except:
                    
6	sys.exit (1)
                    
7import os.path
                    
8from solusos.console import *
                    
9
                    
10from solusos.system import UnderlayManager, SystemManager, execute_hide
                    
11import commands
                    
13import time
                    
14import glob
                    
15
                    
135		''' Completely and utterly murder all processes in the chroot :) '''
                    
136		for root in glob.glob ("/proc/*/root"):
                    
137			try:
                    
                
__init__.py https://bitbucket.org/fenics-project/ffc.git | Python | 203 lines
                    
50
                    
51import os
                    
52from hashlib import sha1
                    
53
                    
54from ffc.backends.ufc.function import *
                    
55from ffc.backends.ufc.finite_element import *
                    
55from ffc.backends.ufc.finite_element import *
                    
56from ffc.backends.ufc.dofmap import *
                    
57from ffc.backends.ufc.coordinate_mapping import *
                    
57from ffc.backends.ufc.coordinate_mapping import *
                    
58from ffc.backends.ufc.integrals import *
                    
59from ffc.backends.ufc.form import *
                    
61
                    
62# Get abspath on import, it can in some cases be
                    
63# a relative path w.r.t. curdir on startup
                    
                
test_pyclbr.py https://github.com/albertz/CPython.git | Python | 244 lines
                    
8from textwrap import dedent
                    
9from types import FunctionType, MethodType, BuiltinFunctionType
                    
10import pyclbr
                    
12from test import support
                    
13from functools import partial
                    
14
                    
57            ignore are ignored.   If no module is provided, the appropriate
                    
58            module is loaded with __import__.'''
                    
59
                    
62        if module is None:
                    
63            # Import it.
                    
64            # ('<silly>' is to work around an API silliness in __import__)
                    
64            # ('<silly>' is to work around an API silliness in __import__)
                    
65            module = __import__(moduleName, globals(), {}, ['<silly>'])
                    
66
                    
                
bartercast_crawler_plugin.py https://gitlab.com/billyprice1/tribler | Python | 163 lines
                    
10
                    
11from twisted.logger import globalLogPublisher
                    
12
                    
12
                    
13from Tribler.dispersy.crypto import NoVerifyCrypto, NoCrypto
                    
14# from dispersy.discovery.community import DiscoveryCommunity
                    
14# from dispersy.discovery.community import DiscoveryCommunity
                    
15from Tribler.dispersy.dispersy import Dispersy
                    
16from Tribler.dispersy.endpoint import StandaloneEndpoint
                    
17from Tribler.dispersy.exception import CommunityNotFoundException
                    
18from twisted.application.service import IServiceMaker, MultiService
                    
19from twisted.conch import manhole_tap
                    
19from twisted.conch import manhole_tap
                    
20from twisted.internet import reactor
                    
21from twisted.plugin import IPlugin
                    
                
__init__.py https://github.com/ichiro101/l2adena-l2j-datapack.git | Python | 210 lines
                    
3# Visit http://www.l2jdp.com/forum/ for more details
                    
4import sys
                    
5from com.l2jserver.gameserver.model.quest import State
                    
5from com.l2jserver.gameserver.model.quest import State
                    
6from com.l2jserver.gameserver.model.quest import QuestState
                    
7from com.l2jserver.gameserver.model.quest.jython import QuestJython as JQuest
                    
7from com.l2jserver.gameserver.model.quest.jython import QuestJython as JQuest
                    
8from com.l2jserver.gameserver.network.serverpackets import SocialAction
                    
9
                    
113     st.giveItems(MARK_OF_RAIDER,1)
                    
114     isFinished = st.getGlobalQuestVar("1ClassQuestFinished")
                    
115     if isFinished == "" : 
                    
125     st.exitQuest(False)
                    
126     st.saveGlobalQuestVar("1ClassQuestFinished","1")
                    
127     st.playSound("ItemSound.quest_finish")
                    
                
fileinput.py https://github.com/MrGreen123/Pydev.git | Python | 300 lines
                    
4
                    
5    import fileinput
                    
6    for line in fileinput.input():
                    
81
                    
82import sys, os, stat
                    
83
                    
91def input(files=None, inplace=0, backup="", bufsize=0):
                    
92    global _state
                    
93    if _state and _state._file:
                    
98def close():
                    
99    global _state
                    
100    state = _state
                    
284def _test():
                    
285    import getopt
                    
286    inplace = 0
                    
                
app.py https://gitlab.com/brianguertin/worldedit | Python | 406 lines
                    
1import pygame
                    
2from pygame.locals import *
                    
2from pygame.locals import *
                    
3from sgl.video.display import Display
                    
4import sgl.audio.sound as sound
                    
4import sgl.audio.sound as sound
                    
5from copy import copy
                    
6from sgl.core.containers import AttrDict
                    
6from sgl.core.containers import AttrDict
                    
7from sgl.core.tuples import Point
                    
8from sgl.core import xml, path
                    
8from sgl.core import xml, path
                    
9from sgl.app.console import Console
                    
10from sgl.app.events import *
                    
10from sgl.app.events import *
                    
11from sgl.gui.stack import Stack
                    
12import sgl.core.log as logger
                    
                
cache.py https://github.com/Grahack/geophar.git | Python | 310 lines
                    
4
                    
5# global cache registry:
                    
6CACHE = []  # [] of
                    
8
                    
9from sympy.core.logic import fuzzy_bool
                    
10from sympy.core.decorators import wraps
                    
52
                    
53       important: the result of cached function must be *immutable*
                    
54
                    
57
                    
58       >>> from sympy.core.cache import cacheit
                    
59       >>> @cacheit
                    
77        Assemble the args and kw_args to compute the hash.
                    
78        It is important that kw_args be standardized since if they
                    
79        have the same meaning but in different forms (e.g. one
                    
                
base.py https://bitbucket.org/verpage/play.git | Python | 333 lines
                    
2
                    
3import sys
                    
4import os
                    
4import os
                    
5import subprocess
                    
6import shutil
                    
6import shutil
                    
7import getopt
                    
8import urllib2
                    
8import urllib2
                    
9import webbrowser
                    
10import time
                    
10import time
                    
11import signal
                    
12
                    
                
adrt.py https://bitbucket.org/vrrm/brl-cad-copy-for-fast-history-browsing-in-git.git | Python | 350 lines
                    
22## CHANGE THESE TO WHERE YOUR PYTHON 2.2 IS LOCATED
                    
23#import sys
                    
24#sys.path.append('/usr/local/lib/python2.2')
                    
27
                    
28import commands
                    
29import Blender
                    
29import Blender
                    
30import math
                    
31import os
                    
31import os
                    
32import struct
                    
33from struct import pack
                    
33from struct import pack
                    
34from Blender import BGL, Draw, NMesh, Object, Camera, Lamp, Scene, Types
                    
35from math import log
                    
                
instrumentation.py https://gitlab.com/abhi1tb/build | Python | 416 lines
                    
17"""
                    
18import weakref
                    
19
                    
22from ..orm import base as orm_base
                    
23from ..orm import collections
                    
24from ..orm import exc as orm_exc
                    
24from ..orm import exc as orm_exc
                    
25from ..orm import instrumentation as orm_instrumentation
                    
26from ..orm.instrumentation import _default_dict_getter
                    
27from ..orm.instrumentation import _default_manager_getter
                    
28from ..orm.instrumentation import _default_state_getter
                    
29from ..orm.instrumentation import ClassManager
                    
51resolution, once the :mod:`sqlalchemy.ext.instrumentation` module
                    
52has been imported.  If custom finders are installed in the global
                    
53instrumentation_finders list, they may or may not choose to honor this
                    
                
fileinput.py https://gitlab.com/envieidoc/Clover | Python | 417 lines
                    
4
                    
5    import fileinput
                    
6    for line in fileinput.input():
                    
81
                    
82import sys, os
                    
83
                    
96    The returned instance, in addition to being an iterator,
                    
97    keeps global state for the functions of this module,.
                    
98    """
                    
98    """
                    
99    global _state
                    
100    if _state and _state._file:
                    
106    """Close the sequence."""
                    
107    global _state
                    
108    state = _state
                    
                
url_vows.py https://github.com/mrcrabby/thumbor.git | Python | 180 lines
                    
4# thumbor imaging service
                    
5# https://github.com/globocom/thumbor/wiki
                    
6
                    
8# http://www.opensource.org/licenses/mit-license
                    
9# Copyright (c) 2011 globo.com timehome@corp.globo.com
                    
10
                    
10
                    
11from pyvows import Vows, expect
                    
12
                    
12
                    
13from thumbor.url import Url
                    
14
                    
                
prefilterfrontend.py https://github.com/tinyclues/ipython.git | Python | 256 lines
                    
20#-------------------------------------------------------------------------------
                    
21# Imports
                    
22#-------------------------------------------------------------------------------
                    
22#-------------------------------------------------------------------------------
                    
23import sys
                    
24import pydoc
                    
24import pydoc
                    
25import os
                    
26import re
                    
26import re
                    
27import __builtin__
                    
28
                    
96                parent=None, user_ns=self.shell.user_ns,
                    
97                user_global_ns=self.shell.user_global_ns
                    
98            )
                    
                
build.py https://bitbucket.org/plepic/titanium_modules.git | Python | 217 lines
                    
5#
                    
6import os, subprocess, sys, glob, string
                    
7import zipfile
                    
7import zipfile
                    
8from datetime import date
                    
9
                    
56	try:
                    
57		import markdown2 as markdown
                    
58	except ImportError:
                    
58	except ImportError:
                    
59		import markdown
                    
60	documentation = []
                    
155	files = []
                    
156	for libfile in glob.glob('build/**/*.a'):
                    
157		if libfile.find('Release-')!=-1:
                    
                
otl2table.py https://github.com/companygardener/vimoutliner.git | Python | 222 lines
                    
39
                    
40import sys
                    
41from string import *
                    
41from string import *
                    
42#from time import *
                    
43
                    
44###########################################################################
                    
45# global variables
                    
46
                    
96def getArgs():
                    
97  global inputfile, debug, noTrailing, formatMode
                    
98  if (len(sys.argv) == 1): 
                    
158def closeLevels():
                    
159  global level,columns,noTrailing,formatMode
                    
160  if noTrailing == 1 :
                    
                
__init__.py https://github.com/plaes/flask-debugtoolbar.git | Python | 166 lines
                    
1import os
                    
2
                    
3from flask import current_app, request
                    
4from flask.globals import _request_ctx_stack
                    
5from flask.helpers import send_from_directory
                    
5from flask.helpers import send_from_directory
                    
6from jinja2 import Environment, PackageLoader
                    
7from werkzeug.exceptions import HTTPException
                    
7from werkzeug.exceptions import HTTPException
                    
8from werkzeug.urls import url_quote_plus
                    
9
                    
9
                    
10from flaskext.debugtoolbar.toolbar import DebugToolbar
                    
11from flask import Blueprint
                    
                
emt.py https://gitlab.com/gkastlun/ase | Python | 254 lines
                    
2
                    
3from math import sqrt, exp, log
                    
4
                    
4
                    
5import numpy as np
                    
6
                    
6
                    
7from ase.data import chemical_symbols, atomic_numbers
                    
8from ase.units import Bohr
                    
8from ase.units import Bohr
                    
9from ase.neighborlist import NeighborList
                    
10from ase.calculators.calculator import (Calculator, all_changes,
                    
45    (default: False).  If set to True, the cutoff mimics
                    
46    how Asap does it; most importantly the global cutoff
                    
47    is chosen from the largest atom present in the simulation,
                    
                
manager.py https://gitlab.com/yeah568/notebook | Python | 471 lines
                    
9import os
                    
10import re
                    
11
                    
11
                    
12from tornado.web import HTTPError
                    
13
                    
15from traitlets.config.configurable import LoggingConfigurable
                    
16from nbformat import sign, validate, ValidationError
                    
17from nbformat.v4 import new_notebook
                    
17from nbformat.v4 import new_notebook
                    
18from ipython_genutils.importstring import import_item
                    
19from traitlets import (
                    
453        """Should this file/directory name be displayed in a listing?"""
                    
454        return not any(fnmatch(name, glob) for glob in self.hide_globs)
                    
455
                    
                
conf.py https://github.com/estherbester/mezzanine.git | Python | 179 lines
                    
1
                    
2import os
                    
3import sys
                    
4
                    
5from django.template.loader import add_to_builtins
                    
6from django import VERSION
                    
7
                    
8from mezzanine.utils.importing import path_for_import
                    
9
                    
13    Called at the end of the project's settings module and is passed its 
                    
14    globals dict for updating with some final tweaks for settings that 
                    
15    generally aren't specified but can be given some better defaults based on 
                    
36                try:
                    
37                    __import__(app)
                    
38                except ImportError:
                    
                
cc_snappy.py https://gitlab.com/bertjwregeer/cloud-init | Python | 321 lines
                    
67
                    
68from cloudinit import log as logging
                    
69from cloudinit.settings import PER_INSTANCE
                    
69from cloudinit.settings import PER_INSTANCE
                    
70from cloudinit import temp_utils
                    
71from cloudinit import util
                    
72
                    
73import glob
                    
74import os
                    
104    ops = []
                    
105    for snapfile in sorted(glob.glob(os.path.sep.join([fspath, '*.snap']))):
                    
106        (name, shortname, fname_noext) = parse_filename(snapfile)
                    
252def set_snappy_command():
                    
253    global SNAPPY_CMD
                    
254    if util.which("snappy-go"):
                    
                
02_globaleaks.py https://github.com/alx/GlobaLeaks.git | Python | 265 lines
                    
1import randomizer
                    
2import time
                    
3
                    
4class Globaleaks(object):
                    
5    """
                    
157        # extract the ID of the request group, if any, of found the default, if supported
                    
158        requested_group = group_name if group_name else settings['globals'].default_group
                    
159        if requested_group:
                    
                
test_sqla.py https://github.com/ptahproject/ptah.git | Python | 457 lines
                    
1import sqlalchemy as sqla
                    
2from webob.multidict import MultiDict
                    
2from webob.multidict import MultiDict
                    
3from pyramid.testing import DummyRequest
                    
4from pyramid.compat import text_type
                    
4from pyramid.compat import text_type
                    
5from pyramid.httpexceptions import HTTPFound
                    
6from pyramid.view import render_view_to_response
                    
7
                    
8import ptah
                    
9from ptah.testing import PtahTestCase
                    
34    def setUp(self):
                    
35        global TestSqlaModuleContent
                    
36
                    
53    def test_sqla_module(self):
                    
54        from ptah.manage.manage import PtahManageRoute
                    
55        from ptah.manage.sqla import SQLAModule, Table
                    
                
ProteinStatistics.py https://bitbucket.org/andreyto/proteogenomics.git | Python | 267 lines
                    
27import BasicStats
                    
28import Global
                    
29import string
                    
29import string
                    
30import math
                    
31
                    
111    for Amino in Aminos:
                    
112        MW += Global.AminoMass.get(Amino, 0)
                    
113    MW += 19
                    
                
multicommandtool.py https://gitlab.com/brian0218/rk3066_r-box_android4.2.2_sdk | Python | 314 lines
                    
35
                    
36from optparse import OptionParser, IndentedHelpFormatter, SUPPRESS_USAGE, make_option
                    
37
                    
37
                    
38from webkitpy.tool.grammar import pluralize
                    
39from webkitpy.common.system.deprecated_logging import log
                    
193
                    
194    # FIXME: This is a hack so that we don't show --all-commands as a global option:
                    
195    def _remove_help_options(self):
                    
212class MultiCommandTool(object):
                    
213    global_options = None
                    
214
                    
279    def _add_global_options(self, option_parser):
                    
280        global_options = self.global_options or []
                    
281        for option in global_options:
                    
                
attr.py https://gitlab.com/oyvholm/linux | Python | 392 lines
                    
3
                    
4import os
                    
5import sys
                    
5import sys
                    
6import glob
                    
7import optparse
                    
7import optparse
                    
8import tempfile
                    
9import logging
                    
304            log.debug("  loading result events");
                    
305            for f in glob.glob(tempdir + '/event*'):
                    
306                self.load_events(f, self.result);
                    
321def run_tests(options):
                    
322    for f in glob.glob(options.test_dir + '/' + options.test):
                    
323        try:
                    
                
_mglob.py https://github.com/cboos/ipython.git | Python | 227 lines
                    
3Use as stand-alone utility (for xargs, `backticks` etc.),
                    
4or a globbing library for own python programs. Globbing the sys.argv is something
                    
5that almost every Windows script has to perform manually, and this module is here
                    
8
                    
9Unlike glob.glob, directories are not included in the glob unless specified
                    
10with 'dir:'
                    
15    try:
                    
16        import mglob
                    
17        files = mglob.expand(sys.argv[1:])
                    
72
                    
73import os,glob,fnmatch,sys,re
                    
74
                    
222    mglob_f.__doc__ = globsyntax
                    
223    ip.define_magic("mglob",mglob_f)
                    
224
                    
                
test_other.py https://gitlab.com/SrinivasDasthagiri/pyflakes | Python | 575 lines
                    
9
                    
10from pyflakes import messages as m
                    
11from pyflakes.test import harness
                    
204
                    
205    def test_assignToGlobal(self):
                    
206        """
                    
206        """
                    
207        Assigning to a global and then not using that global is perfectly
                    
208        acceptable. Do not mistake it for an unused local variable.
                    
405        from __future__ import with_statement
                    
406        import foo
                    
407        with open('foo') as foo[bar]:
                    
417        self.flakes('''
                    
418        from __future__ import with_statement
                    
419        with open('foo') as (bar, baz):
                    
                
Cleft.py https://github.com/boq/moul-scripts.git | Python | 280 lines
                    
49
                    
50from Plasma import *
                    
51from PlasmaTypes import *
                    
51from PlasmaTypes import *
                    
52from PlasmaConstants import *
                    
53from PlasmaKITypes import *
                    
75        #var used to load in Cleft/Tomahna specific stuff based on chronicle vals
                    
76        global loadTomahna
                    
77        global loadZandi
                    
77        global loadZandi
                    
78        global loadBook
                    
79        
                    
164    def OnServerInitComplete(self):
                    
165        global loadTomahna
                    
166        global fissureDrop
                    
                
__init__.py https://github.com/jdhardy/ironpython.git | Python | 208 lines
                    
1import os, sys, unittest, getopt, time
                    
2
                    
15    If the caller's module is __main__ then automatically return True."""
                    
16    if sys._getframe().f_back.f_globals.get("__name__") == "__main__":
                    
17        return True
                    
30    # the resource was set
                    
31    if sys._getframe().f_back.f_globals.get("__name__") == "__main__":
                    
32        return
                    
38def find_package_modules(package, mask):
                    
39    import fnmatch
                    
40    if (hasattr(package, "__loader__") and
                    
63        try:
                    
64            mod = __import__(modname, globals(), locals(), ['*'])
                    
65        except ResourceDenied, detail:
                    
83    """Run testcase several times, tracking reference counts."""
                    
84    import gc
                    
85    import ctypes
                    
                
pyenv.py https://gitlab.com/ricardo.hernandez/salt | Python | 326 lines
                    
10'''
                    
11from __future__ import absolute_import
                    
12
                    
12
                    
13# Import python libs
                    
14import os
                    
14import os
                    
15import re
                    
16import logging
                    
18try:
                    
19    from shlex import quote as _cmd_quote  # pylint: disable=E0611
                    
20except ImportError:
                    
20except ImportError:
                    
21    from pipes import quote as _cmd_quote
                    
22
                    
                
test_Counter.py https://gitlab.com/grayhamster/pycrypto | Python | 155 lines
                    
28
                    
29import sys
                    
30if sys.version_info[0] == 2 and sys.version_info[1] == 1:
                    
30if sys.version_info[0] == 2 and sys.version_info[1] == 1:
                    
31    from Crypto.Util.py21compat import *
                    
32from Crypto.Util.py3compat import *
                    
33
                    
34import unittest
                    
35
                    
37    def setUp(self):
                    
38        global Counter
                    
39        from Crypto.Util import Counter
                    
147def get_tests(config={}):
                    
148    from Crypto.SelfTest.st_common import list_test_cases
                    
149    return list_test_cases(CounterTests)
                    
                
shared.py https://bitbucket.org/mdavid/dlr.git | Python | 372 lines
                    
15
                    
16from common import runtests, printwith
                    
17
                    
17
                    
18import sys
                    
19import nt
                    
91    def generate(self, indent=1):
                    
92        global uniqueCount
                    
93        self.code.Add('    '*indent);self.code.Add('log+="preloop"\n')
                    
169    def generate(self, indent=1):
                    
170        global uniqueCount
                    
171        saved = uniqueCount
                    
174        self.code.Add('    '*indent);self.code.Add('def func%d_%d():\n' % (indent, saved))
                    
175        self.code.Add('    '*(indent+1));self.code.Add('global log\n')
                    
176        self.body.generate(indent+1)
                    
                
base.py https://gitlab.com/murder187ss/buildbot | Python | 260 lines
                    
14# Copyright Buildbot Team Members
                    
15from __future__ import print_function
                    
16
                    
16
                    
17import copy
                    
18import os
                    
18import os
                    
19import stat
                    
20import sys
                    
20import sys
                    
21import traceback
                    
22
                    
22
                    
23from contextlib import contextmanager
                    
24
                    
                
__init__.py https://gitlab.com/gregtyka/frankenserver | Python | 267 lines
                    
11
                    
12import pyamf
                    
13
                    
266
                    
267pyamf.register_package(globals(), package='flex.messaging.io')
                    
268
                    
                
test_example_iauthfunctions.py https://gitlab.com/iislod/ckan | Python | 261 lines
                    
3'''
                    
4import paste.fixture
                    
5import pylons.test
                    
5import pylons.test
                    
6import pylons.config as config
                    
7import webtest
                    
8
                    
9import ckan.model as model
                    
10import ckan.tests.legacy as tests
                    
10import ckan.tests.legacy as tests
                    
11import ckan.plugins
                    
12import ckan.tests.factories as factories
                    
25        # Return a test app with the custom config.
                    
26        app = ckan.config.middleware.make_app(config['global_conf'], **config)
                    
27        app = webtest.TestApp(app)
                    
                
debug.py https://gitlab.com/nachee1325/todoprv | Python | 350 lines
                    
12"""
                    
13import sys
                    
14import traceback
                    
14import traceback
                    
15from types import TracebackType, CodeType
                    
16from jinja2.utils import missing, internal_code
                    
16from jinja2.utils import missing, internal_code
                    
17from jinja2.exceptions import TemplateSyntaxError
                    
18from jinja2._compat import iteritems, reraise, PY2
                    
21try:
                    
22    from __pypy__ import tproxy
                    
23except ImportError:
                    
59    def is_jinja_frame(self):
                    
60        return '__jinja_template__' in self.tb.tb_frame.f_globals
                    
61
                    
                
models.py https://gitlab.com/hanswang2012/wagtail | Python | 253 lines
                    
1import StringIO
                    
2import os.path
                    
3
                    
4from taggit.managers import TaggableManager
                    
5
                    
5
                    
6from django.core.files import File
                    
7from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist, ValidationError
                    
7from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist, ValidationError
                    
8from django.db import models
                    
9from django.db.models.signals import pre_delete
                    
9from django.db.models.signals import pre_delete
                    
10from django.dispatch.dispatcher import receiver
                    
11from django.utils.safestring import mark_safe
                    
11from django.utils.safestring import mark_safe
                    
12from django.utils.html import escape
                    
13from django.conf import settings
                    
                
reindent.py https://gitlab.com/pmuontains/Odoo | Python | 315 lines
                    
43
                    
44import tokenize
                    
45import os, shutil
                    
45import os, shutil
                    
46import sys
                    
47import io
                    
66def main():
                    
67    import getopt
                    
68    global verbose, recurse, dryrun, makebackup
                    
                
control.py https://github.com/andymckay/zamboni-lib.git | Python | 345 lines
                    
2
                    
3import atexit, os, socket
                    
4
                    
4
                    
5from coverage.annotate import AnnotateReporter
                    
6from coverage.backward import string_class          # pylint: disable-msg=W0622
                    
6from coverage.backward import string_class          # pylint: disable-msg=W0622
                    
7from coverage.codeunit import code_unit_factory, CodeUnit
                    
8from coverage.collector import Collector
                    
8from coverage.collector import Collector
                    
9from coverage.data import CoverageData
                    
10from coverage.files import FileLocator
                    
10from coverage.files import FileLocator
                    
11from coverage.html import HtmlReporter
                    
12from coverage.results import Analysis
                    
                
mstats_extras.py https://github.com/stefanv/scipy3.git | Python | 388 lines
                    
19
                    
20import numpy as np
                    
21from numpy import float_, int_, ndarray
                    
22
                    
23import numpy.ma as ma
                    
24from numpy.ma import MaskedArray
                    
25
                    
26import mstats_basic as mstats
                    
27
                    
27
                    
28from scipy.stats.distributions import norm, beta, t, binom
                    
29
                    
90    p = np.array(prob, copy=False, ndmin=1)
                    
91    # Computes quantiles along axis (or globally)
                    
92    if (axis is None) or (data.ndim == 1):
                    
                
placement.py https://github.com/openstack/nova.git | Python | 219 lines
                    
14
                    
15import typing as ty
                    
16
                    
16
                    
17import os_resource_classes as orc
                    
18from oslo_limit import exception as limit_exceptions
                    
18from oslo_limit import exception as limit_exceptions
                    
19from oslo_limit import limit
                    
20from oslo_log import log as logging
                    
21
                    
22import nova.conf
                    
23from nova import exception
                    
23from nova import exception
                    
24from nova.limit import utils as limit_utils
                    
25from nova import objects
                    
                
 

Source

Language