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 |
|---|---|---|---|---|---|---|
"""Provides Django-Admin form field."""
# coding=utf-8
from django.utils.translation import ugettext_lazy as _
from django.forms.fields import Field, ValidationError
from tempo.django.widgets import RecurrentEventSetWidget
from tempo.recurrenteventset import RecurrentEventSet
class RecurrentEventSetField(Field):
... | AndrewPashkin/python-tempo | src/tempo/django/forms.py | Python | bsd-3-clause | 859 | 0 |
"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import print_function, unicode_literals, absolute_import
import json
import pytest
import requests
import requests.exception... | projectatomic/atomic-reactor | tests/conftest.py | Python | bsd-3-clause | 2,306 | 0.000867 |
from sympy import (Abs, C, Dummy, Max, Min, Rational, Float, S, Symbol, cos, oo,
pi, simplify, sqrt, symbols)
from sympy.geometry import (Circle, Curve, Ellipse, GeometryError, Line, Point,
Polygon, Ray, RegularPolygon, Segment, Triangle,
are_si... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/sympy/geometry/tests/test_geometry.py | Python | agpl-3.0 | 24,875 | 0.006151 |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import collections
import itertools
import warnings
from contextlib impor... | CoderBotOrg/coderbotsrv | server/lib/cryptography/hazmat/backends/openssl/backend.py | Python | gpl-3.0 | 38,174 | 0 |
# check_full_toc.py - Unit tests for SWIG-based libcueify full TOC APIs
#
# Copyright (c) 2011 Ian Jacobi <pipian@pipian.com>
#
# 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
# rest... | pipian/libcueify | tests/swig/check_full_toc.py | Python | mit | 8,463 | 0.002363 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("wagtailcore", "0016_change_page_url_path_to_text_field"),
]
operations = [
migrations.AlterField(
model_name="grouppagepermission",
name="per... | rsalmaso/wagtail | wagtail/core/migrations/0017_change_edit_page_permission_description.py | Python | bsd-3-clause | 771 | 0 |
from digitalio import DigitalInOut, Direction, Pull
import board
import time
import neopixel
led = DigitalInOut(board.D13)
led.direction = Direction.OUTPUT
pixelPin = board.D2
pixelNumber = 8
strip = neopixel.NeoPixel(pixelPin, pixelNumber, brightness=1, auto_write=False)
switch = DigitalInOut(board.D1)
switch.dire... | chris-schmitz/circuit-python-acrylic-nightlight | code/code.py | Python | mit | 1,177 | 0.002549 |
from pandac.PandaModules import *
from toontown.toonbase import TTLocalizer
from toontown.toonbase import ToontownGlobals
ENDLESS_GAME = config.GetBool('endless-ring-game', 0)
NUM_RING_GROUPS = 16
MAX_TOONXZ = 15.0
MAX_LAT = 5
MAX_FIELD_SPAN = 135
CollisionRadius = 1.5
CollideMask = ToontownGlobals.CatchGameBitmask
TAR... | ToonTownInfiniteRepo/ToontownInfinite | toontown/minigame/TargetGameGlobals.py | Python | mit | 7,031 | 0.001991 |
import lorun
import os
import codecs
import random
import subprocess
import config
import sys
RESULT_MAP = [
2, 10, 5, 4, 3, 6, 11, 7, 12
]
class Runner:
def __init__(self):
return
def compile(self, judger, srcPath, outPath):
cmd = config.langCompile[judger.lang] % {'root': sys.path[0], '... | SkyZH/CloudOJWatcher | ojrunnerlinux.py | Python | gpl-3.0 | 1,643 | 0.009738 |
__author__ = 'Dr. Masroor Ehsan'
__email__ = 'masroore@gmail.com'
__copyright__ = 'Copyright 2013, Dr. Masroor Ehsan'
__license__ = 'BSD'
__version__ = '0.1.1'
from datetime import datetime
try:
from lxml import etree
except ImportError:
try:
# Python 2.5
import xml.etree.cElementTree as etree... | masroore/pynewscred | pynewscred/req_parser.py | Python | bsd-3-clause | 7,407 | 0.00027 |
import tak
from . import tps
import attr
import re
@attr.s
class PTN(object):
tags = attr.ib()
moves = attr.ib()
@classmethod
def parse(cls, text):
head, tail = text.split("\n\n", 1)
tags_ = re.findall(r'^\[(\w+) "([^"]+)"\]$', head, re.M)
tags = dict(tags_)
tail = re.sub(r'{[^}]+}', ' ', ... | nelhage/taktician | python/tak/ptn/ptn.py | Python | mit | 2,895 | 0.018307 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
# do this when > 1.6!!!
# from django.db import migrations, models
from gazetteer.models import GazSource,GazSourceConfig,LocationTypeField,CodeFieldConfig,NameFieldConfig
from skosxl.models import Concept, Scheme, MapRelation
from gazetteer.settings imp... | rob-metalinkage/django-gazetteer | gazetteer/fixtures/mapstory_tm_world_config.py | Python | cc0-1.0 | 2,139 | 0.02618 |
a = {"abc": "d<caret>ef"} | asedunov/intellij-community | python/testData/breadcrumbs/dictKey.py | Python | apache-2.0 | 25 | 0.04 |
# Make your image, region, and location changes then change the from-import
# to match.
from configurables_akeeton_desktop import *
import hashlib
import java.awt.Toolkit
import json
import os
import shutil
import time
Settings.ActionLogs = True
Settings.InfoLogs = True
Settings.DebugLogs = True
Set... | akeeton/MTGO-scry-bug-test | MTGO-scry-bug-test.sikuli/MTGO-scry-bug-test.py | Python | mit | 5,599 | 0.008573 |
import pyaudio
import struct
from threading import Thread, Condition
import time
from logging import thread
import socket
CHUNK = 2**12
FORMAT = pyaudio.paInt16
CHANNELS = 2
RATE = 44100
class AudioReader(Thread):
def __init__(self, raw = False, remote = False, host = 'localhost', port = 9999):
Thread._... | nanoscopy/afm-calibrator | nanoscopy/audio.py | Python | mit | 2,692 | 0.015602 |
# Tweepy
# Copyright 2009-2022 Joshua Roesslein
# See LICENSE for details.
from collections.abc import Mapping
class EqualityComparableID:
__slots__ = ()
def __eq__(self, other):
if isinstance(other, self.__class__):
return self.id == other.id
return NotImplemented
class Hasha... | tweepy/tweepy | tweepy/mixins.py | Python | mit | 949 | 0.001054 |
import sys, os
def timeSplit( ETR ):
h = int(ETR/3600)
m = int(ETR - 3600*h)/60
s = int(ETR - 3600*h - 60*m)
return h, m, s
def printProgress( current, total, deltaIter, deltaTime ):
terminalString = "\rProgress: "
if total==0: total+=1
percent = 100.*current/total
nDots = int(percent/5)
dotsStri... | bvillasen/phyGPU | tools/tools.py | Python | gpl-3.0 | 1,660 | 0.037349 |
#
# This file is part of opsd.
#
# opsd 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.
#
# opsd is distributed in the hope that it wil... | warwick-one-metre/opsd | warwick/observatory/operations/dome/astrohaven/__init__.py | Python | gpl-3.0 | 4,416 | 0.001812 |
"""Twitter crawler script"""
import tweepy
from database import MongoDB
class Twitter(object): # pylint: disable=too-few-public-methods
"""Class Twitter"""
def __init__(self):
self.consumer_key = "40GvlhlFPNbVGkZnPncPH8DgB"
self.consumer_secret = "G595ceskX8iVH34rsuLSqpFROL0brp8ezzZR2dGvTKv... | rslnautic/practica-verificacion | src/tweet_crawler.py | Python | apache-2.0 | 1,614 | 0.004337 |
# -*- coding: utf-8 -*-
"""
Kay preparse management command.
:Copyright: (c) 2009 Accense Technology, Inc.
Takashi Matsuo <tmatsuo@candit.jp>,
All rights reserved.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
from os import listdir, path, mkdir
fro... | IanLewis/kay | kay/management/preparse.py | Python | bsd-3-clause | 3,612 | 0.013566 |
from linked_list import LinkedList
class Stack(object):
def __init__(self, iterable=None):
self._list = LinkedList(iterable)
def push(self, val):
self._list.insert(val)
def pop(self):
return self._list.pop()
| HeyIamJames/Data_Structures | stack.py | Python | gpl-2.0 | 248 | 0.008065 |
#!/usr/bin/env python
# Dependencies.py - discover, read, and write dependencies file for make.
# The format like the output from "g++ -MM" which produces a
# list of header (.h) files used by source files (.cxx).
# As a module, provides
# FindPathToHeader(header, includePath) -> path
# FindHeadersInFile(filePath... | apmckinlay/csuneido | vs2019scintilla/scripts/Dependencies.py | Python | gpl-2.0 | 5,533 | 0.023857 |
"""
Module for Image annotations using annotator.
"""
from lxml import etree
from pkg_resources import resource_string
from xmodule.x_module import XModule
from xmodule.raw_module import RawDescriptor
from xblock.core import Scope, String
from xmodule.annotator_mixin import get_instructions, html_to_text
from xmodule.... | c0710204/edx-platform | common/lib/xmodule/xmodule/imageannotation_module.py | Python | agpl-3.0 | 7,154 | 0.002935 |
#task_H
def dijkstra(start, graph):
n = len(graph)
D = [None] * n
D[start] = 0
index = 0
Q = [start]
while index < len(Q):
v = Q[index]
index += 1
for u in graph[v]:
if D[u] == None or D[v] + min(graph[v][u]) < D[u]:
D[u] = D[v] + min(graph[v][u])
Q.append(u)
return D
def reverse(graph):
n = l... | Senbjorn/mipt_lab_2016 | lab_19/task_H.py | Python | gpl-3.0 | 1,281 | 0.042155 |
from . import test_attachment
fast_suite = [test_attachment,
]
| meta-it/misc-addons | attachment_large_object/tests/__init__.py | Python | lgpl-3.0 | 78 | 0 |
from .forms import SetupForm
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.shortcuts import redirect
from splunkdj.decorators.render import render_to
from splunkdj.setup import create_setup_view_context
@login_required
def home(request):
# Redire... | dakiri/splunk-app-twitter | twitter2/django/twitter2/views.py | Python | apache-2.0 | 944 | 0.004237 |
"""Decorators for labeling test objects
Decorators that merely return a modified version of the original
function object are straightforward. Decorators that return a new
function object need to use
nose.tools.make_decorator(original_function)(decorator) in returning
the decorator, in order to preserve metadata such ... | illume/numpy3k | numpy/testing/decorators.py | Python | bsd-3-clause | 9,735 | 0.003287 |
"""Test the Advantage Air Sensor Platform."""
from datetime import timedelta
from json import loads
from homeassistant.components.advantage_air.const import DOMAIN as ADVANTAGE_AIR_DOMAIN
from homeassistant.components.advantage_air.sensor import (
ADVANTAGE_AIR_SERVICE_SET_TIME_TO,
ADVANTAGE_AIR_SET_COUNTDOWN... | aronsky/home-assistant | tests/components/advantage_air/test_sensor.py | Python | apache-2.0 | 4,781 | 0.000627 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol
#
# 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
#... | MostlyOpen/odoo_addons | myo_survey/wizard/__init__.py | Python | agpl-3.0 | 936 | 0 |
import subprocess
from typing import List, Optional
from approvaltests import ensure_file_exists
from approvaltests.command import Command
from approvaltests.core.reporter import Reporter
from approvaltests.utils import to_json
PROGRAM_FILES = "{ProgramFiles}"
class GenericDiffReporterConfig:
def __init__(self,... | approvals/ApprovalTests.Python | approvaltests/reporters/generic_diff_reporter.py | Python | apache-2.0 | 2,752 | 0.00109 |
# commit.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
from gitdb import IStream
from git.util import (
hex_to_bin,
Actor,
Iterable,
Stats,
... | jeblair/GitPython | git/objects/commit.py | Python | bsd-3-clause | 20,799 | 0.002164 |
# -*- coding: utf-8 -*-
# 中文对齐不能用python自带的函数,需要自己根据中文长度增/减空格
# Python 2.7.12 & matplotlib 2.0.0
import re
from urllib2 import *
import matplotlib.pyplot as plt
#Get a set of records from nba.hupu.com due to given team
def getDataSet(team):
statUserAgent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (K... | NickyChan/NBASchedule | main.py | Python | gpl-3.0 | 7,776 | 0.010973 |
import threading
import upnp
import nupnp
class DiscoveryThread(threading.Thread):
def __init__(self, bridges):
super(DiscoveryThread, self).__init__()
self.bridges = bridges
self.upnp_thread = upnp.UPnPDiscoveryThread(self.bridges)
self.nupnp_thread = nupnp.NUPnPDiscoveryThread(... | mpolednik/reddit-button-hue | app/discovery/bridges.py | Python | mit | 649 | 0 |
# Copyright 2014-2017 The ODL contributors
#
# This file is part of ODL.
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at https://mozilla.org/MPL/2.0/.
from __future__ import absolute_import
__al... | kohr-h/odl | odl/contrib/solvers/functional/__init__.py | Python | mpl-2.0 | 416 | 0 |
__author__ = 'Ahmed Hani Ibrahim'
from LearningAlgorithm import *
class RPROP(LearningAlgorithm):
def learn(self, learningRate, input, output, network):
"""
:param learningRate:
:param input:
:param output:
:param network:
:return:
"""
pass | AhmedHani/Python-Neural-Networks-API | OptimizationAlgorithms/RPROP.py | Python | mit | 310 | 0.003226 |
# The contents of this file are subject to the Common Public Attribution
# License Version 1.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://code.reddit.com/LICENSE. The License is based on the Mozilla Public
# License Version 1.1, ... | h2oloopan/easymerge | EasyMerge/tests/reddit/r2/r2/controllers/promotecontroller.py | Python | mit | 34,376 | 0.000698 |
from django.conf.urls import patterns, url
urlpatterns = patterns(
'mtr.utils.views',
url(r'^model/(?P<name>.+)/pk/(?P<pk>\d+)$',
'model_label', name='model_label')
)
| mtrgroup/django-mtr-utils | mtr/utils/urls.py | Python | mit | 186 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Script de comprobación de entrega de ejercicio
Para ejecutarlo, desde la shell:
$ python check.py login_github
"""
import os
import random
import sys
ejercicio = 'X-Serv-14.5-Sumador-Simple'
student_files = [
'servidor-sumador.py'
]
repo_files = [
'check... | begea/X-Serv-14.5-Sumador-Simple | check.py | Python | gpl-3.0 | 1,680 | 0 |
import os
import re
import sys
from setuptools import setup, find_packages
PY3 = sys.version_info[0] == 3
here = os.path.abspath(os.path.dirname(__file__))
name = 'pyramid_kvs'
with open(os.path.join(here, 'README.rst')) as readme:
README = readme.read()
with open(os.path.join(here, 'CHANGES.rst')) as changes:
... | Gandi/pyramid_kvs | setup.py | Python | gpl-2.0 | 1,633 | 0.000612 |
from django.core.urlresolvers import reverse
from kishore.models import Artist, Song, Release
from base import KishoreTestCase
class ArtistTestCase(KishoreTestCase):
def test_index(self):
resp = self.client.get(reverse('kishore_artists_index'))
self.assertEqual(resp.status_code, 200)
def test... | udbhav/kishore | kishore/tests/music.py | Python | mit | 2,056 | 0.002432 |
"""
LMS specific monitoring helpers.
"""
| msegado/edx-platform | lms/djangoapps/monitoring/__init__.py | Python | agpl-3.0 | 41 | 0 |
#-----------------------------------------------------------------------------
# Copyright (c) 2005-2020, PyInstaller Development Team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#
# The full license is in the file COPYING.txt, ... | etherkit/OpenBeacon2 | macos/venv/lib/python3.8/site-packages/_pyinstaller_hooks_contrib/hooks/rthooks/pyi_rth_enchant.py | Python | gpl-3.0 | 968 | 0.004132 |
#
# Copyright 2018 Analytics Zoo 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 applicable law or agreed to... | intel-analytics/analytics-zoo | pyzoo/zoo/chronos/autots/model/auto_seq2seq.py | Python | apache-2.0 | 4,638 | 0.002803 |
import netifaces
from netaddr import *
for inter in netifaces.interfaces():
addrs = netifaces.ifaddresses(inter)
try:
print(addrs)
print(addrs[netifaces.AF_INET][0]["addr"])
print(addrs[netifaces.AF_INET][0]["broadcast"])
print(addrs[netifaces.AF_INET][0]["netmask"])
loc... | GadgeurX/NetworkLiberator | Daemon/Utils.py | Python | gpl-3.0 | 1,119 | 0.007149 |
__author__ = 'sibirrer'
#this file is ment to be a shell script to be run with Monch cluster
# set up the scene
from cosmoHammer.util.MpiUtil import MpiPool
import time
import sys
import pickle
import dill
start_time = time.time()
#path2load = '/mnt/lnec/sibirrer/input.txt'
path2load = str(sys.argv[1])
f = open(pa... | DES-SL/EasyLens | easylens/Scripts/des_script.py | Python | mit | 1,168 | 0.006849 |
#! /usr/bin/env python
"""
This program plots the average electronic energy during a NAMD simulatons
averaged over several initial conditions.
It plots both the SH and SE population based energies.
Example:
plot_average_energy.py -p . -nstates 26 -nconds 6
Note that the number of states is the same as given in the ... | SCM-NV/qmworks-namd | scripts/pyxaid/plot_average_energy.py | Python | mit | 3,318 | 0 |
"""Detail firewall."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import firewall
from SoftLayer.CLI import formatting
from SoftLayer import utils
@click.command()
@click.argument('identifier')
@environment.pass_env
def cli(e... | nanjj/softlayer-python | SoftLayer/CLI/firewall/detail.py | Python | mit | 1,514 | 0 |
#!/usr/bin/python
# Python modules imports
from optparse import OptionParser, make_option
import pyupm_grove as g
import os, sys, socket, uuid, dbus, dbus.service
import dbus.mainloop.glib
#import gardening_system
try:
from gi.repository import GObject
except ImportError:
import gobject as GObject
# Set up consta... | TheIoTLearningInitiative/CodeLabs | Sandbox/Edison_Bluetooth/projects/gardening-system/spp.py | Python | apache-2.0 | 3,138 | 0.015296 |
#!../venv/bin/python
import sys
print (sys.argv[1:])
| thinkl33t/mqtt2telegram | scripts/test.py | Python | lgpl-3.0 | 54 | 0.018519 |
import json
from datetime import datetime, timedelta
from django.contrib.contenttypes.models import ContentType
from nose.tools import eq_
from kitsune import search as constants
from kitsune.access.tests import permission
from kitsune.forums.tests import forum, post, restricted_forum, thread
from kitsune.products.t... | Osmose/kitsune | kitsune/search/tests/test_search_advanced.py | Python | bsd-3-clause | 31,926 | 0 |
# ********************************************************************** <====
from artmgr.transport.basew import BaseWTransport
# ********************************************************************** ====>
import os
import sys
import errno
import stat
import re
# chunksize for reading/writing local files
CHUNK = ... | paulovn/artifact-manager | lib/artmgr/transport/local.py | Python | gpl-2.0 | 4,422 | 0.015604 |
#author :haiyfu
#date:April 14
#description:
#contact:haiyangfu512@gmail.com
"""
This little part is to check how many different values in
a column and store the unqiue values in a list.
For FCBF initially.
The last column is the class .
"""
from sys import argv
#only count the target file and return... | haiy/XF_PRISM | src/XF-Prism/rc_generator.py | Python | gpl-3.0 | 1,587 | 0.028986 |
# 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 agreed to in writing, s... | PAIR-code/lit | lit_nlp/components/scrambler.py | Python | apache-2.0 | 2,899 | 0.00276 |
import re
import html
# The regular string.split() only takes a max number of splits,
# but it won't unpack if there aren't enough values.
# This function ensures that we always get the wanted
# number of returned values, even if the string doesn't include
# as many splits values as we want, simply by filling in extra... | Tigge/platinumshrimp | utils/str_utils.py | Python | mit | 1,370 | 0.00073 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import io
import os
import sys
import re
from setuptools import setup
if sys.argv[-1] == "publish":
os.system("python setup.py sdist upload")
sys.exit()
packages = [
"the_big_username_blacklist"
]
# Handle requirements
install_requires = []
tests_requires... | marteinn/The-Big-Username-Blacklist-Python | setup.py | Python | mit | 1,848 | 0.001083 |
#SBaaS
from .stage02_physiology_graphData_io import stage02_physiology_graphData_io
from SBaaS_models.models_COBRA_execute import models_COBRA_execute
from .stage02_physiology_analysis_query import stage02_physiology_analysis_query
#System
import copy
class stage02_physiology_graphData_execute(stage02_physiology_graph... | dmccloskey/SBaaS_COBRA | SBaaS_COBRA/stage02_physiology_graphData_execute.py | Python | mit | 4,655 | 0.017401 |
from __future__ import absolute_import, division, print_function
from dynd._pydynd import w_type, \
make_var_dim, make_strided_dim, make_fixed_dim, make_cfixed_dim
__all__ = ['var', 'strided', 'fixed', 'cfixed']
class _Dim(object):
__slots__ = []
def __mul__(self, rhs):
if isinstance(rhs, w... | aterrel/dynd-python | dynd/ndt/dim_helpers.py | Python | bsd-2-clause | 4,145 | 0.000965 |
from django.contrib.contenttypes.fields import GenericRelation
from django.db import models
from django.urls import reverse
from django.utils.encoding import python_2_unicode_compatible
from extras.models import CustomFieldModel, CustomFieldValue
from utilities.models import CreatedUpdatedModel
from utilities.utils im... | Alphalink/netbox | netbox/tenancy/models.py | Python | apache-2.0 | 1,852 | 0.00216 |
# -*- encoding: utf-8 -*-
from __future__ import absolute_import
import requests
import json
import logging
from bs4 import BeautifulSoup as htmldoc
def carrier_lookup():
return None
class CarrierLookup(object):
def __init__(self, number, logname=None):
self.number = number
self._logname =... | neuroticnerd/armory | armory/phone/lookup.py | Python | apache-2.0 | 2,647 | 0.000756 |
#!/usr/bin/env python
#
# Copyright 2014 Simone Campagna
#
# 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 l... | simone-campagna/py-configment | src/configment/configment.py | Python | apache-2.0 | 5,069 | 0.001578 |
"""
compact_group.py - Part of millennium-compact-groups package
Defines CompactGroup object to handle information about a single
compact group.
Copyright(C) 2016 by
Trey Wenger; tvwenger@gmail.com
Chris Wiens; cdw9bf@virginia.edu
Kelsey Johnson; kej7a@virginia.edu
GNU General Public License v3 (GNU GPLv3)
This pro... | tvwenger/millennium-compact-groups | compact_group.py | Python | gpl-3.0 | 5,674 | 0.003877 |
from .test_base_class import ZhihuClientClassTest
PEOPLE_SLUG = 'giantchen'
class TestPeopleBadgeNumber(ZhihuClientClassTest):
def test_badge_topics_number(self):
self.assertEqual(
len(list(self.client.people(PEOPLE_SLUG).badge.topics)), 2,
)
def test_people_has_badge(self):
... | 7sDream/zhihu-oauth | test/test_client_people_badge.py | Python | mit | 762 | 0 |
#! /bin/python
import xbh as xbhpkg
xbh = xbhpkg.Xbh()
#xbh.switch_to_app()
xbh.calc_checksum()
print(xbh.get_results())
| jhnphm/xbs_xbd | python/scripts/test.py | Python | gpl-3.0 | 122 | 0.008197 |
class FieldRegistry(object):
_registry = {}
def add_field(self, model, field):
reg = self.__class__._registry.setdefault(model, [])
reg.append(field)
def get_fields(self, model):
return self.__class__._registry.get(model, [])
def __contains__(self, model):
return model... | feroda/django-pro-history | current_user/registration.py | Python | agpl-3.0 | 349 | 0 |
"""
Generates 40 random numbers and writes them
to a file. No number is repeated.
~ Created by Elijah Wilson 2014 ~
"""
# used for generating random integers
from random import randint
# open the output file -> "in.data"
f = open("in.data", "w")
# create an empty list
succ = []
# loops through 40 times for gene... | tizz98/cs216 | p11/rand.py | Python | unlicense | 1,083 | 0.025854 |
# -*- coding: utf-8 -*-
###############################################################################
#
# ZipFile
# Creates a zipped version of the specified Box file and returns a link to the new compressed file.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License... | jordanemedlock/psychtruths | temboo/core/Library/Box/Files/ZipFile.py | Python | apache-2.0 | 4,646 | 0.005166 |
import os
import platform
from setuptools import setup
# "import" __version__
__version__ = 'unknown'
for line in open('sounddevice.py'):
if line.startswith('__version__'):
exec(line)
break
MACOSX_VERSIONS = '.'.join([
'macosx_10_6_x86_64', # for compatibility with pip < v21
'macosx_10_6_... | spatialaudio/python-sounddevice | setup.py | Python | mit | 2,712 | 0 |
#!/usr/bin/env python
"""The MySQL database methods for foreman rule handling."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from grr_response_core.lib import rdfvalue
from grr_response_server import foreman_rules
from grr_response_server.databases im... | demonchild2112/travis-test | grr/server/grr_response_server/databases/mysql_foreman_rules.py | Python | apache-2.0 | 1,746 | 0.005727 |
import traceback
from vstruct2.compat import int2bytes, bytes2int
# This routine was coppied from vivisect to allow vstruct
# to be free from dependencies
MAX_WORD = 16
def initmask(bits):
return (1<<bits)-1
bitmasks = [ initmask(i) for i in range(MAX_WORD*8) ]
def bitmask(value,bits):
return value & bitmasks... | vivisect/vstruct | vstruct2/bases.py | Python | apache-2.0 | 4,994 | 0.009211 |
import pytest
import tensorflow as tf
import numpy as np
import tfs.core.layer.ops as ops
from tfs.core.layer.dropout import Dropout
from tfs.network import Network
net = Network()
@pytest.fixture
def l():
l = Dropout(
net,
keep_prob=1.0,
)
return l
class TestDropout:
def test_build_inverse(self,l):
... | crackhopper/TFS-toolbox | tests/core/layer/dropout_test.py | Python | mit | 426 | 0.044601 |
# coding = utf-8
__author__ = 'Forec'
import xlwt
import re
book = xlwt.Workbook(encoding = 'utf-8', style_compression=0)
sheet = book.add_sheet('student',cell_overwrite_ok = True)
line = 0
info = re.compile(r'\"(\d+)\" : \"(.*?)\"')
with open('city.txt',"r") as f:
data = f.read()
for x in info.findall(data):
... | luoxufeiyan/python | Forec/0015/0015.py | Python | mit | 410 | 0.02439 |
# Copyright (C) 2014 Optiv, Inc. (brad.spengler@optiv.com)
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
from lib.cuckoo.common.abstracts import Signature
class InjectionRWX(Signature):
name = "injection_rwx"
description = "Creates R... | lixiangning888/whole_project | modules/signatures_orginal_20151110/injection_rwx.py | Python | lgpl-3.0 | 1,229 | 0.004068 |
# -*- mode: python; coding: utf-8; -*-
import os
APP_NAME = "SLog"
VERSION = "0.9.4"
WEBSITE = "http://vialinx.org"
LICENSE = """
SLog is a PyGTK-based GUI for the LightLang SL dictionary.
Copyright 2007 Nasyrov Renat <renatn@gmail.com>
This file is part of SLog.
SLog is free software; you can redistribute it and/... | mdevaev/slog | src/common.py | Python | gpl-2.0 | 1,483 | 0.002697 |
# Copyright 2012-2013 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 la... | nttcom/eclcli | eclcli/identity/v3/user.py | Python | apache-2.0 | 15,378 | 0 |
from temboo.Library.Zendesk.Search.SearchAll import SearchAll, SearchAllInputSet, SearchAllResultSet, SearchAllChoreographyExecution
from temboo.Library.Zendesk.Search.SearchAnonymous import SearchAnonymous, SearchAnonymousInputSet, SearchAnonymousResultSet, SearchAnonymousChoreographyExecution
| jordanemedlock/psychtruths | temboo/core/Library/Zendesk/Search/__init__.py | Python | apache-2.0 | 296 | 0.006757 |
import random
## Course texture colors ##
###########################
class Course(object):
def __init__(self, num):
## Default colors, fall back to these
fog = [0,0,0]
light_road = [0,0,0]
dark_road = [0,0,0]
light_offroad = [0,0,0]
dark_offroad = [0,0,0]
li... | navarro0/racing-all-afternoon | course.py | Python | mit | 3,892 | 0.023124 |
"""
End to end test of the internal reporting user table loading task.
"""
import os
import logging
import datetime
import pandas
from luigi.date_interval import Date
from edx.analytics.tasks.tests.acceptance import AcceptanceTestCase
from edx.analytics.tasks.url import url_path_join
log = logging.getLogger(__nam... | sssllliang/edx-analytics-pipeline | edx/analytics/tasks/tests/acceptance/test_internal_reporting_user.py | Python | agpl-3.0 | 2,665 | 0.004878 |
# -*- coding: utf-8 -*-
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt 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 3 of ... | gangadharkadam/letzerp | erpnext/startup/__init__.py | Python | agpl-3.0 | 986 | 0.002028 |
__author__ = 'Sulantha'
import logging
class PipelineLogger:
logFunctions={'info':logging.info,
'debug':logging.debug,
'warning':logging.warning,
'error':logging.error,
'critical':logging.critical,
'exception':logging.exception}
... | sulantha2006/Processing_Pipeline | Utils/PipelineLogger.py | Python | apache-2.0 | 498 | 0.026104 |
import py
from rpython.rlib.signature import signature, finishsigs, FieldSpec, ClassSpec
from rpython.rlib import types
from rpython.annotator import model
from rpython.rtyper.llannotation import SomePtr
from rpython.annotator.signature import SignatureError
from rpython.translator.translator import TranslationContext,... | oblique-labs/pyVM | rpython/rlib/test/test_signature.py | Python | mit | 10,192 | 0.005789 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# sin título.py
#
# Copyright 2012 Jesús Hómez <jesus@soneview>
#
# 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; ei... | jehomez/pymeadmin | prueba_de_inventario.py | Python | gpl-2.0 | 1,191 | 0.004209 |
"""Command line tool for creating audioMD metadata."""
from __future__ import unicode_literals, print_function
import os
import sys
import click
import six
import audiomd
from siptools.mdcreator import MetsSectionCreator
from siptools.utils import fix_missing_metadata, scrape_file
click.disable_unicode_literals_war... | Digital-Preservation-Finland/dpres-siptools | siptools/scripts/create_audiomd.py | Python | lgpl-3.0 | 6,706 | 0 |
import logging
import StringIO
from iso8601 import parse_date
from datetime import datetime
from pylons import request, response, session, tmpl_context as c, url
from pylons.controllers.util import abort, redirect
from lr.model.base_model import appConfig
from lr.lib.base import BaseController, render
import json
impo... | jimklo/LearningRegistry | LR/lr/controllers/extract.py | Python | apache-2.0 | 10,398 | 0.009233 |
# -*- coding: utf-8 -*-
__all__ = ("clear_tags", "get_text_from_html", "clear_text")
def clear_tags(obj):
"""
Remove not used blocks, such as table of contents, advertisements
"""
SEARCH_TAG = ["div", "table"]
for i in SEARCH_TAG:
res= obj.soup(i)
for row in res:
if r... | Korotkin/text_processor_sample | src/plugins.py | Python | gpl-3.0 | 821 | 0.004872 |
from django.db import models as dbmodels, connection
from django.utils import datastructures
from autotest.frontend.afe import model_logic, readonly_connection
_quote_name = connection.ops.quote_name
class TempManager(model_logic.ExtendedManager):
_GROUP_COUNT_NAME = 'group_count'
def _get_key_unless_is_func... | yangdongsheng/autotest | frontend/tko/models.py | Python | gpl-2.0 | 30,170 | 0.001624 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# tvalacarta - XBMC Plugin
# Canal para ecuador tv
# http://blog.tvalacarta.info/plugin-xbmc/tvalacarta/
#------------------------------------------------------------
import os
import sys
import urlparse,re
import urllib
import datet... | tvalacarta/tvalacarta | python/main-classic/channels/ecuadortv.py | Python | gpl-3.0 | 680 | 0.010294 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging, os
logging.basicConfig(level=logging.INFO)
from deepy.networks import RecursiveAutoEncoder
from deepy.trainers import SGDTrainer, LearningRateAnnealer
from util import get_data, VECTOR_SIZE
model_path = os.path.join(os.path.dirname(__file__), "models", "... | zomux/deepy | examples/auto_encoders/recursive_auto_encoder.py | Python | mit | 593 | 0.008432 |
def migrate(cr, version):
if not version:
return
# Replace ids of better_zip by ids of city_zip
cr.execute("""
ALTER TABLE crm_event_compassion
DROP CONSTRAINT crm_event_compassion_zip_id_fkey;
UPDATE crm_event_compassion e
SET zip_id = (
SELECT id FROM r... | CompassionCH/compassion-modules | crm_compassion/migrations/12.0.1.0.0/pre-migration.py | Python | agpl-3.0 | 409 | 0 |
# Copyright 2017 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
#
# Unl... | openstack/nomad | cyborg/tests/unit/api/controllers/v1/test_fpga_program.py | Python | apache-2.0 | 2,179 | 0 |
'''
Created on Oct 11, 2014
@author: mshepher
'''
from globals import Globals
class Order(object):
EIGENAAR = 0
DIER = 1
GESLACHT = 2
GECASTREERD = 3
AKTIEF = 4
OVERGANGS = 5
GEWICHT = 6 #numerical
PAKKETKG = 7 #float
SOORT = 8
PUP = 9
RAS = 10
def __init__(self,orde... | micha-shepher/oervoer-wizard | oervoer/order.py | Python | gpl-3.0 | 2,431 | 0.008638 |
from django.db import models
from django.contrib.auth.models import User
class Post(models.Model):
title = models.CharField(max_length=255)
body = models.TextField()
user = models.ForeignKey(User)
| erkarl/browl-api | apps/posts/models.py | Python | mit | 211 | 0 |
import csv
from util.helper import *
import util.plot_defaults
from matplotlib.ticker import MaxNLocator
from pylab import figure
parser = argparse.ArgumentParser()
parser.add_argument('--file', '-f',
help="data file directory",
required=True,
action="store... | XianliangJ/collections | ShrewAttack/plotter.py | Python | gpl-3.0 | 1,097 | 0.012762 |
# 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 the hope that it will be useful,
# bu... | avocado-framework/avocado-vt | virttest/unittests/test_utils_zchannels.py | Python | gpl-2.0 | 3,733 | 0.00375 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
import os
from pant... | square/pants | tests/python/pants_test/tasks/test_eclipse_integration.py | Python | apache-2.0 | 3,401 | 0.010879 |
#!/usr/bin/env python
# coding=utf-8
from __future__ import division, print_function, unicode_literals
import re
import unicodedata
h1_start = re.compile(r"^\s*=(?P<title>[^=]+)=*[ \t]*")
valid_title = re.compile(r"[^=]+")
general_heading = re.compile(r"^\s*(={2,6}(?P<title>" + valid_title.pattern +
... | Qwlouse/Findeco | node_storage/validation.py | Python | gpl-3.0 | 1,992 | 0.001011 |
# Copyright 2010 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 or agreed to ... | SkyLined/headsup | decode/GIF_IMAGE.py | Python | apache-2.0 | 2,315 | 0.019438 |
import psycopg2
from db.enums import *
base = psycopg2.connect("dbname='cardkeepersample' user='andrew' host='localhost' password='1234'")
cursor = base.cursor()
# Wrapped queries in alphabetic order
def active_packs(user_id, start=0, count=10):
query = """SELECT packs.pack_id, packs.name FROM user_packs, packs... | andrewgolman/Learning_Cards | bot/db/queries.py | Python | gpl-3.0 | 7,726 | 0.001941 |
# -*- 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):
# Adding field 'machine.domain'
db.add_column('inventory_machine', 'domain',
self.gf('... | updatengine/updatengine-server | inventory/migrations/0013_auto__add_field_machine_domain__add_field_machine_uuid__add_field_mach.py | Python | gpl-2.0 | 11,272 | 0.006831 |
from django.contrib import admin
from .models import BackgroundImages, Widget
class WidgetAdmin(admin.ModelAdmin):
list_display = ('name', 'link', 'is_featured')
ordering = ('-id',)
class BackgroundAdmin(admin.ModelAdmin):
list_display = ('name', 'created_at')
ordering = ('-id',)
admin.site.regis... | malikshahzad228/widget-jack | widgets/admin.py | Python | mit | 400 | 0 |
# Copyright (c) 2017. Mount Sinai School of Medicine
#
# 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... | hammerlab/topiary | topiary/cli/errors.py | Python | apache-2.0 | 1,087 | 0.00092 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.