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 |
|---|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
# ... | SKIRT/PTS | core/config/plot_simulation_seds.py | Python | agpl-3.0 | 1,942 | 0.004637 |
# -*- coding:utf-8 -*-
def decode(data):
try:
value, idx = __decode(data, 0)
retval = (True, value)
except Exception as e:
retval = (False, e.message)
finally:
return retval
def encode(data):
try:
value = __encode(data)
retval = (True, value)
excep... | fupenglin/PyDHT | dht_bencode.py | Python | gpl-2.0 | 2,915 | 0 |
import platform
class OSCollector(object):
def __init__(self, docker_client=None):
self.docker_client = docker_client
def key_name(self):
return "osInfo"
def _zip_fields_values(self, keys, values):
data = {}
for key, value in zip(keys, values):
if len(value) >... | dx9/python-agent | cattle/plugins/host_info/os_c.py | Python | apache-2.0 | 1,411 | 0 |
# This file is part of LibreOsteo.
#
# LibreOsteo is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# LibreOsteo is distributed ... | libreosteo/Libreosteo | Libreosteo/settings/base.py | Python | gpl-3.0 | 9,670 | 0.000827 |
import google
import re
from bs4 import BeautifulSoup
def findContactPage(url):
html = google.get_page(url)
soup = BeautifulSoup(html)
contactStr = soup.find_all('a', href=re.compile(".*?contact", re.IGNORECASE))
return contactStr
if __name__ == "__main__":
url = "http://www.wrangler.com/"
c... | LeoYReyes/GoogleSearchAutomator | Crawler.py | Python | bsd-3-clause | 789 | 0.011407 |
"""projectash URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-... | Ashaba/jash | projectash/urls.py | Python | bsd-2-clause | 1,803 | 0.000555 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/_operations/_operations.py | Python | mit | 10,950 | 0.004384 |
# -*- coding: utf-8 -*-
#
# diffoscope: in-depth comparison of files, archives, and directories
#
# Copyright © 2016 Chris Lamb <lamby@debian.org>
#
# diffoscope 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,... | ReproducibleBuilds/diffoscope | diffoscope/comparators/utils/container.py | Python | gpl-3.0 | 7,045 | 0.001136 |
# encoding:utf8
import numpy as np
import cv2
import base64
import beesion
import time
import logging
logging.basicConfig(format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s',
datefmt='%H:%M:%S',
level=logging.DEBUG)
frame_processing_ratio = 4
fram... | beeva-albertorincon/beeva-poc-google-ocr-faces | code/demo.py | Python | apache-2.0 | 2,248 | 0.018238 |
if __name__ == '__main__':
n = int(input())
for i in range(n):
print(i**2)
| manishbisht/Competitive-Programming | Hackerrank/Practice/Python/1.introduction/05.Loops.py | Python | mit | 107 | 0.009346 |
__author__ = 'roscoe'
import os
from datetime import datetime
import qgis.utils
import qgis.utils
from src.geogigpy import Repository
from src.geogigpy import geogig
from src.geogigpy.geogigexception import GeoGigException
from qgis.core import QgsVectorLayer, QgsMapLayerRegistry
class GeoRepo(object):
def __in... | roscoeZA/GeoGigSync | geo_repo.py | Python | cc0-1.0 | 4,025 | 0.003727 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-aiplatform | tests/unit/gapic/aiplatform_v1/test_tensorboard_service.py | Python | apache-2.0 | 360,461 | 0.000977 |
# http://deeplearning.net/tutorial/code/mlp.py
"""
This tutorial introduces the multilayer perceptron using Theano.
A multilayer perceptron is a logistic regressor where
instead of feeding the input to the logistic regression you insert a
intermediate layer, called the hidden layer, that has a nonlinear
activation fu... | cliffclive/neuromancy | neuromancy/theano_tutorials/tutorial_mlp.py | Python | mit | 13,906 | 0.001582 |
import os
import sys
import logging
import base64
from subprocess import check_call
from transparencyscript.constants import TRANSPARENCY_SUFFIX
from transparencyscript.utils import make_transparency_name, get_config_vars, get_password_vars, get_task_vars, \
get_transparency_vars, get_tree_head, get_lego_env, get_... | BrandonTang/binary-transparency | transparencyscript/script.py | Python | mpl-2.0 | 3,070 | 0.002606 |
from misc.standalone_helper import decode_string, double_decode_string
from .__general_data_v1 import GeneralEndpointDataV1
class PartitionsPartitionEndpoint(GeneralEndpointDataV1):
def _get(self) -> bool:
partition_id = self._request_holder.get_params()["partition"]
partition_id = decode_string(p... | OpServ-Monitoring/opserv-backend | app/server/restful_api/data/v1/endpoints/partitions_partition.py | Python | gpl-3.0 | 1,794 | 0.001115 |
#!/usr/bin/env python
# This example script was ported from Perl Spreadsheet::WriteExcel module.
# The author of the Spreadsheet::WriteExcel module is John McNamara
# <jmcnamara@cpan.org>
__revision__ = """$Id: hyperlink2.py,v 1.3 2004/01/31 18:56:07 fufff Exp $"""
####################################################... | evgenybf/pyXLWriter | examples/hyperlink2.py | Python | lgpl-2.1 | 4,310 | 0.001624 |
import datetime
import six
try:
from django.contrib.sites.requests import RequestSite
except ImportError: # Django < 1.9
from django.contrib.sites.models import RequestSite
from django.core.exceptions import ObjectDoesNotExist
from django.core.serializers.json import DjangoJSONEncoder
from django.forms.model... | drax68/graphite-web | webapp/graphite/events/views.py | Python | apache-2.0 | 5,333 | 0.002813 |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | napalm-automation/napalm-yang | napalm_yang/models/openconfig/interfaces/interface/routed_vlan/ipv6/addresses/address/vrrp/vrrp_group/interface_tracking/state/__init__.py | Python | apache-2.0 | 11,529 | 0.001475 |
#
# Copyright (C) 2013,2014,2015,2016 The ESPResSo project
#
# This file is part of ESPResSo.
#
# ESPResSo is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option)... | tbereau/espresso | testsuite/python/magnetostaticInteractions.py | Python | gpl-3.0 | 2,692 | 0.007058 |
# 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... | madjam/mxnet | python/mxnet/_ctypes/ndarray.py | Python | apache-2.0 | 5,374 | 0.000744 |
from django import http
from django.conf.urls import patterns
from django.contrib import admin
from django.db import models
from django.forms.models import modelform_factory
from django.shortcuts import get_object_or_404
from django.template import loader, Context
from django.views.generic import View
def get_printab... | SohoTechLabs/django-ajax-changelist | ajax_changelist/admin.py | Python | mit | 4,495 | 0.001557 |
# -*- coding: utf-8 -*-
#!/usr/bin/python
import numpy as np
import scipy
from sklearn import preprocessing
from sklearn.feature_extraction import DictVectorizer
from sklearn.cross_validation import train_test_split
from sklearn.metrics import classification_report, confusion_matrix
from collections import Counter
fro... | ptoman/icgauge | icgauge/experiment_frameworks.py | Python | mit | 11,989 | 0.009425 |
'''
Copyleft Mar 10, 2017 Arya Iranmehr, PhD Student, Bafna Lab, UC San Diego, Email: airanmehr@gmail.com
'''
import numpy as np;
np.set_printoptions(linewidth=200, precision=5, suppress=True)
import pandas as pd;
pd.options.display.max_rows = 20;
pd.options.display.expand_frame_repr = False
# import seaborn as sns
... | airanmehr/bio | Scripts/Miscellaneous/Tutorials/demography.py | Python | mit | 2,014 | 0.021351 |
# Copyright (c) 2014 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | nadeemsyed/swift | test/unit/common/test_splice.py | Python | apache-2.0 | 10,235 | 0 |
# -*- coding: utf-8 -*-
import sys
import pygeoip
import os.path
import socket
import sqlite3
import time
import re
DATAFILE = os.path.join(sys.path[0], "GeoIP.dat")
# STANDARD = reload from disk
# MEMORY_CACHE = load to memory
# MMAP_CACHE = memory using mmap
gi4 = pygeoip.GeoIP(DATAFILE, pygeoip.MEMORY_CACHE)
def ... | rnyberg/pyfibot | pyfibot/modules/module_geokick.py | Python | bsd-3-clause | 5,174 | 0.015471 |
# -*- coding: utf-8 -*-
###############################################################################
#
# GetClicksForLink
# Returns the number of clicks on a single Bitly link.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you... | jordanemedlock/psychtruths | temboo/core/Library/Bitly/LinkMetrics/GetClicksForLink.py | Python | apache-2.0 | 5,517 | 0.005256 |
# encoding: utf-8
#
# 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 3 of the License, or
# (at your option) any later version.
#
# This program is d... | zeratul2099/crypt_app | crypto/models.py | Python | gpl-3.0 | 4,784 | 0.005029 |
#!/usr/bin/env python
import common
import sys
for name,ip,port in common.get_vm_config():
format_args = {'public_port': port,
'name': name,
'local_address': ip
}
print "%(local_address)s\t%(name)s %(name)s.acme.intern" % format_args
| bcoding/docker-host-scripts | py/generate_etc_hosts.py | Python | unlicense | 301 | 0.006645 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('user', '0002_auto_20150703_0836'),
]
operations = [
migrations.AlterField(
mode... | 28harishkumar/Social-website-django | user/migrations/0003_auto_20150703_0843.py | Python | mit | 485 | 0.002062 |
# -*- coding: utf-8 -*-
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License, Version 2.0 (the "Lic... | sparkslabs/kamaelia_ | Sketches/RJL/SMTP/MailShared.py | Python | apache-2.0 | 2,422 | 0.004129 |
import numpy as np
import os
from tensorutils.antisym import get_antisymmetrizer_product as asym
test_dir_path = os.path.dirname(os.path.realpath(__file__))
array_path_template = os.path.join(test_dir_path, "random_arrays", "{:s}.npy")
def test__composition_1():
array1 = np.load(array_path_template.format("15x1... | avcopan/meinsum | test/test_antisym.py | Python | gpl-3.0 | 5,061 | 0 |
# -*- coding: utf-8 -*-
"""
sleekxmpp.util
~~~~~~~~~~~~~~
Part of SleekXMPP: The Sleek XMPP Library
:copyright: (c) 2012 Nathanael C. Fritz, Lance J.T. Stout
:license: MIT, see LICENSE for more details
"""
from sleekxmpp.util.misc_ops import bytes, unicode, hashes, hash, \
... | danielvdao/facebookMacBot | venv/lib/python2.7/site-packages/sleekxmpp/util/__init__.py | Python | mit | 1,067 | 0.002812 |
# -*- coding: utf-8 -*-
# quiz/quiz.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return 'Cześć, tu Python!'
if __name__ == '__main__':
app.run(debug=True)
| koduj-z-klasa/python101 | docs/webflask/quiz/quiz2.py | Python | mit | 204 | 0 |
import logging
import page_objects
def option_should_be_selected(text):
'''
Verifies specified dropdown option is selected.
Parameters
----------
text : str
Returns
-------
None
Raises
------
AssertionError
If the specified option is not selected.
'''
pag... | MooMan272/selenium_the_internet | verify/dropdown.py | Python | mit | 710 | 0.002817 |
import httplib, time, inspect
import selenium.webdriver.remote.webdriver
from pytanium_element import PytaniumElement
OldRemoteWebDriver = selenium.webdriver.remote.webdriver.WebDriver
# Redefine the RemoteWebDriver
class RemoteWebDriver(OldRemoteWebDriver):
# NOTE: Both desired_capabilities and capabilities... | kevlened/pytanium | pytanium/webdriver.py | Python | lgpl-3.0 | 39,315 | 0.019407 |
# -*- coding: utf-8 -*-
"""
{{ project_name }}.libs.common.models
~~~~~~~~~~~~~~~~~~~~~~~~~
This module contains all models that can be used across apps
:copyright: (c) 2015
"""
from django.db import models
from django.utils.translation import ugettext_lazy as _
from .utils.text import slugify
clas... | ericbuckley/django-project-template | project_name/libs/common/models.py | Python | bsd-3-clause | 2,547 | 0.002356 |
# IMAP folder support
# Copyright (C) 2002-2012 John Goerzen & contributors
#
# 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) a... | spaetz/offlineimap | offlineimap/folder/IMAP.py | Python | gpl-2.0 | 33,949 | 0.004242 |
# -*- coding: utf-8 -*-
"""
Acceptance tests for CMS Video Editor.
"""
from nose.plugins.attrib import attr
from .test_studio_video_module import CMSVideoBaseTest
@attr('shard_2')
class VideoEditorTest(CMSVideoBaseTest):
"""
CMS Video Editor Test Class
"""
def setUp(self):
super(VideoEditorT... | eestay/edx-platform | common/test/acceptance/tests/video/test_studio_video_editor.py | Python | agpl-3.0 | 22,804 | 0.001114 |
# Copyright 2011 OpenStack Foundation
# 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 requ... | Thingee/cinder | cinder/tests/api/v2/test_snapshot_metadata.py | Python | apache-2.0 | 21,148 | 0.000142 |
#! /usr/bin/env python
import os
_proc_status = '/proc/%d/status' % os.getpid()
_scale = {'kB': 1024.0, 'mB': 1024.0*1024.0,
'KB': 1024.0, 'MB': 1024.0*1024.0}
def _VmB(VmKey):
'''Private.
'''
global _proc_status, _scale
# get pseudo file /proc/<pid>/status
try:
t = open(_proc_... | mattduan/proof | util/memory.py | Python | bsd-3-clause | 982 | 0.003055 |
#!usr/bin/python
'''
Get satellite data according to input file.
'''
from random import shuffle,random
import os,json
from utils.mapbox_static import MapboxStatic
from utils.coordinate_converter import CoordConvert
from modules.getFeatures import latLon,getBBox
from libs.foldernames import satDataFolder,testDataFolder
... | worldbank/cv4ag | modules/get_satellite.py | Python | mit | 4,605 | 0.044517 |
__author__ = 'yinjun'
class Solution:
"""
@param nums: The integer array
@return: The length of LIS (longest increasing subsequence)
"""
def longestIncreasingSubsequence(self, nums):
# write your code here
if nums == None or nums == []:
return 0
l = len(nums)
... | shootsoft/practice | lintcode/NineChapters/04/longest-increasing-subsequence.py | Python | apache-2.0 | 646 | 0.006192 |
import pandas as pd
import numpy as np
import cython as cy
#coding=UTF8
class Strategy(object):
_capital = cy.declare(cy.double)
_net_flows = cy.declare(cy.double)
_last_value = cy.declare(cy.double)
_last_price = cy.declare(cy.double)
_last_fee = cy.declare(cy.double)
def run(self):... | dingmingliu/quanttrade | quanttrade/core/strategy.py | Python | apache-2.0 | 1,007 | 0.017875 |
#!/usr/bin/env python
"""
Copyright (c) 2020 Alex Forencich
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, merg... | alexforencich/verilog-ethernet | tb/eth_mac_10g/test_eth_mac_10g.py | Python | mit | 9,014 | 0.000998 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-05-22 17:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wishes', '0001_squashed_0002_auto_20160522_1408'),
]
operations = [
migratio... | dvl/imagefy-web | imagefy/wishes/migrations/0002_auto_20160522_1447.py | Python | mit | 506 | 0.001976 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Luis Alejandro Martínez Faneyth
#
# This file is part of Condiment.
#
# Condiment 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 ver... | LuisAlejandro/condiment | condiment/common/setup/report.py | Python | gpl-3.0 | 2,481 | 0.003226 |
"""
Defines forms for providing validation of embargo admin details.
"""
import ipaddress
from django import forms
from django.utils.translation import ugettext as _
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from xmodule.modulestore.django import modulestore
from .models imp... | eduNEXT/edunext-platform | openedx/core/djangoapps/embargo/forms.py | Python | agpl-3.0 | 3,045 | 0.000657 |
# Author: legend
# Mail: kygx.legend@gmail.com
# File: mesos.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import argparse
import os
import re
MASTER_IP = '172.16.104.62'
MESOS_PATH = '/data/opt/mesos-1.4.0/build'
WORK_DIR = '/tmp/mesos/work_dir'
MASTER_SH = 'bin/mesos-master.sh'
WORKER_SH = 'bin/mesos-agent.sh'
d... | legendlee1314/ooni | mesos.py | Python | mit | 1,625 | 0.008 |
#OBJ2VXP: Converts simple OBJ files to VXP expansions
#Copyright (C) 2004-2015 Foone Turing
#
#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 ... | foone/7gen | bin/obj2vxpGUI.py | Python | gpl-2.0 | 6,717 | 0.056573 |
"""
Flask-EasyWebDAV
-------------
This is the description for that library
"""
from setuptools import setup
setup(
name='Flask-EasyWebDAV',
version='0.1',
url='http://github.com/ghachey/flask-easywebdav',
license='MIT',
author='Ghislain Hachey',
author_email='ghachey@outlook.com',
descrip... | ghachey/flask-easywebdav | setup.py | Python | mit | 1,092 | 0 |
#
# Copyright (c) 2016 Juniper Networks, Inc. All rights reserved.
#
"""
This file contains implementation of data model for mesos manager
"""
import json
from cfgm_common.vnc_db import DBBase
from bitstring import BitArray
from vnc_api.vnc_api import (KeyValuePair)
from mesos_manager.vnc.vnc_mesos_config import VncM... | rombie/contrail-controller | src/container/mesos-manager/mesos_manager/vnc/config_db.py | Python | apache-2.0 | 32,110 | 0.000685 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | AutorestCI/azure-sdk-for-python | azure-servicefabric/azure/servicefabric/models/update_cluster_upgrade_description.py | Python | mit | 2,832 | 0.002119 |
import unittest
import xen.xend.sxp
class test_sxp(unittest.TestCase):
def testAllFromString(self):
def t(inp, expected):
self.assertEqual(xen.xend.sxp.all_from_string(inp), expected)
t('String', ['String'])
t('(String Thing)', [['String', 'Thing']])
t('(... | YongMan/Xen-4.3.1 | tools/python/xen/xend/tests/test_sxp.py | Python | gpl-2.0 | 1,015 | 0.003941 |
from .theuerkaufPeak import PeakModelTheuerkauf
from .eePeak import PeakModelEE
# dictionary of available peak models
PeakModels = dict()
PeakModels["theuerkauf"] = PeakModelTheuerkauf
PeakModels["ee"] = PeakModelEE
| op3/hdtv | hdtv/peakmodels/__init__.py | Python | gpl-2.0 | 217 | 0 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
depends_on = (
("django_facebook", "0001_initial"),
)
def forwards(self, orm):
# Adding ... | AriMeidan/Fantasy-Knesset | votes/migrations/0001_initial.py | Python | gpl-3.0 | 10,925 | 0.008055 |
from vt_manager_kvm.communication.sfa.util.xrn import urn_to_hrn
from vt_manager_kvm.communication.sfa.trust.credential import Credential
from vt_manager_kvm.communication.sfa.trust.auth import Auth
class Start:
def __init__(self, xrn, creds, **kwargs):
hrn, type = urn_to_hrn(xrn)
valid_creds ... | ict-felix/stack | vt_manager_kvm/src/python/vt_manager_kvm/communication/sfa/methods/Start.py | Python | apache-2.0 | 471 | 0.008493 |
# -*- coding: utf-8 -*-
#
# Project of Information-Theoretic Modeling documentation build configuration file, created by
# sphinx-quickstart on Fri Dec 12 14:45:52 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present i... | assamite/itm_project | docs/source/conf.py | Python | gpl-2.0 | 8,919 | 0.006282 |
"""
Cross Site Request Forgery Middleware.
This module provides a middleware that implements protection
against request forgeries from other sites.
"""
from __future__ import unicode_literals
import logging
import re
import string
from django.conf import settings
from django.core.urlresolvers import get_callable
from... | jyotsna1820/django | django/middleware/csrf.py | Python | bsd-3-clause | 12,394 | 0.001291 |
import math
from log_parser import parse_loglines
from event_timer import add_realtimes_to_datapoint_list
class HeartBeatTimings(object):
def __init__(self, hrm_datapoint_iter):
self.samples = list(_generate_beat_samples(hrm_datapoint_iter))
def first_beat_time(self):
return self.samples[0][0]
def last_beat_... | ncleaton/njcant | njcant/hr_analysis.py | Python | mit | 4,240 | 0.027123 |
# Author: Mr_Orange <mr_orange@hotmail.it>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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 Lic... | guijomatos/SickRage | sickbeard/clients/qbittorrent_client.py | Python | gpl-3.0 | 2,391 | 0.002509 |
import json
import urllib2
# open the url and the screen name
# (The screen name is the screen name of the user for whom to return results for)
def get_data():
url = "http://api.twitter.com/1/statuses/user_timeline.json?screen_name=python"
# this takes a python object and dumps it to a string which is a JSON
# r... | anthonyndunguwanja/Anthony-Ndungu-bootcamp-17 | Day 3/http_client.py | Python | mit | 439 | 0.013667 |
"""
Base logic for pywow structures
"""
from structures import Structure, Skeleton
from .fields import *
from .main import *
from .generated import GeneratedStructure
class StructureNotFound(Exception):
pass
class StructureLoader():
wowfiles = None
@classmethod
def setup(cls):
if cls.wowfiles is None:
cls... | jleclanche/pywow | wdbc/structures/__init__.py | Python | cc0-1.0 | 1,799 | 0.033352 |
"""Conditional module is the xmodule, which you can use for disabling
some xmodules by conditions.
"""
import json
import logging
from lxml import etree
from pkg_resources import resource_string
from xmodule.x_module import XModule
from xmodule.modulestore import Location
from xmodule.seq_module import SequenceDescri... | IITBinterns13/edx-platform-dev | common/lib/xmodule/xmodule/conditional_module.py | Python | agpl-3.0 | 9,200 | 0.001413 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
# Register your models here.
from timeline.models import AlumniInfo
admin.site.register(AlumniInfo)
| csriharsha/fosswebsite | timeline/admin.py | Python | mit | 200 | 0 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-securitycenter | samples/generated_samples/securitycenter_v1_generated_security_center_update_mute_config_async.py | Python | apache-2.0 | 1,620 | 0.000617 |
__author__ = 'roy'
import logging
logger = logging.getLogger()
class TestA():
_multiprocess_can_split_ = True
def setup(self):
logger.info("I'm in setup")
def teardown(self):
logger.info("I'm in teardown")
def test1(self):
logger.info("I'm in test 1")
assert 1 == ... | taykey/nose-logpertest | tests/tests_logpertest.py | Python | apache-2.0 | 1,068 | 0.000936 |
from django.conf.urls import url
from django.contrib.admin.sites import AdminSite
from functools import update_wrapper
from templatesadmin import views as ta_views
urlpatterns = [
url(r'^$', ta_views.listing, name='templatesadmin-overview'),
url(r'^edit/(?P<path>.*)/$', ta_views.modify, name='templatesadmin-ed... | GrandComicsDatabase/django-templatesadmin | templatesadmin/urls.py | Python | bsd-3-clause | 328 | 0 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the... | jorsea/odoomrp-wip | mrp_operations_extension/models/mrp_bom.py | Python | agpl-3.0 | 4,254 | 0 |
# Copyright (C) 2013 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | mxOBS/deb-pkg_trusty_chromium-browser | third_party/WebKit/Source/bindings/scripts/idl_definitions.py | Python | bsd-3-clause | 38,904 | 0.001954 |
'''Package for Banded Min Hash based Similarity Calculations'''
from min_hash import *
| ClickSecurity/data_hacking | data_hacking/min_hash/__init__.py | Python | mit | 87 | 0 |
import os
import sys
try:
import cPickle as _pickle
except ImportError:
import pickle as _pickle
if sys.version_info[0] == 2:
bytes = str
pathjoin = os.path.join
pathexists = os.path.exists
expanduser = os.path.expanduser
abspath = os.path.abspath
dirname = os.path.dirname
def pickle(value):
return ... | gmflanagan/waterboy | waterboy/utils.py | Python | bsd-3-clause | 941 | 0.005313 |
# -*- 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 typing ... | petrjasek/superdesk-core | superdesk/metadata/item.py | Python | agpl-3.0 | 24,541 | 0.001589 |
#!/usr/bin/env python
# coding: utf-8
import unittest
import sys
import os
PROJECT_PATH = os.path.sep.join(os.path.abspath(__file__).split(os.path.sep)[:-2])
ROOT_PATH = os.path.dirname(__file__)
if __name__ == '__main__':
if 'GAE_SDK' in os.environ:
SDK_PATH = os.environ['GAE_SDK']
sys.path.in... | renzon/blob_app | test/testloader.py | Python | mit | 630 | 0.001587 |
from .plotter import *
| brain-research/mirage-rl-qprop | rllab/plotter/__init__.py | Python | mit | 23 | 0 |
# Copyright 2015 Huawei Technologies Co., Ltd.
# 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
#
# Un... | ityaptin/ceilometer | ceilometer/tests/unit/api/test_hooks.py | Python | apache-2.0 | 1,354 | 0 |
""" Views for a student's profile information. """
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.staticfiles.storage import staticfiles_storage
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
from django... | miptliot/edx-platform | lms/djangoapps/student_profile/views.py | Python | agpl-3.0 | 4,548 | 0.003518 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
from webnotes.utils import flt, cstr
from webnotes import msgprint
from webnotes.model.controller import DocListController
status_m... | saurabh6790/med_app_rels | controllers/status_updater.py | Python | agpl-3.0 | 8,752 | 0.035078 |
"""renaming Jan COPE to Feb
Revision ID: 942d61446bfa
Revises: 99fb6b79b5f7
Create Date: 2021-01-18 13:37:50.121134
"""
from alembic import op
import sqlalchemy as sa
import rdr_service.model.utils
from sqlalchemy.dialects import mysql
from rdr_service.participant_enums import PhysicalMeasurementsStatus, Questionnai... | all-of-us/raw-data-repository | rdr_service/alembic/versions/942d61446bfa_renaming_jan_cope_to_feb.py | Python | bsd-3-clause | 3,082 | 0.004867 |
"""Auto-generated file, do not edit by hand. FO metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_FO = PhoneMetadata(id='FO', country_code=298, international_prefix='00',
general_desc=PhoneNumberDesc(national_number_pattern='[2-9]\\d{5}', possible_number_pattern='\... | titansgroup/python-phonenumbers | python/phonenumbers/data/region_FO.py | Python | apache-2.0 | 1,769 | 0.008479 |
import os
import sys
from setuptools import setup
# Utility function to read the README file.
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
# The argparse module was introduced in python 2.7 or python 3.2
REQUIRES = ["argparse"] if sys.version[:3] in ('2.6', '3.0', '3.1') els... | musically-ut/seqfile | setup.py | Python | mit | 1,646 | 0.031592 |
# -*- coding: utf-8 -*-
# Python stdlib
import unittest
# Unit tests
from unit_tests.test_tfstate import test_base, test_provider
def suite():
suite = unittest.TestSuite()
suite.addTests(test_base.suite())
suite.addTests(test_provider.suite())
return suite
if __name__ == '__main__':
unittest.Te... | rodynnz/python-tfstate | unit_tests/test_tfstate/__init__.py | Python | lgpl-3.0 | 359 | 0.002786 |
# pib.py - functions for handling Serbian VAT numbers
# coding: utf-8
#
# Copyright (C) 2017 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the L... | arthurdejong/python-stdnum | stdnum/rs/pib.py | Python | lgpl-2.1 | 1,963 | 0 |
"""
Urls for idea app
"""
from django.conf.urls import url
from openedx.features.idea.api_views import FavoriteAPIView
from openedx.features.idea.views import ChallengeLandingView, IdeaCreateView, IdeaDetailView, IdeaListingView
urlpatterns = [
url(
r'^overview/$',
ChallengeLandingView.as_view(),
... | philanthropy-u/edx-platform | openedx/features/idea/urls.py | Python | agpl-3.0 | 799 | 0.001252 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from gaebusiness.gaeutil import SaveCommand, ModelSearchCommand
from gaeforms.ndb.form import ModelForm
from gaegraph.business_base import UpdateNode
from course_app.model import Course
class CourseForm(ModelForm):
"""
Form used ... | gamunax/pyhtongamunax | backend/apps/course_app/commands.py | Python | mit | 1,665 | 0.007207 |
from cStringIO import StringIO
from json.tests import PyTest, CTest
class TestDump(object):
def test_dump(self):
sio = StringIO()
self.json.dump({}, sio)
self.assertEqual(sio.getvalue(), '{}')
def test_dumps(self):
self.assertEqual(self.dumps({}), '{}')
def test_encode_tr... | ArneBab/pypyjs | website/demo/home/rfk/repos/pypy/lib-python/2.7/json/tests/test_dump.py | Python | mit | 738 | 0.004065 |
# Copyright 2012 OpenStack Foundation
# 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 requ... | danielmellado/tempest | tempest/api/compute/floating_ips/test_list_floating_ips_negative.py | Python | apache-2.0 | 1,698 | 0 |
__all__ = [ "command_statistics", "json_reader", "mongo", "sata", "xgig" ]
| LoneKirov/PyTrace | pytrace/__init__.py | Python | bsd-3-clause | 78 | 0.025641 |
#@TODO: Support for html parsing!!
import sys
try:
from colorama import init, Fore, Back, Style
colorama = True
except ImportError:
colorama = False
__all__ = ["console"]
class Console:
def __init__(self):
self.reset()
self.color = False
def set_color(self, color):
self.... | BackupGGCode/pkgcreator | pkgcreator/PkgCreator/console.py | Python | gpl-3.0 | 2,947 | 0.003054 |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def findTilt(self, root):
"""
:type root: TreeNode
:rtype: int
"""
def dfs(root):... | zqfan/leetcode | algorithms/563. Binary Tree Tilt/solution.py | Python | gpl-3.0 | 585 | 0 |
###########################################################################
#
# Support code for the 'psyco.compact' type.
from __future__ import generators
try:
from UserDict import DictMixin
except ImportError:
# backported from Python 2.3 to Python 2.2
class DictMixin:
# Mixin def... | Southpaw-TACTIC/Team | src/python/Lib/site-packages/psyco/kdictproxy.py | Python | epl-1.0 | 4,502 | 0.00422 |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | yk5/incubator-airflow | airflow/api/common/experimental/mark_tasks.py | Python | apache-2.0 | 8,610 | 0.000697 |
def save_bacteria_dna():
"""
0 = A,
1 = T,
2 = C,
3 = G
footnote:
>>>ord('c')
99
>>>chr(97)
'c'
same unichr() command
"""
char_list = []
binary_list = []
request_word = raw_input("Please enter the word,"
... | dogancankilment/UnixTools | utils/biology/storage_in_bacterias.py | Python | gpl-2.0 | 2,800 | 0.000357 |
import unittest
import asyncio
import aiozmq
import aiozmq.rpc
import logging
from unittest import mock
from asyncio.test_utils import run_briefly
from aiozmq._test_util import log_hook, RpcMixin
class MyHandler(aiozmq.rpc.AttrHandler):
def __init__(self, queue, loop):
self.queue = queue
self.lo... | MetaMemoryT/aiozmq | tests/rpc_pipeline_test.py | Python | bsd-2-clause | 8,374 | 0.000239 |
"""Jinja2's i18n functionality is not exactly the same as Django's.
In particular, the tags names and their syntax are different:
1. The Django ``trans`` tag is replaced by a _() global.
2. The Django ``blocktrans`` tag is called ``trans``.
(1) isn't an issue, since the whole ``makemessages`` process is based on
... | akx/coffin | coffin/management/commands/makemessages.py | Python | bsd-3-clause | 2,126 | 0.000941 |
# -*- coding: utf-8 -*-
import logging
import re
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from PIL import Image
from urllib.request import urlopen
from urllib.parse import urlencode
import json
from bs4 import BeautifulSoup, element
from datetime import datetime, timedelta
from waybackscraper.... | abrenaut/mrot | mrot/imdb.py | Python | mit | 6,223 | 0.002732 |
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
# Copyright (C) 2011 Lukáš Lalinský
#
# 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... | mwiencek/picard | picard/ui/options/fingerprinting.py | Python | gpl-2.0 | 3,809 | 0.001576 |
from pymongo import MongoClient
from vaderSentiment.vaderSentiment import sentiment as vs
import os
# File for writing sentiment for storage and analysis
__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))
outputFile = "sentiment.json"
f = open(os.path.join(__location__, outputFile), ... | kearnsw/Twitt.IR | src/VaderSentiment.py | Python | gpl-3.0 | 1,714 | 0.001167 |
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
class Unity3DPipeline(object):
def process_item(self, item, spider):
return item
| TheWaWaR/scrapy-snippets | projects/unity3d/unity3d/pipelines.py | Python | mit | 261 | 0 |
import rcblog
if __name__ == '__main__':
rcblog.main()
| sanchopanca/rcblog | run.py | Python | mit | 60 | 0 |
import os
import sys
from django.conf import settings
if not settings.configured:
settings_dict = dict(
INSTALLED_APPS=(
#'django.contrib.contenttypes',
'inspector_panel',
'inspector_panel.tests',
),
DATABASES={
"default": {
... | NESCent/feedingdb | debug-inspector-panel/runtests.py | Python | gpl-3.0 | 808 | 0.001238 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.