text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
def parse_event(raw_event,preserve_backslash=False,preserve_dot=False):
in_string = False
words = []
d = {}
key = None
curr = []
for c in raw_event:
if c == '\\' and not preserve_backslash:
continue
elif c == '"':
in_string = not in_string
elif c == ' ':
if in_string:
c... | melrief/Hadoop-Log-Tools | hadoop/log/convert/libjobevent.py | Python | apache-2.0 | 1,665 | 0.032432 |
from __future__ import division, absolute_import, print_function
import collections
import tempfile
import sys
import shutil
import warnings
import operator
import io
import itertools
import ctypes
import os
if sys.version_info[0] >= 3:
import builtins
else:
import __builtin__ as builtins
from decimal import D... | kiwifb/numpy | numpy/core/tests/test_multiarray.py | Python | bsd-3-clause | 244,600 | 0.000773 |
import IMP
import IMP.algebra
import IMP.core
import IMP.atom
import IMP.test
class Tests(IMP.test.TestCase):
"""Tests for SurfaceMover."""
def test_init(self):
"""Test creation of surface mover."""
m = IMP.Model()
surf = IMP.core.Surface.setup_particle(IMP.Particle(m))
surf.... | shanot/imp | modules/core/test/test_surface_mover.py | Python | gpl-3.0 | 2,528 | 0.000396 |
from collections import namedtuple
import ckan.plugins.toolkit as tk
from ckan import model
from ckan.model import Session
import json
OgdchDatasetInfo = namedtuple('OgdchDatasetInfo',
['name', 'belongs_to_harvester', 'package_id'])
def get_organization_slug_for_harvest_source(harvest_s... | opendata-swiss/ckanext-geocat | ckanext/geocat/utils/search_utils.py | Python | agpl-3.0 | 5,592 | 0 |
from plenum.common.constants import NODE, NYM
from plenum.common.transactions import PlenumTransactions
def testTransactionsAreEncoded():
assert NODE == "0"
assert NYM == "1"
def testTransactionEnumDecoded():
assert PlenumTransactions.NODE.name == "NODE"
assert PlenumTransactions.NYM.name == "NYM"
... | evernym/zeno | plenum/test/common/test_transactions.py | Python | apache-2.0 | 450 | 0 |
import base64
import binascii
import logging
import re
from Crypto.Cipher import AES
from streamlink.plugin import Plugin, pluginmatcher
from streamlink.plugin.api import validate
from streamlink.stream.hls import HLSStream
from streamlink.utils.crypto import unpad_pkcs5
from streamlink.utils.parse import parse_json
... | amurzeau/streamlink-debian | src/streamlink/plugins/webtv.py | Python | bsd-2-clause | 2,658 | 0.001129 |
"""
WSGI config for crawler project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "crawler.settings")
from django.core.w... | lincolnnascimento/crawler | crawler/wsgi.py | Python | apache-2.0 | 389 | 0.002571 |
import re
from .state import State
from .expression import ConstantExpression
__all__ = ["assemble"]
_const_parser = None
def _evaluate_d(expression : str, state : State) -> int:
value = _get_register(expression) or state.GetLabelAddress(expression)
if not value:
value = _const_parser.Evaluate(expr... | Seairth/Orochi | assembler/__init__.py | Python | gpl-3.0 | 11,327 | 0.005562 |
from ...scheme import Scheme
from ..schemeinfo import SchemeInfoDialog
from ...gui import test
class TestSchemeInfo(test.QAppTestCase):
def test_scheme_info(self):
scheme = Scheme(title="A Scheme", description="A String\n")
dialog = SchemeInfoDialog()
dialog.setScheme(scheme)
stat... | cheral/orange3 | Orange/canvas/application/tests/test_schemeinfo.py | Python | bsd-2-clause | 680 | 0.002941 |
# -*- coding: utf-8 -*-
"""Shared functions and classes for testing."""
from __future__ import unicode_literals
import os
import shutil
import tempfile
import unittest
class BaseTestCase(unittest.TestCase):
"""The base test case."""
_DATA_PATH = os.path.join(os.getcwd(), 'data')
_TEST_DATA_PATH = os.path.joi... | Onager/artifacts | tests/test_lib.py | Python | apache-2.0 | 1,770 | 0.00791 |
from __future__ import print_function
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
import sys
import os
import inspect
from . import copydir
from . import command
from paste.util.template import ... | stefanv/aandete | app/lib/paste/script/templates.py | Python | bsd-3-clause | 10,088 | 0.001685 |
# -*- coding=utf-8 -*-
import requests
import os
import json
import sys
import time
reload(sys)
sys.setdefaultencoding('utf8')
download_base_url = 'http://www.jikexueyuan.com/course/video_download'
cookie_map = 'gr_user_id=eb91fa90-1980-4500-a114-6fea026da447; _uab_collina=148758210602708013401536; connect.sid=s%3AsR... | amlyj/pythonStudy | 2.7/crawlers/jkxy/jk_utils.py | Python | mit | 4,771 | 0.002144 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish... | rwl/PyCIM | CIM15/IEC61970/Informative/InfWork/Request.py | Python | mit | 5,609 | 0.002318 |
# coding=utf-8
# Copyright 2022 The Uncertainty Baselines Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | google/uncertainty-baselines | experimental/single_model_uncertainty/flags.py | Python | apache-2.0 | 8,929 | 0.009184 |
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 30 14:32:42 2015
@author: noore
"""
import numpy as np
from scipy.misc import comb # comb(N,k) = The number of combinations of N things taken k at a time
THETA = 0.011 # the natural abundance of 13C among the two isotopes (13C and 12C).
def compute_fractions(counts):
... | eladnoor/ms-tools | james/isotope_util.py | Python | mit | 1,554 | 0.01287 |
"""
Utility module to manipulate directories.
"""
import os
import types
import shutil
__author__ = "Jenson Jose"
__email__ = "jensonjose@live.in"
__status__ = "Alpha"
class DirUtils:
"""
Utility class containing methods to manipulate directories.
"""
def __init__(self):
pass
@staticme... | jensonjose/utilbox | utilbox/os_utils/dir_utils.py | Python | mit | 7,866 | 0.003051 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | dhuang/incubator-airflow | airflow/providers/amazon/aws/operators/ecs.py | Python | apache-2.0 | 17,123 | 0.002686 |
import numpy as np
import warnings
import subprocess
import pogoFunctions as pF
import pdb
from PolyInterface import poly
class PogoInput:
def __init__(self,
fileName,
elementTypes,
signals,
historyMeasurement,
nodes = None,
... | ab9621/PogoLibrary | pogoInput.py | Python | gpl-3.0 | 17,129 | 0.021834 |
#!/usr/bin/env python
#
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Convert Android xml resources to API 14 compatible.
There are two reasons that we cannot just use API 17 attributes,
so we are ge... | mdakin/engine | build/android/gyp/generate_v14_compatible_resources.py | Python | bsd-3-clause | 11,922 | 0.008136 |
#!/usr/bin/env python
"""Main Django renderer."""
import importlib
import os
import pdb
import time
from django import http
from django import shortcuts
from django import template
from django.views.decorators import csrf
import psutil
import logging
from grr import gui
from grr.gui import api_call_renderers
from ... | wandec/grr | gui/views.py | Python | apache-2.0 | 9,063 | 0.00982 |
"""
使用requests包装的页面请求
"""
import requests
from .headers import Headers
from proxy import proxy
class TimeoutException(Exception):
"""
连接超时异常
"""
pass
class ResponseException(Exception):
"""
响应异常
"""
pass
class WebRequest(object):
"""
包装requests
"""
def __init__(sel... | bobobo80/python-crawler-test | web_get/webget.py | Python | mit | 1,636 | 0.001906 |
#! /usr/bin/python
"""Src-depend is a simple tool for sketching source code dependency graphs
from source code itself. It iterates through all source code files in given
directory, finds import statements and turns them into edges of a dependency
graph.
Uses graphviz for sketching graphs."""
import argparse
import gra... | Sventimir/src-depend | depend.py | Python | apache-2.0 | 4,469 | 0.00358 |
# -*- coding: utf-8 -*-
class Charset(object):
common_name = 'NotoSansSylotiNagri-Regular'
native_name = ''
def glyphs(self):
glyphs = []
glyphs.append(0x0039) #glyph00057
glyphs.append(0x0034) #uniA82A
glyphs.append(0x0035) #uniA82B
glyphs.append(0x0036) #glyp... | davelab6/pyfontaine | fontaine/charsets/noto_glyphs/notosanssylotinagri_regular.py | Python | gpl-3.0 | 3,639 | 0.023633 |
"""
This test illustrate how to generate an XML Mapnik style sheet from a pycnik
style sheet written in Python.
"""
import os
from pycnik import pycnik
import artefact
actual_xml_style_sheet = 'artefacts/style_sheet.xml'
expected_xml_style_sheet = 'style_sheet.xml'
class TestPycnik(artefact.TestCaseWithArtefacts):
... | Mappy/pycnikr | tests/test_pycnik.py | Python | lgpl-3.0 | 660 | 0.001515 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# cbk_crm_information: CRM Information Tab
# Copyright (c) 2013 Codeback Software S.L. (http://codeback.es)
# @author: Miguel García <miguel@codeback.es>
# @author: Javier Fuentes <javier@codeback.... | codeback/openerp-cbk_sale_commission_filter | __openerp__.py | Python | agpl-3.0 | 1,616 | 0.004337 |
# This file is part of Buildbot. Buildbot is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | anish/buildbot | master/buildbot/test/unit/test_steps_package_rpm_rpmbuild.py | Python | gpl-2.0 | 5,421 | 0.001476 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | wscullin/spack | var/spack/repos/builtin/packages/py-markupsafe/package.py | Python | lgpl-2.1 | 2,130 | 0.000939 |
# -*- coding: utf-8 -*-
# Copyright(C) 2010-2018 Célande Adrien
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the ... | vicnet/weboob | modules/bp/pages/subscription.py | Python | lgpl-3.0 | 6,761 | 0.003108 |
from base import BaseHandler
from functions import *
from models import User
class SignupHandler(BaseHandler):
"""Sign up handler that is used to signup users."""
def get(self):
self.render("signup.html")
def post(self):
error = False
self.username = self.request.get("username")
... | kevink1986/my-first-blog | handlers/signup.py | Python | apache-2.0 | 1,621 | 0 |
"""
The :mod:`sklearn.neighbors` module implements the k-nearest neighbors
algorithm.
"""
from .ball_tree import BallTree
from .kd_tree import KDTree
from .dist_metrics import DistanceMetric
from .graph import kneighbors_graph, radius_neighbors_graph
from .unsupervised import NearestNeighbors
from .classification impo... | chrsrds/scikit-learn | sklearn/neighbors/__init__.py | Python | bsd-3-clause | 1,176 | 0 |
#!/usr/bin/env python
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "Li... | dhuang/incubator-airflow | docs/build_docs.py | Python | apache-2.0 | 19,953 | 0.002356 |
# from fileios import *
# msg = 'Enter Absolute Path to file: '
# f_name = raw_input(msg).strip()
#
# path = file_data_and_path(f_name)
# if path != None:
# print 'Path:',path
# from Tkinter import Tk
# from tkFileDialog import askopenfilename
#
# Tk().withdraw() # we don't want a full GUI, so keep the root wind... | rohinkumar/correlcalc | correlcalc/test.py | Python | mit | 3,556 | 0.003375 |
[] = c
y = []
for [] in x:
BLOCK
[] = []
| zrax/pycdc | tests/input/unpack_empty.py | Python | gpl-3.0 | 45 | 0 |
from django.contrib.auth.models import User
from selectable.base import ModelLookup
from selectable.registry import registry
class UserLookup(ModelLookup):
model = User
search_fields = (
'username__icontains',
'first_name__icontains',
'last_name__icontains',
)
filters = {'is_ac... | seanherron/data-inventory | inventory_project/datasets/lookups.py | Python | mit | 625 | 0.0032 |
#!/usr/bin/python
#coding:utf-8
import os
import sys
import re
def usage():
help_info="Usage: %s <recinfo_file> <sendinfo_file>" % sys.argv[0]
print help_info
def main():
try:
recinfo_file=sys.argv[1]
sendinfo_file=sys.argv[2]
except:
usage()
sys.exit(-1)
if ... | melon-li/tools | netem/statdata/statdelay.py | Python | apache-2.0 | 1,581 | 0.01265 |
#http://www.thelatinlibrary.com/gestafrancorum.html
#prose
import sqlite3
import urllib
import re
from urllib.request import urlopen
from bs4 import BeautifulSoup
from phyllo.phyllo_logger import logger
# functions are mostly made by Sarah Otts
def add_to_database(verse_entries, db):
logger.info("Adding {} entri... | oudalab/phyllo | phyllo/extractors/gestafrancDB.py | Python | apache-2.0 | 6,972 | 0.005164 |
# Copywrite © 2017 Joe Rogge, Jacob Gasyna and Adele Rehkemper
#This file is part of Rhythm Trainer Pro. Rhythm Trainer Pro is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or... | jacobgasyna/Hackathon2017 | basics.py | Python | gpl-3.0 | 3,296 | 0.011229 |
import json
import logging
from logging.config import dictConfig
import threading
import pickle
import redis
import aws
from settings import Settings
def terminate_worker(worker_id, instance, client):
result = aws.terminate_machine(instance)
if result is None or len(result) == 0:
logging.error('could... | witlox/dcs | controller/ilm/consuela.py | Python | gpl-2.0 | 4,723 | 0.003176 |
from typing import Dict
from urllib.parse import quote
def request_path(env: Dict):
return quote('/' + env.get('PATH_INFO', '').lstrip('/'))
| bugsnag/bugsnag-python | bugsnag/wsgi/__init__.py | Python | mit | 147 | 0 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | ritchyteam/odoo | addons/mail/mail_group.py | Python | agpl-3.0 | 12,895 | 0.004731 |
#
# Copyright (c) 2008--2011 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... | dmacvicar/spacewalk | backend/server/action_extra_data/reboot.py | Python | gpl-2.0 | 1,085 | 0.003687 |
"""Convenient parallelization of higher order functions.
This module provides two helper functions, with appropriate fallbacks on
Python 2 and on systems lacking support for synchronization mechanisms:
- map_multiprocess
- map_multithread
These helpers work like Python 3's map, with two differences:
- They don't gu... | nataddrho/DigiCue-USB | Python3/src/venv/Lib/site-packages/pip/_internal/utils/parallel.py | Python | mit | 3,327 | 0 |
from flask import Flask
from flask_cqlalchemy import CQLAlchemy
app = Flask(__name__)
app.config['CASSANDRA_HOSTS'] = ['127.0.0.1']
app.config['CASSANDRA_KEYSPACE'] = "cqlengine"
app.config['CASSANDRA_SETUP_KWARGS'] = {'protocol_version': 3}
db = CQLAlchemy(app)
class Address(db.UserType):
street = db.columns.T... | thegeorgeous/flask-cqlalchemy | examples/example_app_udt.py | Python | isc | 509 | 0 |
import numpy as np
def init_network():
network = {}
network['W1'] = np.array([[0.1, 0.3, 0.5], [0.2, 0.4, 0.6]])
network['b1'] = np.array([0.1, 0.2, 0.3])
network['W2'] = np.array([[0.1, 0.4], [0.2, 0.5], [0.3, 0.6]])
network['b2'] = np.array([0.1, 0.2])
network['W3'] = np.array([[0.1, 0.3], [0... | nobukatsu/deep-learning-from-scratch | ch03/nn-3layer.py | Python | mit | 894 | 0.008949 |
>>> myTuple = (1, 2, 3)
>>> myTuple[1]
2
>>> myTuple[1:3]
(2, 3)
| schmit/intro-python-course | lectures/code/tuples_basics.py | Python | mit | 65 | 0.046154 |
#! /usr/bin/env pypy
"""
Command-line options for translate:
See below
"""
import os
import sys
import py
from rpython.config.config import (to_optparse, OptionDescription, BoolOption,
ArbitraryOption, StrOption, IntOption, Config, ChoiceOption, OptHelpFormatter)
from rpython.config.translationoption import (... | jptomo/rpython-lang-scheme | rpython/translator/goal/translate.py | Python | mit | 12,703 | 0.001889 |
def phone_num_lists():
"""
Gets a dictionary of 0-9 integer values (as Strings) mapped to their potential Backpage ad manifestations, such as "zer0" or "seven".
Returns:
dictionary of 0-9 integer values mapped to a list of strings containing the key's possible manifestations
"""
all_nums = {}
all_nu... | usc-isi-i2/etk | etk/data_extractors/htiExtractors/misc.py | Python | mit | 1,773 | 0.0141 |
# Copyright (C) 2005 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in ... | Distrotech/bzr | bzrlib/testament.py | Python | gpl-2.0 | 9,034 | 0.001107 |
# Test reading hdf5 file that I created
import numpy as np
import Starfish
from Starfish.grid_tools import HDF5Interface
myHDF5 = HDF5Interface()
wl = myHDF5.wl
flux = myHDF5.load_flux(np.array([6100, 4.5, 0.0]))
| jason-neal/companion_simulations | misc/starfish_tests/read_HDF5.py | Python | mit | 215 | 0 |
import csv
import django.http
try:
import autotest.common as common
except ImportError:
import common
from autotest_lib.frontend.afe import rpc_utils
class CsvEncoder(object):
def __init__(self, request, response):
self._request = request
self._response = response
self._output_rows ... | libvirt/autotest | frontend/tko/csv_encoder.py | Python | gpl-2.0 | 5,495 | 0.00364 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
from superde... | petrjasek/superdesk-core | content_api/companies/resource.py | Python | agpl-3.0 | 963 | 0 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleads/google-ads-python | google/ads/googleads/v9/services/services/income_range_view_service/client.py | Python | apache-2.0 | 18,971 | 0.001054 |
from django.core.cache import cache
def pytest_runtest_setup(item):
# Clear the cache before every test
cache.clear()
| mozilla/standup | standup/status/tests/conftest.py | Python | bsd-3-clause | 128 | 0 |
from . import common
from .common import *
| richard-willowit/odoo | odoo/tests/__init__.py | Python | gpl-3.0 | 43 | 0 |
'''import datetime
daytime.MINYEAR = 1901
daytime.MAXYEAR = 2000
print(daytime.MAXYEAR)'''
import calendar
count = 0
year = 1901
endYear = 2001
month = 12
for x in range (year, endYear):
for y in range (1, month+1):
if calendar.weekday(x,y,1) == calendar.SUNDAY:
count = count+1
print("Count: " + str(c... | DarrenBellew/CloudCompDT228-3 | Lab3/CountingSundays.py | Python | mit | 328 | 0.021341 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | smurf/smurf_models/raft_update.py | Python | apache-2.0 | 8,034 | 0.003112 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# keyboard_widget.py
#
# Copyright © 2012 Linux Mint (QT version)
# Copyright © 2013 Manjaro (QT version)
# Copyright © 2013-2015 Antergos (GTK version)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General ... | manjaro/thus | thus/misc/keyboard_widget.py | Python | gpl-3.0 | 13,129 | 0.001371 |
"""
This package contains algorithms for extracting document representations from their raw
bag-of-word counts.
"""
# bring model classes directly into package namespace, to save some typing
from .hdpmodel import HdpModel
from .ldamodel import LdaModel
from .lsimodel import LsiModel
from .tfidfmodel import TfidfModel
... | krishna11888/ai | third_party/gensim/gensim/models/__init__.py | Python | gpl-2.0 | 1,920 | 0.004688 |
#!/usr/bin/env python
import numpy as np
import pandas as pd
def build_allele_dict():
""" Take a sheet and build a dictionary with:
[gene][allele] = count
"""
fname = '/home/jfear/mclab/cegs_sem_sd_paper/from_matt/DSRP_and_CEGS_haps_1-6-15.xlsx'
data = pd.ExcelFile(fname)
dspr = data.parse('DSRP_hap... | McIntyre-Lab/papers | fear_sem_sd_2015/scripts/haplotype_freqs.py | Python | lgpl-3.0 | 358 | 0.005587 |
import os
from setuptools import setup
README = open(os.path.join(os.path.dirname(__file__), 'README.md')).read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name = 'django_sprinkler',
version = '0.4',
packages = ["django_... | jpardobl/django_sprinkler | setup.py | Python | bsd-3-clause | 1,456 | 0.021291 |
# coding: utf-8
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import json
china = json.loads(open('china.json', 'r').read()) # slow
new_provs = []
new_citys = []
for prov in china['children']:
new_provs.append(prov['name'])
for city in prov['children']:
if city['name'] not in [u'市辖区', u'县',... | phyng/phyip | geodata/provinces_script.py | Python | mit | 637 | 0.004926 |
#!/usr/bin/python
import numpy as np
import os
import sys
from keras.layers import Activation, Dense, Input
from keras.layers.normalization import BatchNormalization
from keras.models import Model, Sequential
from keras.optimizers import RMSprop
NUM_OF_HIDDEN_NEURONS = 100
QNETWORK_NAME = 'online_netw... | 356255531/SpikingDeepRLControl | code/EnvBo/Q-Learning/Testing_Arm_4points/q_networks.py | Python | gpl-3.0 | 3,008 | 0.002992 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | kalahbrown/HueBigSQL | apps/jobbrowser/src/jobbrowser/models.py | Python | apache-2.0 | 22,026 | 0.009262 |
#!/usr/bin/env python
#
# VM Backup extension
#
# Copyright 2014 Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | soumyanishan/azure-linux-extensions | VMBackup/main/fsfreezer.py | Python | apache-2.0 | 8,407 | 0.00904 |
import xbmcaddon
MainBase = 'http://164.132.106.213/data/home/home.txt'
addon = xbmcaddon.Addon('plugin.video.sneek') | gypogypo/plugin.video.sneek | _Edit.py | Python | gpl-3.0 | 121 | 0.008264 |
### Simple IAN model for use with Neural Photo Editor
# This model is a simplified version of the Introspective Adversarial Network that does not
# make use of Multiscale Dilated Convolutional blocks, Ternary Adversarial Loss, or an
# autoregressive RGB-Beta layer. It's designed to be sleeker and to run on laptop GPUs ... | spellrun/Neural-Photo-Editor | gan/models/ian_simple.py | Python | mit | 8,119 | 0.045695 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | google/citest | tests/json_predicate/map_predicate_test.py | Python | apache-2.0 | 7,327 | 0.003276 |
#####################################################################################
#
# Copyright (c) Crossbar.io Technologies GmbH
#
# Unless a separate license agreement exists between you and Crossbar.io GmbH (e.g.
# you have purchased a commercial license), the license terms below apply.
#
# Should you enter ... | NinjaMSP/crossbar | crossbar/adapter/mqtt/_events.py | Python | agpl-3.0 | 21,416 | 0.000654 |
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2010 Rosen Diankov (rosen.diankov@gmail.com)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
... | vitan/openrave | python/databases/kinematicreachability.py | Python | lgpl-3.0 | 20,281 | 0.015926 |
#!/usr/bin/env python
# Copyright (C) 2006-2016 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation (FSF), e... | carthach/essentia | test/src/unittests/standard/test_idct.py | Python | agpl-3.0 | 2,364 | 0.015651 |
#!/usr/bin/env python3
import os
import sys
src_dir = os.path.abspath('src/')
sys.path.append(src_dir)
sys.ps1 = ''
sys.ps2 = ''
import id003
import termutils as t
import time
import logging
import configparser
import threading
import serial.tools.list_ports
from serial.serialutil import SerialException
from colle... | Kopachris/py-id003 | protocol_analyzer.py | Python | bsd-3-clause | 17,902 | 0.005307 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2017 F5 Networks Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# ... | mryanlam/f5-ansible | library/bigip_user.py | Python | gpl-3.0 | 18,876 | 0.000371 |
# ----------------------------------------------------------------------
# Copyright (c) 2010-2014 Raytheon BBN Technologies
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction, including... | ict-felix/stack | modules/resource/orchestrator/src/credentials/cred_util.py | Python | apache-2.0 | 16,348 | 0.00312 |
#coding=utf-8
"""
Command-line interface utilities for Trigger tools. Intended for re-usable
pieces of code like user prompts, that don't fit in other utils modules.
"""
__author__ = 'Jathan McCollum'
__maintainer__ = 'Jathan McCollum'
__email__ = 'jathan.mccollum@teamaol.com'
__copyright__ = 'Copyright 2006-2012, AO... | sysbot/trigger | trigger/utils/cli.py | Python | bsd-3-clause | 9,769 | 0.001843 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 Clione Software
# Copyright (c) 2010-2013 Cidadania S. Coop. Galega
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.or... | cidadania/e-cidadania | src/apps/thirdparty/smart_selects/urls.py | Python | apache-2.0 | 1,198 | 0.003339 |
from paddle.trainer_config_helpers import *
settings(learning_rate=1e-4, batch_size=1000)
seq_in = data_layer(name='input', size=200)
labels = data_layer(name='labels', size=5000)
probs = data_layer(name='probs', size=10)
xe_label = data_layer(name='xe-label', size=10)
hidden = fc_layer(input=seq_in, size=4)
output... | lispc/Paddle | python/paddle/trainer_config_helpers/tests/configs/test_cost_layers.py | Python | apache-2.0 | 1,402 | 0 |
import json
import random
import requests
from plugin import create_plugin
from message import SteelyMessage
HELP_STR = """
Request your favourite bible quotes, right to the chat.
Usage:
/bible - Random quote
/bible Genesis 1:3 - Specific verse
/bible help - This help text
Verses are specified in th... | sentriz/steely | steely/plugins/bible/main.py | Python | gpl-3.0 | 3,384 | 0.001182 |
#!/usr/bin/python
import os,sys,re
#Check the OS Version
RELEASE_FILE = "/etc/redhat-release"
RWM_FILE = "/etc/httpd/conf.modules.d/00-base.conf"
if os.path.isfile(RELEASE_FILE):
f=open(RELEASE_FILE,"r")
rel_list = f.read().split()
if rel_list[2] == "release" and tuple(rel_list[3].split(".")) < ('8','5'):
pri... | sujith7c/py-system-tools | en_mod_rw.py | Python | gpl-3.0 | 636 | 0.031447 |
import logging
import select
import socket
from collections import deque
from amqpsfw import amqp_spec
from amqpsfw.exceptions import SfwException
from amqpsfw.configuration import Configuration
amqpsfw_logger = logging.getLogger('amqpsfw')
log_handler = logging.StreamHandler()
formatter = logging.Formatter('%(ascti... | akayunov/amqpsfw | lib/amqpsfw/application.py | Python | mit | 6,761 | 0.002367 |
import telnetlib
from time import sleep
import re
import os
HOST_IPs = [
"172.16.1.253", "172.16.1.254"
]
telnet_password = b"pass_here"
enable_password = b"pass_here"
show_commands_list = [
b"show run",
b"show ip arp",
b"show vlan",
b"show cdp neighbors",
b"show ip interface brief"
b"sh... | JamesKBowler/networking_scripts | cisco/cisco_telnet_recon.py | Python | mit | 1,465 | 0.006826 |
from __future__ import with_statement
import hashlib
import os
import posixpath
import stat
import re
from fnmatch import filter as fnfilter
from fabric.state import output, connections, env
from fabric.utils import warn
from fabric.context_managers import settings
def _format_local(local_path, local_is_path):
... | jessekl/flixr | venv/lib/python2.7/site-packages/fabric/sftp.py | Python | mit | 12,958 | 0.000772 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
from cocoprep.archive_load_data import get_file_name_list, parse_archive_file_name, get_key_value, parse_range
from cocoprep.archive_exceptions import PreprocessingException, PreprocessingWarning... | PyQuake/earthquakemodels | code/cocobbob/coco/code-preprocessing/archive-update/extract_extremes.py | Python | bsd-3-clause | 4,277 | 0.006079 |
"""distutils.file_util
Utility functions for operating on single files.
"""
# This module should be kept compatible with Python 2.1.
__revision__ = "$Id: file_util.py,v 1.17 2004/11/10 22:23:14 loewis Exp $"
import os
from distutils.errors import DistutilsFileError
from distutils import log
# for generating verbos... | trivoldus28/pulsarch-verilog | tools/local/bas-release/bas,3.9-SunOS-i386/lib/python/lib/python2.4/distutils/file_util.py | Python | gpl-2.0 | 8,320 | 0.002404 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | sxjscience/tvm | python/tvm/contrib/clang.py | Python | apache-2.0 | 3,361 | 0.000595 |
from bokeh.plotting import figure, output_file, show
p = figure(width=400, height=400)
p.circle(2, 3, radius=.5, alpha=0.5)
output_file('out.html')
show(p)
| Serulab/Py4Bio | code/ch14/basiccircle.py | Python | mit | 157 | 0 |
class Optimizer:
def __init__(self, model, params=None):
self.model = model
if params:
self.model.set_params(**params)
self.params = self.model.get_params()
self.__chain = list()
def step(self, name, values, skipped=False):
if not skipped:
self._... | danielwpz/soybean | src/util/optimizer.py | Python | mit | 1,090 | 0.000917 |
"""
Parent of all (field) classes in Hachoir: Field.
"""
from hachoir_core.compatibility import reversed
from hachoir_core.stream import InputFieldStream
from hachoir_core.error import HachoirError, HACHOIR_ERRORS
from hachoir_core.log import Logger
from hachoir_core.i18n import _
from hachoir_core.tools import makePr... | kreatorkodi/repository.torrentbr | plugin.video.yatp/site-packages/hachoir_core/field/field.py | Python | gpl-2.0 | 8,646 | 0.002429 |
# coding: utf-8
import os
import sys
from nxdrive.logging_config import get_logger
from nxdrive.utils import safe_long_path
from tests.common_unit_test import UnitTestCase
if sys.platform == 'win32':
import win32api
log = get_logger(__name__)
# Number of chars in path c://.../Nuxeo.. is approx 96 chars
FOLDER_... | ssdi-drive/nuxeo-drive | nuxeo-drive-client/tests/test_long_path.py | Python | lgpl-2.1 | 3,664 | 0.000819 |
from cgi import parse_qs, escape, FieldStorage
import time
import shutil
def ping_app(environ, start_response):
status = '200 OK'
output = 'Pong!'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
... | ameyjadiye/nxweb | sample_config/python/hello.py | Python | lgpl-3.0 | 2,478 | 0.01937 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nicira, Inc.
# All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/lic... | linvictor88/vse-lbaas-driver | quantum/plugins/nicira/QuantumPlugin.py | Python | apache-2.0 | 104,734 | 0.000134 |
"""
vue2svg : spike/prototype for scenetool.
generates an svg scene from VUE files specified on command line.
usage:
python3.2 vue2svg.py ../test/vue/*.vue
https://github.com/tangentstorm/scenetool
copyright (c) 2013 michal j wallace.
available to the public under the MIT/x11 license. (see ../LICENSE)
"""
import o... | tangentstorm/scenetool | spike/vue2svg.py | Python | mit | 5,403 | 0.004442 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | lib/spack/spack/test/cmd/find.py | Python | lgpl-2.1 | 3,528 | 0 |
__author__="vvladych"
__date__ ="$09.10.2014 23:01:15$"
from forecastmgmt.dao.db_connection import get_db_connection
import psycopg2.extras
from MDO import MDO
from person_name import PersonName
class Person(MDO):
sql_dict={"get_all":"SELECT sid, common_name, birth_date, birth_place, person_uuid FROM fc_... | vvladych/forecastmgmt | src/forecastmgmt/model/person.py | Python | unlicense | 2,819 | 0.025186 |
import unittest
import opm.io
import numpy as np
from opm.io.parser import Parser
from opm.io.deck import DeckKeyword
from opm.io.ecl_state import EclipseState
try:
from tests.utils import test_path
except ImportError:
from utils import test_path
class TestFieldProps(unittest.TestCase):
def assertClose... | OPM/opm-common | python/tests/test_field_props.py | Python | gpl-3.0 | 2,742 | 0.006929 |
from ..workdays import *
from datetime import datetime, timedelta
from time import strptime
import math
import traceback
tests=[]
def test( fn ):
tests.append(fn)
return fn
def runTests():
for t in tests:
print t
try: t()
except Exception as e:
print e
trace... | mmahnic/trac-tickethistory | tickethistory/test/workdays_t.py | Python | mit | 4,805 | 0.028512 |
# -*- coding: utf-8 -*-
# Copyright 2014 Metaswitch Networks
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | fasaxc/felix | calico/felix/test/test_frules.py | Python | apache-2.0 | 13,792 | 0.008338 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the update tool."""
from __future__ import unicode_literals
import os
import sys
import unittest
from tools import update
from tests import test_lib
@unittest.skipIf(
os.environ.get('TRAVIS_OS_NAME') == 'osx',
'TLS 1.2 not supported by macOS on Tr... | rgayon/l2tdevtools | tests/update.py | Python | apache-2.0 | 2,954 | 0.008463 |
config = {
"name": "Tombstone counter", # plugin name
"type": "receiver", #plugin type
"description": ["counts tombstones in a world"] #description
}
import database as db # import terraria database
class Receiver(): # required class to be called by plugin manager
def __init__(self): #do any ini... | flying-sheep/omnitool | plugins/tombstone.py | Python | mit | 1,209 | 0.01737 |
import cvlib
angle = 0
angles = []
center = []
for i in range(24): #24
img = cvlib.load("findloop_%d.jpg" % angle)
angles.append(angle)
rng = cvlib.inRangeThresh(img, (20,30,20), (200,130,120))
rng = cvlib.bitNot(rng)
cnt = cvlib.findContours(rng, thresh=250)
if cvlib.area(cnt[0]) > cvlib.area(... | nextBillyonair/compVision | AMX/Crystal/loop.py | Python | mit | 1,215 | 0.015638 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'Positions'
db.delete_table(u'positions_positions')
# Adding model 'Position'
... | Hackfmi/Diaphanum | positions/migrations/0002_auto__del_positions__add_position.py | Python | mit | 1,927 | 0.006227 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.