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 |
|---|---|---|---|---|---|---|
# Copyright 2014 Mellanox Technologies, Ltd
#
# 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 t... | silenci/neutron | neutron/plugins/ml2/drivers/mech_sriov/agent/sriov_nic_agent.py | Python | apache-2.0 | 17,661 | 0.001019 |
from conn import Connection
import dispatch
import socket
class Acceptor(Connection):
def __init__(self, port):
self.dispatcher = dispatch.Dispatch(1)
self.dispatcher.start()
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
self.sock.bind(("127.0.0.1", port))
... | chimmu/hailuo | acceptor.py | Python | gpl-2.0 | 474 | 0.006329 |
from flask import Flask
from flask.ext.script import Manager
app = Flask(__name__)
manager = Manager(app)
@app.route('/')
def index():
return '<h1>Hello World!</h1>'
@app.route('/user/<name>')
def user(name):
return '<h1>Hello, {name}!</h1>'.format(**locals())
if __name__ == '__main__':
manager.run() | xuehao/stickpython | Flask_Web_Development/chapter_02/2c/hello_2c.py | Python | mit | 320 | 0.003125 |
#
# Copyright (c) 2017 Sugimoto Takaaki
#
# 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 i... | sugimotokun/VirtualCurrencySplunk | bin/scripts/vc_usd_nt.py | Python | apache-2.0 | 1,321 | 0.004542 |
# 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... | tanglei528/nova | nova/tests/api/openstack/compute/contrib/test_simple_tenant_usage.py | Python | apache-2.0 | 19,168 | 0.000313 |
#!/usr/bin/env python3
"""
This housekeeping script reads a GFF3 file and writes a new one, adding a 'gene'
row for any RNA feature which doesn't have one. The coordinates of the RNA will
be copied.
The initial use-case here was a GFF file dumped from WebApollo which had this issue.
In this particular use case, the... | jorvis/biocode | sandbox/jorvis/correct_RNAs_missing_genes.py | Python | mit | 2,324 | 0.009897 |
import numpy as np
from numpy.testing import assert_equal, assert_array_equal
from scipy.stats import rankdata, tiecorrect
class TestTieCorrect(object):
def test_empty(self):
"""An empty array requires no correction, should return 1.0."""
ranks = np.array([], dtype=np.float64)
c = tiecor... | aeklant/scipy | scipy/stats/tests/test_rank.py | Python | bsd-3-clause | 7,448 | 0.000403 |
import logging
from ...engines.light import SimEngineLight
from ...errors import SimEngineError
l = logging.getLogger(name=__name__)
class SimEnginePropagatorBase(SimEngineLight): # pylint:disable=abstract-method
def __init__(self, stack_pointer_tracker=None, project=None):
super().__init__()
... | iamahuman/angr | angr/analyses/propagator/engine_base.py | Python | bsd-2-clause | 1,026 | 0.001949 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import unittest
import frappe
from frappe.utils import flt, get_datetime
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_p... | gangadhar-kadam/verve_test_erp | erpnext/manufacturing/doctype/production_order/test_production_order.py | Python | agpl-3.0 | 5,084 | 0.023013 |
import numpy as np
import cv2
from matplotlib import pylab as plt
# Ref: http://www.pyimagesearch.com/2015/07/16/where-did-sift-and-surf-go-in-opencv-3/
picNumber = 1
filename = "/home/cwu/project/stereo-calibration/calib_imgs/3/left/left_" + str(picNumber) +".jpg"
img = cv2.imread(filename)
gray = cv2.cvtColor(im... | chaowu2009/stereo-vo | tools/test_ORB.py | Python | mit | 621 | 0.022544 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import mezzanine.core.fields
class Migration(migrations.Migration):
dependencies = [
('pages', '__first__'),
]
operations = [
migrations.CreateModel(
name='Gallery',
... | christianwgd/mezzanine | mezzanine/galleries/migrations/0001_initial.py | Python | bsd-2-clause | 1,889 | 0.004235 |
# -*- coding: utf-8 -*-
from wikitools.api import APIRequest
from wikitools.wiki import Wiki
from wikitools.page import Page
from urllib2 import quote
pairs = [
['"', '"'],
['(', ')'],
['[', ']'],
['{', '}'],
['<!--', '-->'],
['<', '>'],
['<gallery', '</gallery>'],
['<includeonly>', '</includeonly>'],
... | jbzdarkid/Random | mismatched.py | Python | apache-2.0 | 1,737 | 0.011514 |
'''
Created on Jun 6, 2012
@author: vr274
'''
import numpy as np
from generic import TakestepSlice, TakestepInterface
from pele.utils import rotations
__all__ = ["RandomDisplacement", "UniformDisplacement",
"RotationalDisplacement", "RandomCluster"]
class RandomDisplacement(TakestepSlice):
'''Random... | js850/pele | pele/takestep/displace.py | Python | gpl-3.0 | 2,126 | 0.01317 |
import _plotly_utils.basevalidators
class SizemodeValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self, plotly_name="sizemode", parent_name="scatterpolar.marker", **kwargs
):
super(SizemodeValidator, self).__init__(
plotly_name=plotly_name,
pa... | plotly/python-api | packages/python/plotly/plotly/validators/scatterpolar/marker/_sizemode.py | Python | mit | 537 | 0.001862 |
#!/usr/bin/python
# $Id:$
from base import Display, Screen, ScreenMode, Canvas
from pyglet.libs.win32 import _kernel32, _user32, types, constants
from pyglet.libs.win32.constants import *
from pyglet.libs.win32.types import *
class Win32Display(Display):
def get_screens(self):
screens = []
def en... | joaormatos/anaconda | Anaconda/pyglet/canvas/win32.py | Python | gpl-3.0 | 3,404 | 0.00235 |
import re
import sys
def is_self_describing(n):
for i in range(len(n)):
c = n[i]
if int(c) != len(re.findall(str(i), n)):
return False
return True
with open(sys.argv[1], 'r') as fh:
for line in fh.readlines():
line = line.strip()
if line == '':
con... | cadyyan/codeeval | python/40_self_describing_numbers.py | Python | gpl-3.0 | 379 | 0.007916 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_rebel_brigadier_general_rodian_female_01.iff"
result.a... | anhstudios/swganh | data/scripts/templates/object/mobile/shared_dressed_rebel_brigadier_general_rodian_female_01.py | Python | mit | 476 | 0.046218 |
from app import db
from app.model import DirectionStatistic
import random
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.figure import Figure
def create_range_figure2(sender_id):
fig = Figure()
axis = fig.add_subplot(1, 1, 1)
xs = range(100)
ys = [random.randint(1, 50) for x in xs]... | glidernet/ogn-python | app/main/matplotlib_service.py | Python | agpl-3.0 | 1,400 | 0.002857 |
# coding: utf-8
#
# Copyright 2014 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | souravbadami/oppia | core/domain/visualization_registry.py | Python | apache-2.0 | 2,447 | 0 |
__all__ = [
"getMin"
]
__doc__ = "Different algorithms used for optimization"
import Optizelle.Unconstrained.State
import Optizelle.Unconstrained.Functions
from Optizelle.Utility import *
from Optizelle.Properties import *
from Optizelle.Functions import *
def getMin(X, msg, fns, state, smanip=None):
"""Solv... | OptimoJoe/Optizelle | src/python/Optizelle/Unconstrained/Algorithms.py | Python | bsd-2-clause | 863 | 0.011587 |
# Copyright 2020 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/timesketch | api_client/python/timesketch_api_client/user.py | Python | apache-2.0 | 3,300 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
class Options:
def __init__(self):
self.color = "black"
self.verbose = False
pass
| LaurentCabaret/pyVhdl2Sch | tools/tools.py | Python | bsd-2-clause | 177 | 0 |
# -*- coding: utf-8 -*-
import csv
import datetime
import os
import shutil
import json
from django.http import Http404
from django.test.client import RequestFactory
import mock
from pyquery import PyQuery as pq
from olympia import amo
from olympia.amo.tests import TestCase
from olympia.amo.urlresolvers import revers... | Prashant-Surya/addons-server | src/olympia/stats/tests/test_views.py | Python | bsd-3-clause | 38,979 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('core', '0015_auto_20150928_0850'),
]
... | hultberg/ppinnlevering | core/migrations/0016_auto_20151001_0714.py | Python | apache-2.0 | 843 | 0.001186 |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | gunan/tensorflow | tensorflow/python/keras/layers/preprocessing/discretization.py | Python | apache-2.0 | 4,879 | 0.005329 |
# The contents of this file are subject to the BitTorrent Open Source License
# Version 1.1 (the License). You may not copy or use this file, in either
# source code or executable form, except in compliance with the License. You
# may obtain a copy of the License at http://www.bittorrent.com/license/.
#
# Software di... | rays/ipodderx-core | khashmir/khash.py | Python | mit | 3,533 | 0.01019 |
"""
ex_compound_nomo_1.py
Compound nomograph: (A+B)/E=F/(CD)
Copyright (C) 2007-2009 Leif Roschier
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 L... | dbaynard/pynomo | examples/ex_compound_nomo_1.py | Python | gpl-3.0 | 4,466 | 0.031572 |
from django.contrib import admin
from general.models import StaticPage
admin.site.register(StaticPage) | Gargamel1989/Seasoning-old | Seasoning/general/admin.py | Python | gpl-3.0 | 103 | 0.009709 |
import sys
from Bio import SeqIO
SNPTOPEAKFILENAME = sys.argv[1]
GENOMEFILENAME = sys.argv[2]
DISTANCE = int(sys.argv[3])
BINDALLELESEQFILENAME = sys.argv[4]
NONBINDALLELEFILENAME = sys.argv[5]
FIRSTPEAKCOL = int(sys.argv[6]) # 0-INDEXED
def getSNPInfo(SNPToPeakLine):
# Get the SNP and peak location from ... | imk1/IMKTFBindingCode | getSequencesForSNPs.py | Python | mit | 2,698 | 0.021497 |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 2.0.10
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
"""
This documentation was automatically generated using original comments in
Doxygen format. As some C types and d... | matbra/radio_fearit | build/lib/python3.3/site-packages/pocketsphinx-0.0.9-py3.3-linux-x86_64.egg/pocketsphinx/pocketsphinx.py | Python | gpl-3.0 | 17,246 | 0.010495 |
from pagarme import card
from pagarme import plan
from tests.resources import pagarme_test
from tests.resources.dictionaries import card_dictionary
from tests.resources.dictionaries import customer_dictionary
from tests.resources.dictionaries import plan_dictionary
from tests.resources.dictionaries import transaction_d... | pagarme/pagarme-python | tests/resources/dictionaries/subscription_dictionary.py | Python | mit | 1,513 | 0 |
#
# This file is part of pyasn1-modules software.
#
# Created by Russ Housley
# Copyright (c) 2019, Vigil Security, LLC
# License: http://snmplabs.com/pyasn1/license.html
#
import sys
import unittest
from pyasn1.codec.der.decoder import decode as der_decoder
from pyasn1.codec.der.encoder import encode as der_encoder
f... | etingof/pyasn1-modules | tests/test_rfc7292.py | Python | bsd-2-clause | 8,295 | 0.000362 |
# You are climbing a stair case. It takes n steps to reach to the top.
#
# Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
#
# Note: Given n will be a positive integer.
#
# Example 1:
#
# Input: 2
# Output: 2
# Explanation: There are two ways to climb to the top.
# 1. ... | jigarkb/CTCI | LeetCode/070-E-ClimbingStairs.py | Python | mit | 877 | 0.00114 |
from django.http import HttpResponse
def hello_world(request):
return HttpResponse("Hello, world.") | xyloeric/pi | piExp/pi/views.py | Python | bsd-3-clause | 101 | 0.029703 |
#-*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import print_function
import sys
if sys.version_info[0] == 2:
reload(sys)
sys.setdefaultencoding('utf-8')
from . import config
from . import parsers
def main():
if len(sys.argv) == 2:
filename = sys.argv[1]
fi... | if1live/easylinker | easylinker/cli.py | Python | mit | 658 | 0.004559 |
# Copyright 2018 Red Hat, 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... | masayukig/tempest | tempest/api/image/v2/admin/test_images.py | Python | apache-2.0 | 2,341 | 0 |
"""
File: DaqDevDiscovery01.py
Library Call Demonstrated: mcculw.ul.get_daq_device_inventory()
mcculw.ul.create_daq_device()
mcculw.ul.release_daq_device()
Purpose: Discovers DAQ devices and assigns board number to
... | mccdaq/mcculw | examples/ui/DaqDevDiscovery01.py | Python | mit | 5,694 | 0 |
from django.db.models import Q
from django_filters import rest_framework as filters
from adesao.models import SistemaCultura, UFS
from planotrabalho.models import Componente
class SistemaCulturaFilter(filters.FilterSet):
ente_federado = filters.CharFilter(
field_name='ente_federado__nome__unaccent', loo... | culturagovbr/sistema-nacional-cultura | apiv2/filters.py | Python | agpl-3.0 | 6,975 | 0.001434 |
"""
Various data structures used in query construction.
Factored out from django.db.models.query to avoid making the main module very
large and/or so that they can be used by other modules without getting into
circular import difficulties.
"""
from __future__ import unicode_literals
import inspect
from coll... | yephper/django | django/db/models/query_utils.py | Python | bsd-3-clause | 13,827 | 0.000579 |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | googleinterns/audio_synthesis | experiments/representation_study/train_spec_gan.py | Python | apache-2.0 | 3,424 | 0.003505 |
#
# 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... | spektom/incubator-airflow | airflow/providers/google/marketing_platform/operators/search_ads.py | Python | apache-2.0 | 7,440 | 0.00121 |
from fruits import validate_fruit
fruits = ["banana", "lemon", "apple", "orange", "batman"]
print fruits
def list_fruits(fruits, byName=True):
if byName:
# WARNING: this won't make a copy of the list and return it. It will change the list FOREVER
fruits.sort()
for index, fruit in enumerate... | Painatalman/python101 | sources/101_test.py | Python | apache-2.0 | 519 | 0.003854 |
#!/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... | epssy/hue | desktop/libs/libzookeeper/src/libzookeeper/models.py | Python | apache-2.0 | 1,274 | 0.007064 |
#!/usr/bin/env python
# Copyright (c) 2010-2013 by Yaco Sistemas <goinnn@gmail.com> or <pmartin@yaco.es>
#
# This program 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 License... | tlevine/django-inplaceedit | testing/run_tests.py | Python | lgpl-3.0 | 1,189 | 0.000841 |
# 每个人都有一个preference的排序,在不违反每个人的preference的情况下得到总体的preference的排序 拓扑排序解决(https://instant.1point3acres.com/thread/207601)
import itertools
import collections
def preferenceList1(prefList): # topological sort 1
pairs = []
for lis in prefList:
for left, right in zip(lis, lis[1:]):
pairs += (left... | seanxwzhang/LeetCode | Airbnb/preference_list.py | Python | mit | 788 | 0.007003 |
import pytest
from api.base.settings.defaults import API_BASE
from osf_tests.factories import (
ProjectFactory,
AuthUserFactory,
PrivateLinkFactory,
)
from osf.utils import permissions
@pytest.fixture()
def admin():
return AuthUserFactory()
@pytest.fixture()
def base_url():
return '/{}nodes/'.fo... | pattisdr/osf.io | api_tests/nodes/views/test_view_only_query_parameter.py | Python | apache-2.0 | 15,854 | 0.000442 |
from io import BytesIO
import sys
from mitmproxy.net import wsgi
from mitmproxy.net.http import Headers
def tflow():
headers = Headers(test=b"value")
req = wsgi.Request("http", "GET", "/", "HTTP/1.1", headers, "")
return wsgi.Flow(("127.0.0.1", 8888), req)
class ExampleApp:
def __init__(self):
... | mosajjal/mitmproxy | test/mitmproxy/net/test_wsgi.py | Python | mit | 3,186 | 0.000942 |
# Copyright (c) 2014 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the License);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... | mgrygoriev/CloudFerry | cloudferrylib/os/actions/transport_ephemeral.py | Python | apache-2.0 | 7,851 | 0 |
"""
Weather Underground PWS Metadata Scraping Module
Code to scrape PWS network metadata
"""
import pandas as pd
import urllib3
from bs4 import BeautifulSoup as BS
import numpy as np
import requests
# import time
def scrape_station_info(state="WA"):
"""
A script to scrape the station information published ... | rexthompson/axwx | axwx/wu_metadata_scraping.py | Python | mit | 5,613 | 0 |
"""
This page is in the table of contents.
Export is a craft tool to pick an export plugin, add information to the file name, and delete comments.
The export manual page is at:
http://fabmetheus.crsndoo.com/wiki/index.php/Skeinforge_Export
==Operation==
The default 'Activate Export' checkbox is on. When it is on, th... | nophead/Skeinforge50plus | skeinforge_application/skeinforge_plugins/craft_plugins/export.py | Python | agpl-3.0 | 20,837 | 0.017853 |
import logging
import os
import shutil
import subprocess
DEVNULL = open(os.devnull, 'wb')
class ShellError(Exception):
def __init__(self, command, err_no, message=None):
self.command = command
self.errno = err_no
self.message = message
def __str__(self):
string = "Command '%s... | ModernMT/MMT | cli/utils/osutils.py | Python | apache-2.0 | 2,402 | 0.001665 |
import numpy
from chainer.backends import cuda
from chainer import optimizer
_default_hyperparam = optimizer.Hyperparameter()
_default_hyperparam.lr = 0.01
_default_hyperparam.alpha = 0.99
_default_hyperparam.eps = 1e-8
_default_hyperparam.eps_inside_sqrt = False
class RMSpropRule(optimizer.UpdateRule):
"""Up... | rezoo/chainer | chainer/optimizers/rmsprop.py | Python | mit | 4,921 | 0 |
"""
Kodi urlresolver plugin
Copyright (C) 2016 tknorris
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... | TheWardoctor/Wardoctors-repo | script.module.urlresolver/lib/urlresolver/plugins/tudou.py | Python | apache-2.0 | 2,082 | 0.004803 |
import warnings
from .file import File, open, read, create, write, CfitsioError
try:
from healpix import read_map, read_mask
except:
warnings.warn('Cannot import read_map and read_mask if healpy is not installed')
pass
| zonca/pycfitsio | pycfitsio/__init__.py | Python | gpl-3.0 | 234 | 0.012821 |
### Copyright (C) 2010 Peter Williams <peter_ono@users.sourceforge.net>
###
### 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; version 2 of the License only.
###
### This program is distribut... | pwil3058/darning | darning/cli/subcmd_select.py | Python | gpl-2.0 | 1,953 | 0.00768 |
# Copyright 2020 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | mahak/neutron | neutron/privileged/agent/linux/__init__.py | Python | apache-2.0 | 1,208 | 0 |
try:
#comment
x = 1<caret>
y = 2
except:
pass | asedunov/intellij-community | python/testData/refactoring/unwrap/tryUnwrap_before.py | Python | apache-2.0 | 61 | 0.081967 |
# -*- coding: utf-8 -*-
# Author: Mikhail Polyanskiy
# Last modified: 2017-04-02
# Original data: Djurišić and Li 1999, https://doi.org/10.1063/1.369370
import numpy as np
import matplotlib.pyplot as plt
# LD model parameters - Normal polarization (ordinary)
ωp = 27
εinf = 1.070
f0 = 0.014
Γ0 = 6.365
ω0 = 0
... | polyanskiy/refractiveindex.info-scripts | scripts/Djurisic 1999 - Graphite-o.py | Python | gpl-3.0 | 2,735 | 0.025077 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-01 15:57
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pec', '0006_auto_20170601_0719'),
]
operations = [
migrations.AddField(
... | alazo/ase | pec/migrations/0007_auto_20170601_1557.py | Python | agpl-3.0 | 653 | 0.001531 |
# -*- coding:utf-8 -*-
from django import forms
try:
from django.utils.encoding import smart_unicode as smart_text
except ImportError:
from django.utils.encoding import smart_text
from cached_modelforms.tests.utils import SettingsTestCase
from cached_modelforms.tests.models import SimpleModel
from cached_mode... | drtyrsa/django-cached-modelforms | cached_modelforms/tests/test_fields.py | Python | bsd-2-clause | 6,699 | 0.001941 |
# coding: utf-8
import copy
from google.appengine.ext import ndb
import flask
from apps import auth
from apps.auth import helpers
from core import task
from core import util
import config
import forms
import models
bp = flask.Blueprint(
'user',
__name__,
url_prefix='/user',
template_folder='templates... | gmist/gae-de-init | main/apps/user/views.py | Python | mit | 7,664 | 0.010569 |
from django.conf import settings
from geopy import distance, geocoders
import pygeoip
def get_geodata_by_ip(addr):
gi = pygeoip.GeoIP(settings.GEO_CITY_FILE, pygeoip.MEMORY_CACHE)
geodata = gi.record_by_addr(addr)
return geodata
def get_geodata_by_region(*args):
gn = geocoders.GeoNames()
retu... | iuscommunity/dmirr | src/dmirr.hub/dmirr/hub/lib/geo.py | Python | gpl-2.0 | 735 | 0.013605 |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/admin/modules_handler.py | Python | bsd-3-clause | 934 | 0.001071 |
def isPrime(num):
if num <= 1:
return False
i = 2
while i < num / 2 + 1:
if num % i == 0:
return False
i += 1
return True
big = 600851475143
test = 1
while test < big:
test += 1
if big % test == 0:
print(test, ' divides evenly')
div = big / t... | rck109d/projectEuler | src/euler/p3.py | Python | lgpl-3.0 | 433 | 0 |
#!/usr/bin/python3
from scrapers.scrape import scrape_page
# if you want to use this scraper without the RESTful api webservice then
# change this import: from scrape import scrape_page
import re
try:
import pandas as pd
pandasImported = True
except ImportError:
pandasImported = False
BASE_URL = "http://... | ajpotato214/Finance-Data-Scraper-API | finance_data_scraper/scrapers/finviz.py | Python | mit | 4,390 | 0.0082 |
from w3lib.html import remove_tags
from requests import session, codes
from bs4 import BeautifulSoup
# Net/gross calculator for student under 26 years
class Student:
_hours = 0
_wage = 0
_tax_rate = 18
_cost = 20
def __init__(self, hours, wage, cost):
self._hours = hours
... | tomekby/miscellaneous | jira-invoices/calculator.py | Python | mit | 6,443 | 0.003889 |
import logging; logger = logging.getLogger("morse." + __name__)
import socket
import select
import json
import morse.core.middleware
from functools import partial
from morse.core import services
class MorseSocketServ:
def __init__(self, port, component_name):
# List of socket clients
self._client_s... | Arkapravo/morse-0.6 | src/morse/middleware/socket_mw.py | Python | bsd-3-clause | 6,797 | 0.00206 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('interpreter', '0010_auto_20141215_0027'),
]
operations = [
migrations.RemoveField(
model_name='band',
... | nanomolina/MusicWeb | src/Music/apps/interpreter/migrations/0011_auto_20141215_0030.py | Python | mit | 600 | 0.001667 |
#
# SPDX-FileCopyrightText: 2016 Dmytro Kolomoiets <amerlyq@gmail.com> and contributors.
#
# SPDX-License-Identifier: GPL-3.0-only
#
from miur.cursor import state, update, message as msg
class Dispatcher:
"""Apply actions to any unrelated global states"""
def _err_wrong_cmd(self):
# Move err processi... | miur/miur | OLD/miur/cursor/dispatch.py | Python | gpl-3.0 | 1,733 | 0.000577 |
#!/usr/bin/env python
#encoding:utf8
#
# file: filter6_tests.py
# author: sl0
# date: 2013-03-06
#
import unittest
from adm6.filter6 import IP6_Filter, Ip6_Filter_Rule
from sys import stdout
from os.path import expanduser as homedir
from ipaddr import IPv6Network
from os import getenv as get_env
home_dir_replac... | sl0/adm6 | tests/test_03_filter6.py | Python | gpl-3.0 | 102,052 | 0.003439 |
"""
Classes and functions for interacting with system management daemons.
arkOS Core
(c) 2016 CitizenWeb
Written by Jacob Cook
Licensed under GPLv3, see LICENSE.md
"""
import ldap
import ldap.modlist
import xmlrpc.client
from .utilities import errors
from dbus import SystemBus, Interface
class ConnectionsManager:... | pomarec/core | arkos/connections.py | Python | gpl-3.0 | 3,011 | 0 |
"""Commands for argparse for basket command"""
import textwrap
from PyBake import Path
from PyBake.commands import command
@command("basket")
class BasketModuleManager:
"""Module Manager for Basket"""
longDescription = textwrap.dedent(
"""
Retrieves pastries from the shop.
""")
def createArguments(self... | lab132/PyBake | PyBake/commands/basketCommand.py | Python | mit | 1,990 | 0.009045 |
#! /usr/bin/python3
#
# This source code is part of icgc, an ICGC processing pipeline.
#
# Icgc 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 ... | ivanamihalek/tcga | icgc/60_nextgen_production/65_reactome_tree.py | Python | gpl-3.0 | 5,057 | 0.024916 |
# Copyright 2014 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.
import fnmatch
import imp
import logging
import modulefinder
import optparse
import os
import sys
import zipfile
from telemetry import benchmark
from teleme... | chromium2014/src | tools/telemetry/telemetry/util/find_dependencies.py | Python | bsd-3-clause | 9,256 | 0.010372 |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# This file is part of Guadalinex
#
# This software 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, ... | rcmorano/gecosws-config-assistant | firstboot/serverconf/ServerConf.py | Python | gpl-2.0 | 5,970 | 0.00067 |
# -*- coding: utf-8 -*-
#############################
# Light IMDb Ratings Update #
# by axlt2002 #
#############################
# changes by dziobak #
#############################
import xbmc, xbmcgui
import sys
if sys.version_info >= (2, 7): import json as jSon
else: import simplejson as jSon... | axlt2002/script.light.imdb.ratings.update | resources/core/update_main.py | Python | gpl-3.0 | 10,373 | 0.050998 |
"""
Settings for Bok Choy tests that are used when running LMS.
Bok Choy uses two different settings files:
1. test_static_optimized is used when invoking collectstatic
2. bok_choy is used when running the tests
Note: it isn't possible to have a single settings file, because Django doesn't
support both generating sta... | fintech-circle/edx-platform | lms/envs/bok_choy.py | Python | agpl-3.0 | 8,553 | 0.002923 |
import os
ADDRESS = '127.0.0.1'
PORT = 12345
BACKUP_DIR = 'Backup'
BASE_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')
| gonczor/ServerPy | Setup/settings.py | Python | gpl-2.0 | 142 | 0 |
import os
import requests
if __name__ == "__main__":
session = requests.Session()
data = {"email": "admin@knex.com", "password": "admin"}
session.post("http://localhost:5000/api/users/login", data=data)
for file in os.listdir("."):
if file.endswith(".json"):
text = open(file, "r")... | Drakulix/knex | evalData/testdata_insertion.py | Python | mit | 897 | 0.00223 |
# -*- coding: utf-8 -*-
"""
werkzeug.wrappers
~~~~~~~~~~~~~~~~~
The wrappers are simple request and response objects which you can
subclass to do whatever you want them to do. The request object contains
the information transmitted by the client (webbrowser) and the response
object contains al... | danimajo/pineapple_pdf | werkzeug/wrappers.py | Python | mit | 76,131 | 0.000276 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2013 University of Dundee & Open Microscopy Environment
# All Rights Reserved.
#
# 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 Foundat... | sbesson/snoopycrimecop | test/integration/Sandbox.py | Python | gpl-2.0 | 5,211 | 0 |
from django.conf import settings
from images.models import S3Connection
from shutil import copyfileobj
import tinys3
import os
import urllib
class LocalStorage(object):
def __init__(self, filename):
self.filename = filename
def get_file_data(self):
"""
Returns the raw data for the spec... | sokanu/frame | images/storage.py | Python | mit | 3,547 | 0.004229 |
import os
import uuid
from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User
def avatar_upload(instance, filename):
ext = filename.split(".")[-1]
filename = "%s.%s" % (uuid.uuid4(), ext)
return os.path.join("avatars", filename)
class Profile(models.M... | new-player/share_projects | share_projects/profiles/models.py | Python | mit | 1,201 | 0.000833 |
#!/usr/bin/python
from datetime import datetime
from collections import namedtuple
import sys, os
import gzip
import random, math
from optparse import OptionParser
options = None
## User for Orthology
best_query_taxon_score = {}
## Used for the Paralogy
BestInterTaxonScore = {}
BetterHit = {}
# class SimilarSeque... | greatfireball/PorthoMCL | porthomclPairsBestHit.py | Python | gpl-3.0 | 10,894 | 0.026161 |
from __future__ import print_function
import numpy as np
from six import next
from six.moves import xrange
def plot_polygon(ax, poly, facecolor='red', edgecolor='black', alpha=0.5, linewidth=1):
""" Plot a single Polygon geometry """
from descartes.patch import PolygonPatch
a = np.asarray(poly.exterior)
... | fonnesbeck/geopandas | geopandas/plotting.py | Python | bsd-3-clause | 10,488 | 0.003337 |
# Copyright (c) 2014 Red Hat, 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 require... | NetApp/manila | manila/tests/share/drivers/test_ganesha.py | Python | apache-2.0 | 13,337 | 0 |
# setup.py: based off setup.py for toil-vg, modified to install this pipeline
# instead.
import sys
import os
# Get the local version.py and not any other version module
execfile(os.path.join(os.path.dirname(os.path.realpath(__file__)), "version.py"))
from setuptools import find_packages, setup
from setuptools.comman... | adamnovak/hgvm-builder | setup.py | Python | apache-2.0 | 2,450 | 0.003673 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsMultiEditToolButton.
.. note:: 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... | pblottiere/QGIS | tests/src/python/test_qgsmultiedittoolbutton.py | Python | gpl-2.0 | 2,332 | 0 |
import os
import json
import logging
import ConfigParser
from framework.db import models
from framework.dependency_management.dependency_resolver import BaseComponent
from framework.dependency_management.interfaces import MappingDBInterface
from framework.lib.exceptions import InvalidMappingReference
class MappingDB... | DarKnight24/owtf | framework/db/mapping_manager.py | Python | bsd-3-clause | 3,644 | 0.001647 |
#
# 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 us... | wary/zeppelin | python/src/main/resources/python/zeppelin_python.py | Python | apache-2.0 | 9,381 | 0.012685 |
from c3nav.editor.models.changedobject import ChangedObject # noqa
from c3nav.editor.models.changeset import ChangeSet # noqa
from c3nav.editor.models.changesetupdate import ChangeSetUpdate # noqa
| c3nav/c3nav | src/c3nav/editor/models/__init__.py | Python | apache-2.0 | 200 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import django.core.validators
import django.contrib.auth.models
class Migration(migrations.Migration):
dependencies = [
('auth', '0006_require_contenttypes_0002'),
]
... | hzlf/openbroadcast.ch | app/remoteauth/migrations/0001_initial.py | Python | gpl-3.0 | 3,171 | 0.00473 |
import socket
from heapq import heappush, heappop, heapify
from collections import defaultdict
##defbig
def encode(symb2freq):
"""Huffman encode the given dict mapping symbols to weights"""
heap = [[wt, [sym, ""]] for sym, wt in symb2freq.items()]
heapify(heap)
while len(heap) > 1:
lo = heappop(... | CSE-SOE-CUSAT/NOSLab | CSA/unsorted/username/client.py | Python | mit | 1,125 | 0.013333 |
import asyncio
import json
import logging
import os
from typing import List, Optional
import aiohttp
import aiohttp_session
import uvloop
from aiohttp import web
from prometheus_async.aio.web import server_stats # type: ignore
from gear import (
Database,
Transaction,
check_csrf_token,
create_session... | hail-is/hail | auth/auth/auth.py | Python | mit | 25,475 | 0.002198 |
from sympy import (diff, trigsimp, expand, sin, cos, solve, Symbol, sympify,
eye, symbols, Dummy, ImmutableMatrix as Matrix, MatrixBase)
from sympy.core.compatibility import string_types, range
from sympy.physics.vector.vector import Vector, _check_vector
__all__ = ['CoordinateSym', 'ReferenceFrame'... | postvakje/sympy | sympy/physics/vector/frame.py | Python | bsd-3-clause | 31,125 | 0.001157 |
"""PEP 656 support.
This module implements logic to detect if the currently running Python is
linked against musl, and what musl version is used.
"""
import contextlib
import functools
import operator
import os
import re
import struct
import subprocess
import sys
from typing import IO, Iterator, NamedTuple, Optional,... | paolodedios/pybuilder | src/main/python/pybuilder/_vendor/pkg_resources/_vendor/packaging/_musllinux.py | Python | apache-2.0 | 4,378 | 0.000457 |
# -*- coding: utf-8 -*-
"""
Test the QgsSettings class
Run with: ctest -V -R PyQgsSettings
.. note:: 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 opti... | pblottiere/QGIS | tests/src/python/test_qgssettings.py | Python | gpl-2.0 | 23,013 | 0.003525 |
import os
import time
from .common import FileDownloader
from ..utils import (
compat_urllib_request,
compat_urllib_error,
ContentTooShortError,
encodeFilename,
sanitize_open,
format_bytes,
)
class HttpFD(FileDownloader):
_TEST_FILE_SIZE = 10241
def real_download(self, filename, inf... | riking/youtube-dl | youtube_dl/downloader/http.py | Python | unlicense | 8,667 | 0.002308 |
from jx_elasticsearch.es52.painless._utils import Painless, LIST_TO_PIPE
from jx_elasticsearch.es52.painless.add_op import AddOp
from jx_elasticsearch.es52.painless.and_op import AndOp
from jx_elasticsearch.es52.painless.basic_add_op import BasicAddOp
from jx_elasticsearch.es52.painless.basic_eq_op import BasicEqOp
fro... | klahnakoski/SpotManager | vendor/jx_elasticsearch/es52/painless/__init__.py | Python | mpl-2.0 | 3,355 | 0.000596 |
# Building inheritance
class MITPerson(Person):
nextIdNum = 0 #next ID number to assing
def __init__(self, name):
Person.__init__(self, name) #initialize Person attributes
# new MITPerson atrribute: a unique ID number
self.idNum = MITPerson.nextIdNum
MITPerson.nextIdNum += ... | teichopsia-/python_practice | old_class_material/MITPerson_class.py | Python | mpl-2.0 | 903 | 0.026578 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.