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 |
|---|---|---|---|---|---|---|
#adapted from ColorWall by jesstesstest
_font = (
(
("########"),
("##....##"),
("#.#..#.#"),
("#..##..#"),
("#..##..#"),
("#.#..#.#"),
("##....##"),
("########")
),
(
("########"),
("##....##"),
("#.#..#.#"),
("#..##..#"),
("#..##..#"),
("#.#..#.#"),
("... | 602p/orth | os/kernel/font/font.py | Python | lgpl-3.0 | 19,506 | 0.000103 |
"""Support to interface with the Plex API."""
from __future__ import annotations
from functools import wraps
import json
import logging
import plexapi.exceptions
import requests.exceptions
from homeassistant.components.media_player import DOMAIN as MP_DOMAIN, MediaPlayerEntity
from homeassistant.components.media_pla... | rohitranjan1991/home-assistant | homeassistant/components/plex/media_player.py | Python | mit | 19,911 | 0.000904 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (C) 2017 Red Hat Inc.
# Copyright (C) 2017 Lenovo.
#
# GNU General Public License v3.0+
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE... | hkariti/ansible | lib/ansible/modules/network/enos/enos_config.py | Python | gpl-3.0 | 9,930 | 0.000604 |
__author__ = 'sekely'
'''
we are using variables almost everywhere in the code.
variables are used to store results, calculations and many more.
this of it as the famous "x" from high school
x = 5, right?
the only thing is, that in Python "x" can store anything
'''
# try this code:
x = 5
y = x + 3
print(y)
# what... | idosekely/python-lessons | lesson_1/variables.py | Python | mit | 403 | 0 |
# 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-mgmt-network/azure/mgmt/network/v2017_11_01/models/topology_parameters.py | Python | mit | 1,697 | 0.001768 |
# 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/network/azure-mgmt-network/azure/mgmt/network/v2019_02_01/operations/_usages_operations.py | Python | mit | 5,274 | 0.004361 |
##
## Biskit, a toolkit for the manipulation of macromolecular structures
## Copyright (C) 2004-2012 Raik Gruenberg & Johan Leckner
##
## 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 v... | ostrokach/biskit | Biskit/Model.py | Python | gpl-3.0 | 10,389 | 0.02108 |
from kivy.app import App
from kivy.uix.button import Button
class RobotControlApp(App):
def build(self):
return Button(text='Hello World')
if __name__ == '__main__':
RobotControlApp().run()
| develru/RobotControlCenterKivy | main.py | Python | gpl-3.0 | 210 | 0 |
#!/usr/bin/env python3
# internal modules
import numericalmodel
# external modules
import numpy as np
EMPTY_ARRAY = np.array([])
class LinearDecayEquation(numericalmodel.equations.PrognosticEquation):
"""
Class for the linear decay equation
"""
def linear_factor(self, time = None ):
# take th... | nobodyinperson/python3-numericalmodel | tests/test_data.py | Python | gpl-3.0 | 794 | 0.011335 |
import datetime
import hashlib
from django.conf import settings
from django.contrib.auth.models import Group
from django.contrib.auth import get_user_model
from django.db import models, IntegrityError
from django.utils.translation import ugettext_lazy as _
from django.db.models import signals
from taggit.managers imp... | USStateDept/geonode | geonode/groups/models.py | Python | gpl-3.0 | 9,016 | 0.001331 |
# 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, software
# d... | gooddata/openstack-nova | nova/objects/cell_mapping.py | Python | apache-2.0 | 10,122 | 0 |
# Copyright (c) 2009 NHN 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 follow... | DLR-SC/tigl | thirdparty/nsiqcppstyle/nsiqunittest/nsiqcppstyle_unittestbase.py | Python | apache-2.0 | 2,439 | 0.00451 |
#Intentionally left blank. There should be a .pyc file by the same name at creation.
| DanielleWingler/UnderstandingDjango | TestSite/blog/__init__.py | Python | mit | 85 | 0.023529 |
import random, sys
if len(sys.argv)!= 2:
print "Usage: python generate.py <how many instructions you want>"
sys.exit()
choices = ("(", ")")
output = ""
for x in range(int(sys.argv[1])):
output += random.choice(choices)
f = open("randout", "w")
f.write(output)
f.close
print "Created an instruction set... | b4ux1t3/adventofcode2015 | day1/generate.py | Python | mit | 366 | 0.005464 |
#!/usr/bin/python
# UDPPingerServer.py
# We will need the following module to generate randomized lost packets
import random
from socket import *
# Create a UDP socket
# Notice the use of SOCK_DGRAM for UDP packets
serverSocket = socket(AF_INET, SOCK_DGRAM)
# Assign IP address and port number to socket
serverSocket.bi... | jameslivulpi/socketprogramming | udpServer.py | Python | gpl-3.0 | 872 | 0.001147 |
# 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 use ... | apache/libcloud | libcloud/test/compute/test_dimensiondata_v2_4.py | Python | apache-2.0 | 160,650 | 0.001332 |
#! /usr/bin/env python
import os
from dotfiles import Dotfiles
def main():
homedir = os.environ['HOME']
dotfilesRoot = homedir + '/dotfiles'
d = Dotfiles(dotfilesRoot)
d.setup()
if __name__ == "__main__":
main()
| xaque208/dotfiles | bin/init.py | Python | mit | 239 | 0 |
from __future__ import unicode_literals, division, absolute_import
from urlparse import urljoin, urlparse
from collections import namedtuple
from itertools import groupby
import logging
import os
import posixpath
from functools import partial
import time
from flexget import plugin
from flexget.event import event
from ... | thalamus/Flexget | flexget/plugins/plugin_sftp.py | Python | mit | 14,868 | 0.003228 |
"""
Views for PatreonProvider
https://www.patreon.com/platform/documentation/oauth
"""
import requests
from allauth.socialaccount.providers.oauth2.views import (
OAuth2Adapter,
OAuth2CallbackView,
OAuth2LoginView,
)
from .provider import API_URL, USE_API_V2, PatreonProvider
class PatreonOAuth2Adapter(O... | pennersr/django-allauth | allauth/socialaccount/providers/patreon/views.py | Python | mit | 2,047 | 0.001466 |
import sys, Tkinter, tkFont, ttk
sys.path.insert(0, "./src/")
import button, database
from config import *
# Note: need to set size for bg_canvas here; otherwise it will grow disregard the size set while created!
def AuxscrollFunction(event):
bg_canvas.configure(scrollregion=bg_canvas.bbox("all"), height=THUMB_HEI... | ybdarrenwang/DuplicatedPhotoFinder | main.py | Python | bsd-3-clause | 2,866 | 0.008374 |
#!/usr/bin/env python
# (c) 2013, Greg Buehler
#
# This file is part of Ansible,
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ve... | alexlo03/ansible | contrib/inventory/zabbix.py | Python | gpl-3.0 | 4,795 | 0.002086 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('credit', '0005_creditrequirement_sort_value'),
]
operations = [
migrations.AlterModelOptions(
name='creditrequirement',
... | cpennington/edx-platform | openedx/core/djangoapps/credit/migrations/0006_creditrequirement_alter_ordering.py | Python | agpl-3.0 | 387 | 0 |
"""
:Requirements: django-tagging
This module contains some additional helper tags for the django-tagging
project. Note that the functionality here might already be present in
django-tagging but perhaps with some slightly different behaviour or
usage.
"""
from django import template
from django.core.urlresolvers imp... | zerok/django-zsutils | django_zsutils/templatetags/zsutils/taghelpers.py | Python | bsd-3-clause | 1,704 | 0.005282 |
"""
Manages downloading and updating applications throught he use of a zip file hosted on HomePi server.
"""
import datetime
import os.path
import zipfile
import urllib2
#Test call to verify thins work.
def print_info(archive_name):
zf = zipfile.ZipFile(archive_name)
for info in zf.infolist():
print... | leeclarke/homePi | src/python/zipInstall.py | Python | gpl-3.0 | 2,124 | 0.013183 |
"""
Unit tests for optimization routines from minpack.py.
"""
from __future__ import division, print_function, absolute_import
from numpy.testing import assert_, assert_almost_equal, assert_array_equal, \
assert_array_almost_equal, TestCase, run_module_suite, assert_raises, \
assert_allclose
import num... | sargas/scipy | scipy/optimize/tests/test_minpack.py | Python | bsd-3-clause | 13,744 | 0.006694 |
# Copyright 2016 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 agreed to in writing... | stratis-storage/stratis-cli | tests/whitebox/monkey_patching/test_keyboard_interrupt.py | Python | apache-2.0 | 1,934 | 0 |
# -*- coding: utf-8 -*-
import numpy as np
from scipy.signal import lfilter
def filter_and_sample(y_big, W, DT, window='rectangular', even_NSTEPS=True, detrend=False, drop_first=True):
"""Filter signal with moving average window of width W and then sample it
with time step DT."""
if (W > 1):
if ... | lorisercole/thermocepstrum | sportran/md/tools/resample.py | Python | gpl-3.0 | 1,531 | 0.001306 |
import pathlib
import argparse
import os
IMGFORMAT = 'JPG'
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Symlink a local album directory to the "galleries" subdirectory in a local Piwigo instance.')
parser.add_argument('src_album', type=str, help='Location of album to symlink, relat... | nickmcummins/misc-tools | piwigo/piwigo_symlink_local_album.py | Python | gpl-3.0 | 1,897 | 0.005799 |
"""
Contains all unit tests for the Tools app.
"""
# Django
# from django.conf import settings
# from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import TestCase
from django.urls import reverse
# from django.utils import timezone
# local Django
# from accounts.models import User
# from e... | sigdotcom/acm.mst.edu | ACM_General/tools/tests.py | Python | gpl-3.0 | 857 | 0 |
from comics.aggregator.crawler import CrawlerBase, CrawlerImage
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = 'Girls With Slingshots'
language = 'en'
url = 'http://www.girlswithslingshots.com/'
start_date = '2004-09-30'
rights = 'Danielle Corsetto'
class... | datagutten/comics | comics/comics/gws.py | Python | agpl-3.0 | 839 | 0 |
import unittest
import os
import os.path
import contextlib
import sys
import test._mock_backport as mock
import test.test_support
import ensurepip
import ensurepip._uninstall
class TestEnsurePipVersion(unittest.TestCase):
def test_returns_version(self):
self.assertEqual(ensurepip._PIP_VERSION, ensurepip... | sometallgit/AutoUploader | Python27/Lib/test/test_ensurepip.py | Python | mit | 9,313 | 0 |
# -*- coding: utf-8 -*-
"""Tests for psychopy.compatibility"""
from builtins import object
import os
from psychopy import constants, compatibility
import pytest
pytestmark = pytest.mark.skipif(
constants.PY3,
reason='Python3 cannot import the old-style pickle files')
thisPath = os.path.split(__file__)[0]
fixt... | hoechenberger/psychopy | psychopy/tests/test_compatibility/test_compatibility.py | Python | gpl-3.0 | 1,242 | 0.000805 |
''' Script used to test bucketlistitem response and request.'''
from rest_framework.authtoken.models import Token
from rest_framework.test import APIClient
from django.core.urlresolvers import reverse_lazy
from rest_framework import status
from rest_framework.test import APITestCase
from django.contrib.auth.models imp... | andela-sjames/django-bucketlist-application | bucketlistapp/bucketlistapi/tests/test_bucketlistitems.py | Python | gpl-3.0 | 1,569 | 0.01211 |
from __future__ import unicode_literals
from decimal import Decimal
import boto
import boto3
from boto3.dynamodb.conditions import Key
import sure # noqa
from freezegun import freeze_time
from moto import mock_dynamodb2
from boto.exception import JSONResponseError
from tests.helpers import requires_boto_gte
try:
... | silveregg/moto | tests/test_dynamodb2/test_dynamodb_table_with_range_key.py | Python | apache-2.0 | 47,256 | 0.000825 |
# -*-python-*-
# GemRB - Infinity Engine Emulator
# Copyright (C) 2003 The GemRB Project
#
# 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) ... | flaing/gemrb | gemrb/GUIScripts/iwd2/Start.py | Python | gpl-2.0 | 6,550 | 0.027176 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# === This file is part of Calamares - <https://calamares.io> ===
#
# SPDX-FileCopyrightText: 2014 Aurélien Gâteau <agateau@kde.org>
# SPDX-FileCopyrightText: 2014 Anke Boersma <demm@kaosx.us>
# SPDX-FileCopyrightText: 2014 Daniel Hillenbrand <codeworkx@bbqlinux.or... | calamares/calamares | src/modules/bootloader/main.py | Python | gpl-3.0 | 28,413 | 0.001901 |
import logging
import asyncio
logger = logging.getLogger(__name__)
class InfluxLineProtocol(asyncio.DatagramProtocol):
def __init__(self, loop):
self.loop = loop
self.transport = None
def connection_made(self, transport):
self.transport = transport
@staticmethod
def fmt(meas... | jordens/sensortag | influx_udp.py | Python | lgpl-3.0 | 2,082 | 0 |
# 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... | ikoula/cloudstack | tools/marvin/marvin/lib/common.py | Python | gpl-2.0 | 67,873 | 0.002328 |
# Pre-compute the shortest path length in the stoichiometric matrix
# NB: check some of the shortest path calcs?
import pdb
import settings
import networkx as nx
import pandas as pd
import numpy as np
import os
METS_TO_REMOVE = ['h', 'h2o', 'co2', 'o2', 'pi', 'atp', 'adp', 'amp',
'nad', 'nadh', 'na... | eladnoor/small-molecule-regulation | python/topology.py | Python | mit | 3,400 | 0.000882 |
"""Farragone.
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."""
import gettext
from . import coreconf as _conf
gettext.inst... | ikn/farragone | farragone/__init__.py | Python | gpl-3.0 | 418 | 0.002392 |
# 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/network/azure-mgmt-network/azure/mgmt/network/v2019_02_01/operations/_network_interface_load_balancers_operations.py | Python | mit | 5,808 | 0.004304 |
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 30 20:12:17 2017
@author: Mohtashim
"""
# Create a list of strings: spells
spells = ["protego", "accio", "expecto patronum", "legilimens"]
# Use map() to apply a lambda function over spells: shout_spells
shout_spells = map(lambda item: item + '!!!', spells)
# Convert s... | Moshiasri/learning | Python_dataCamp/Map()LambdaFunction.py | Python | gpl-3.0 | 474 | 0 |
#### 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 = Tangible()
result.template = "object/tangible/deed/corellia/player_house_deed/shared_corellia_house_large_deed.iff... | obi-two/Rebelion | data/scripts/templates/object/tangible/deed/corellia/player_house_deed/shared_corellia_house_large_deed.py | Python | mit | 490 | 0.044898 |
import h2o, h2o_config
l = h2o_config.setup_test_config(test_config_json='test_config.json')
print "\nsetup_test_config returns list of test config objs:", l
# Here are some ways to reference the config state that the json created
print "\nHow to reference.."
for i, obj in enumerate(h2o_config.configs):
print "k... | 111t8e/h2o-2 | py/test_config_basic.py | Python | apache-2.0 | 597 | 0.005025 |
from robot.libraries.BuiltIn import BuiltIn
def fail_with_traceback(traceback_message):
BuiltIn().fail(traceback_message)
| allure-framework/allure-python | allure-robotframework/examples/status/status_library.py | Python | apache-2.0 | 129 | 0 |
# -*- coding: utf-8 *-*
# made for python3!
from tkinter import *
from tkinter.ttk import *
class TkWindow():
registers = {}
def __init__(self, parent, title, width=400, height=300):
self.parent = parent #Tk or toplevel
self.w = width
self.h = height
self.make_gui(ti... | ManInAGarden/PiADCMeasure | tkwindow.py | Python | lgpl-3.0 | 4,958 | 0.010286 |
from pycp2k.inputsection import InputSection
from ._each112 import _each112
class _davidson2(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Section_parameters = None
self.Add_last = None
self.Common_iteration_levels = None
self.Filename = None
s... | SINGROUP/pycp2k | pycp2k/classes/_davidson2.py | Python | lgpl-3.0 | 666 | 0.003003 |
#
# Copyright (C) 2016 by YOUR NAME HERE
#
# This file is part of RoboComp
#
# RoboComp 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... | robocomp/robocomp-robolab | experimental/dumbGlobalTrajectory/src/trajectoryrobot2dI.py | Python | gpl-3.0 | 1,815 | 0.019835 |
# Copyright (c) 2018 PaddlePaddle 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 app... | luotao1/Paddle | python/paddle/fluid/dygraph/profiler.py | Python | apache-2.0 | 886 | 0 |
# -*- encoding: utf-8 -*-
# Copyright (c) 2015 b<>com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | b-com/watcher-metering | watcher_metering/agent/agent.py | Python | apache-2.0 | 5,245 | 0 |
def mangled_node_tree_name(b_material):
return "PH_" + b_material.name
| TzuChieh/Photon-v2 | BlenderAddon/PhotonBlend/bmodule/common/__init__.py | Python | mit | 73 | 0.013699 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# A Solution to "Maximum path sum I" – Project Euler Problem No. 18
# by Florian Buetow
#
# Sourcecode: https://github.com/fbcom/project-euler
# Problem statement: https://projecteuler.net/problem=18
#
def get_triangular_list(str):
ret = []
tmp = []
i = j = ... | fbcom/project-euler | 018_maximum_path_sum_1.py | Python | mit | 1,351 | 0.000741 |
# 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 ... | vulcansteel/autorest | AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/models/product.py | Python | mit | 931 | 0 |
from __future__ import print_function, division
import cPickle
import gzip
import os
import sys
import timeit
import numpy
import theano
from theano import tensor
import mdn_one_ahead
# parameters
batch_size = 100
L1_reg=0.00
L2_reg=0.0001
n_epochs=200
learning_rate = 0.001
momentum = 0.9
sigma_in = 320
mixing_in = ... | markstoehr/structured_gaussian_mixtures | structured_gaussian_mixtures/mdn_experiment_one_ahead.py | Python | apache-2.0 | 5,886 | 0.002039 |
from ubluepy import Scanner, constants
def bytes_to_str(bytes):
string = ""
for b in bytes:
string += chr(b)
return string
def get_device_names(scan_entries):
dev_names = []
for e in scan_entries:
scan = e.getScanData()
if scan:
for s in scan:
if ... | adafruit/micropython | ports/nrf/examples/ubluepy_scan.py | Python | mit | 923 | 0.005417 |
# -*- coding: utf-8 -*-
from dp_tornado.engine.controller import Controller
class MmddController(Controller):
def get(self):
self.model.tests.helper_test.datetime.switch_timezone('Asia/Seoul')
ts = 1451671445
ms = ts * 1000
dt = self.helper.datetime.convert(timestamp=ts)
... | why2pac/dp-tornado | example/controller/tests/view/ui_methods/mmdd.py | Python | mit | 1,216 | 0.004934 |
# -*- coding: utf-8 -*-
#
# This file is part of JSONAlchemy.
# Copyright (C) 2013, 2014, 2015 CERN.
#
# JSONAlchemy 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 yo... | tiborsimko/jsonalchemy | jsonalchemy/jsonext/functions/util_split.py | Python | gpl-2.0 | 1,313 | 0.000762 |
# -*- coding: utf-8 -*-
#
# Copyright 2018 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... | jonparrott/google-cloud-python | spanner/google/cloud/spanner_admin_database_v1/types.py | Python | apache-2.0 | 1,907 | 0 |
import datetime
import os
import shutil
import tarfile
import tempfile
from django.conf import settings
from django.utils import timezone
from celery import shared_task
from celery.utils.log import get_task_logger
from grout.models import RecordType
from black_spots.tasks import (
forecast_segment_incidents,
... | WorldBank-Transport/DRIVER | app/black_spots/tasks/calculate_black_spots.py | Python | gpl-3.0 | 4,985 | 0.004814 |
import unittest
import numpy as np
from collections import OrderedDict
from gtrackcore.metadata import GenomeInfo
from gtrackcore.track.core.GenomeRegion import GenomeRegion
from gtrackcore.track.format.TrackFormat import TrackFormat
from gtrackcore.track_operations.operations.Flank import Flank
from gtrackcore.track... | sivertkh/gtrackcore | gtrackcore/test/track_operations/FlankTest.py | Python | gpl-3.0 | 3,882 | 0.000258 |
# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
__author__ = "alex"
__date__ = "$Jun 1, 2015 10:46:55 PM$"
from math import radians, sin, cos, sqrt, asin
from bs4 import BeautifulSoup
from ty... | Dr762/PythonExamples3.4 | Python3/restraunt_finder.py | Python | gpl-2.0 | 6,651 | 0.001504 |
# -*- coding: utf-8 -*-
# Copyright 2021 El Nogal - Pedro Gómez <pegomez@elnogal.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import registry
from openerp.addons import jasper_reports
def parser(cr, uid, ids, data, context):
parameters = {}
name = 'report.invoice_report_j... | Comunitea/CMNT_00040_2016_ELN_addons | eln_reports/report/invoice/invoice_report_parser.py | Python | agpl-3.0 | 2,501 | 0.0012 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cases', '0018_auto_20170418_1220'),
]
operations = [
migrations.AlterField(
model_name='case',
name=... | HelloLily/hellolily | lily/cases/migrations/0019_auto_20170418_1243.py | Python | agpl-3.0 | 425 | 0 |
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
try:
from crowdin.connection import Connection, Configuration
except ImportError:
from connection import Connection, Configuration
import six
import logging
import json
import zipfile
import shutil
import io
import os
l... | PaulGregor/crowdin-cli | crowdin/methods.py | Python | mit | 19,747 | 0.003393 |
class UndirectedGraphNode:
def __init__(self, x):
self.label = x
self.neighbors = []
#using DFS
class Solution:
# @param node, a undirected graph node
# @return a undirected graph node
def cloneGraph(self, node):
seen={}
visited=[]
seen[None] = None
hea... | bourneagain/pythonBytes | cloneGraph_BFS.py | Python | mit | 1,080 | 0.012037 |
"""Query utils."""
class LuaScript:
def __init__(self, script):
self.script = script
class LuaStoredQuery:
def __init__(self, name, query_args):
self.name = name
self.args = query_args
class LogicalOperator:
def __init__(self, *args):
self.clauses = args
def __str_... | tsileo/blobstash-python-docstore | blobstash/docstore/query.py | Python | mit | 4,218 | 0.000711 |
# -*- coding: UTF-8 -*-
import responses
from helpers import TestCase
from wptranslate.mediawiki import query
class TestMediaWiki(TestCase):
def setUp(self):
self.lang = 'foo'
self.url = 'https://%s.wikipedia.org/w/api.php' % self.lang
@responses.activate
def test_query_return_none_on_... | bfontaine/wptranslate | tests/test_mediawiki.py | Python | mit | 1,013 | 0.002962 |
from __future__ import print_function
from argparse import ArgumentParser
import logging
from nptdms import tdms
def main():
parser = ArgumentParser(
description="List the contents of a LabView TDMS file.")
parser.add_argument(
'-p', '--properties', action="store_true",
help="Include... | nmgeek/npTDMS | nptdms/tdmsinfo.py | Python | lgpl-3.0 | 1,875 | 0 |
# -*- coding: utf-8 -*-
"""
Wind vector calculations in finite differences
"""
from . import iris_api
from . import standard
from . import tools
from . import utils
# List to define the behaviour of imports of the form:
# from pyveccalc import *
__all__ = []
# Package version number.
__version__ = '0.2.9'
| dennissergeev/pyveccalc | pyveccalc/__init__.py | Python | mit | 314 | 0 |
from gym import core
class ArgumentEnv(core.Env):
calls = 0
def __init__(self, arg):
self.calls += 1
self.arg = arg
def test_env_instantiation():
# This looks like a pretty trivial, but given our usage of
# __new__, it's worth having.
env = ArgumentEnv('arg')
assert env.arg ==... | xpharry/Udacity-DLFoudation | tutorials/reinforcement/gym/gym/tests/test_core.py | Python | mit | 353 | 0.005666 |
# Copyright (c) 2017, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doc("core", "doctype", "sms_parameter")
sms_sender_name = frappe.db.get_single_value("SMS Settings", "sms_sender_name")
if sms_s... | vjFaLk/frappe | frappe/patches/v9_1/add_sms_sender_name_as_parameters.py | Python | mit | 651 | 0.021505 |
from bisect import bisect
from uhashring.ring_ketama import KetamaRing
from uhashring.ring_meta import MetaRing
class HashRing:
"""Implement a consistent hashing ring."""
def __init__(self, nodes=[], **kwargs):
"""Create a new HashRing given the implementation.
:param nodes: nodes used to c... | ultrabug/uhashring | uhashring/ring.py | Python | bsd-3-clause | 11,224 | 0.000178 |
# -*- coding: UTF-8 -*-
#
# Copyright © 2003 - 2018 Michal Čihař <michal@cihar.com>
#
# This file is part of Wammu <https://wammu.eu/>
#
# 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 ve... | gammu/wammu | Wammu/App.py | Python | gpl-3.0 | 2,021 | 0.000993 |
#!/usr/bin/python
## CABS_Server.py
# This is the webserver that is at the center of the CABS system.
# It is asynchronous, and as such the callbacks and function flow can be a bit confusing
# The basic idea is that the HandleAgentFactory and HandleClienFactory make new HandleAgents and Handle Clients
# There is one p... | jordan9001/CABS | Source/Broker/CABS_server.py | Python | apache-2.0 | 32,754 | 0.009007 |
import PyQtExtras
from PyQt5.QtWidgets import QFrame, QApplication
import sys
def main(args):
app = QApplication([])
main_frame = QFrame()
list_view = PyQtExtras.ListScrollArea(main_frame)
list_view.add_item_by_string('Item 1')
list_view.add_item_by_string('Item 2')
list_view.add_item_by_s... | jhavstad/model_runner | src/ScrollListViewTest.py | Python | gpl-2.0 | 469 | 0.006397 |
# Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets
# in the array which gives the sum of zero.
#
# Note: The solution set must not contain duplicate triplets.
#
# For example, given array S = [-1, 0, 1, 2, -1, -4],
#
# A solution set is:
# [
# [-1, 0, 1... | jigarkb/CTCI | LeetCode/015-M-3Sum.py | Python | mit | 1,646 | 0.00486 |
# coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import pytest
import functools
from devtools_testutils.aio import recorded_by_proxy_async
from azure.ai.formrecognizer._generated.models import AnalyzeRe... | Azure/azure-sdk-for-python | sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dac_analyze_general_document_async.py | Python | mit | 8,184 | 0.004399 |
#
# $Id: sphinxapi.py 2970 2011-09-23 16:50:22Z klirichek $
#
# Python version of Sphinx searchd client (Python API)
#
# Copyright (c) 2006, Mike Osadnik
# Copyright (c) 2006-2011, Andrew Aksyonoff
# Copyright (c) 2008-2011, Sphinx Technologies Inc
# All rights reserved
#
# This program is free software; you can redist... | apahomov/django-sphinx | djangosphinx/apis/api281/__init__.py | Python | bsd-3-clause | 30,427 | 0.052059 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^register/$', views.register, name='register'),
url(r'^login/$', views.user_login, name='login'),
url(r'^logout/$', views.user_logout, name='logout'),
url(r'^groups/$', views.groups, name='groups'),
url(r'^sitemanager/$', v... | j-windsor/cs3240-f15-team21-v2 | accounts/urls.py | Python | mit | 876 | 0.004566 |
from flask import render_template, jsonify, request
from jsonrpclib import jsonrpc
import base64
import urllib
from maraschino import app, logger
from maraschino.tools import *
def nzbget_http():
if get_setting_value('nzbget_https') == '1':
return 'https://'
else:
return 'http://'
def nzbge... | hephaestus9/Ironworks | modules/plugins/nzbget.py | Python | mit | 3,148 | 0.002224 |
import bottle
from cork import Cork
from utils import skeleton
aaa = Cork('users', email_sender='c.emmery@outlook.com',
smtp_url='smtp://smtp.magnet.ie')
authorize = aaa.make_auth_decorator(fail_redirect='/login', role="user")
def postd():
return bottle.request.forms
def post_get(name, default=''):... | cmry/ebacs | corks.py | Python | bsd-3-clause | 2,583 | 0 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2021, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | mrcslws/nupic.research | src/nupic/research/frameworks/vernon/mixins/sync_batchnorm.py | Python | agpl-3.0 | 1,943 | 0.001544 |
#!/usr/bin/env python
import os
import sys
import glob
import argparse
import logging
import rpy2.robjects as robjects
import utils
rscript = ''
R = robjects.r
def run_rscript(command=None):
"""Run R command, log it, append to rscript"""
global rscript
if not command:
return
logging.debug(com... | vimalkvn/riboseqr_wrapper | riboseqr/ribosome_profile.py | Python | gpl-2.0 | 4,816 | 0.000208 |
from __future__ import absolute_import
from .nihts_xcam import XenicsCamera
| henryroe/xenics_pluto | nihts_xcam/__init__.py | Python | mit | 77 | 0 |
from mock import patch, Mock
from nose.tools import istest
from unittest import TestCase
from structominer import Document, Field
class DocumentTests(TestCase):
@istest
def creating_document_object_with_string_should_automatically_parse(self):
html = '<html></html>'
with patch('structom... | aGHz/structominer | tests/test_document.py | Python | mit | 1,199 | 0.003336 |
#===- disassembler.py - Python LLVM Bindings -----------------*- python -*--===#
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===---------------------------------... | endlessm/chromium-browser | third_party/llvm/llvm/bindings/python/llvm/disassembler.py | Python | bsd-3-clause | 5,918 | 0.002028 |
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
from __future__ import (absolute_import, divi... | mganeva/mantid | scripts/Diffraction/isis_powder/routines/run_details.py | Python | gpl-3.0 | 5,875 | 0.005447 |
import logging
import vcf
from typing import List, Tuple
_logger = logging.getLogger(__name__)
# TODO: for now I'm going to do the lazy thing and just traverse the VCF each time for each sample
def read_sample_segments_and_calls(intervals_vcf: str,
clustered_vcf: str,
... | broadinstitute/hellbender | src/main/python/org/broadinstitute/hellbender/gcnvkernel/io/io_vcf_parsing.py | Python | bsd-3-clause | 4,367 | 0.002977 |
# ARP Suite - Run ARP Commands From Command Line
import sys
import arp_mitm as mitm
import arp_sslstrip as sslstrip
import arp_listen as listen
import arp_request as request
import arp_cache as cache
import arp_reconnaissance as recon
import arp_interactive as interactive
if __name__ == "__main__":
arguments = sys.ar... | monkeesuit/school | Network Security/ARP/arp suite/py/arp.py | Python | mit | 7,562 | 0.031605 |
import sys
reload(sys)
sys.setdefaultencoding("utf8")
from urllib import urlencode
from flask import jsonify, redirect, url_for, abort, request, render_template
from syzoj import oj, controller
from syzoj.models import User, Problem, File, FileParser
from syzoj.controller import Paginate, Tools
from .common import n... | cdcq/jzyzj | syzoj/views/problem.py | Python | mit | 4,193 | 0.00477 |
# -*- coding: utf-8 -*-
from text.classifiers import NaiveBayesClassifier
from textblob import TextBlob
import feedparser
import time
import redis
import hashlib
import json
TIMEOUT = 60*60
REDIS_HOST = '127.0.0.1'
REDIS_PORT = 6379
def feature_extractor(text):
if not isinstance(text, TextBlob):
text =... | tistaharahap/ds-for-me | extractor.py | Python | mit | 7,464 | 0.004555 |
from typing import Sequence
from numbers import Number
from tabulate import tabulate
class Matrix(Sequence):
def __init__(self, matrix: Sequence[Sequence[float]]):
assert (isinstance(matrix, Sequence) and
isinstance(matrix, Sequence)), "Wrong data"
self.__matrix = [[float(x) for x ... | FeodorM/Computer-Graphics | util/matrix.py | Python | mit | 2,886 | 0.000704 |
"""Code for constructing CTMCs and computing transition probabilities
in them."""
from numpy import zeros
from scipy import matrix
from scipy.linalg import expm
class CTMC(object):
"""Class representing the CTMC for the back-in-time coalescent."""
def __init__(self, state_space, rates_table):
"""Cre... | mailund/IMCoalHMM | src/IMCoalHMM/CTMC.py | Python | gpl-2.0 | 2,581 | 0.001937 |
# Copyright 2011 Eldar Nugaev
# 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 ... | rahulunair/nova | nova/tests/unit/api/openstack/compute/test_keypairs.py | Python | apache-2.0 | 27,057 | 0 |
from webargs import fields
from ..api.validators import Email, password
user_args = {
'email': fields.Str(validate=Email, required=True),
'password': fields.Str(validate=password, required=True)
}
role_args = {
'name': fields.Str(required=True),
'description': fields.Str(required=True)
}
| teracyhq/flask-boilerplate | app/api_1_0/args.py | Python | bsd-3-clause | 308 | 0 |
#!/usr/bin/python
#
# Copyright (C) 2008 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 ... | alon/polinax | libs/external_libs/gdata.py-1.0.13/src/gdata/contacts/service.py | Python | gpl-2.0 | 5,972 | 0.009377 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-08-17 01:43
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('website', '0037_auto_20170813_0319'),
]
operations = [
migrations.AddField(
... | goyal-sidd/BLT | website/migrations/0038_issue_upvotes.py | Python | agpl-3.0 | 447 | 0 |
# pylint: disable=g-bad-file-header
# Copyright 2020 DeepMind Technologies Limited. 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/... | GoogleCloudPlatform/covid-19-open-data | src/england_data/standardize_data.py | Python | apache-2.0 | 21,282 | 0.010384 |
# -*- coding: utf-8 -*-
import datetime
from openerp import http
from openerp.http import request
from openerp.addons.website_portal.controllers.main import website_account
class website_account(website_account):
@http.route(['/my/home'], type='http', auth="user", website=True)
def account(self, **kw):
... | stephen144/odoo | addons/website_portal_sale/controllers/main.py | Python | agpl-3.0 | 1,940 | 0.001546 |
# 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.
from telemetry.page import page as page_module
from telemetry.page import shared_page_state
from telemetry import story
class KeySearchMobilePage(page_modul... | js0701/chromium-crosswalk | tools/perf/page_sets/key_search_mobile.py | Python | bsd-3-clause | 2,523 | 0.003567 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.