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 |
|---|---|---|---|---|---|---|
import collections
class Command:
def __init__(self, template):
self._values = template
def __getitem__(self, key):
value = self._values[key]
if isinstance(value, dict) or isinstance(value, list):
return Command(value)
return self._values[key]
def __setitem__(s... | Fakor/congov | cli/lib/command.py | Python | mit | 530 | 0.001887 |
from django.conf import settings
from gnip_search.gnip_search_api import GnipSearchAPI
from gnip_search.gnip_search_api import QueryError as GNIPQueryError
class Frequency:
"""
Class collection for Frequency
"""
DATE_FORMAT = "%Y-%m-%d %H:%M"
def __init__(self, query, sample, start, end):
... | twitterdev/data-ads-sample | home/frequency.py | Python | mit | 1,443 | 0.000693 |
from dive_operator import DiveOperator
from dive_python_operator import DivePythonOperator
__all__ = ['DiveOperator', 'DivePythonOperator']
| industrydive/fileflow | fileflow/operators/__init__.py | Python | apache-2.0 | 141 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from bottle import route, get, post, view, run, app, default_app, static_file
from palpite import palpite
@get('/')
@view('index.html')
def index_get():
return dict()
@post('/')
@view('index.html')
def index_post():
gera_palpite = palpite()
return dict(jogo=gera_... | marciocg/palpite-megasena | palpite-megasena.py | Python | gpl-2.0 | 708 | 0.009887 |
"""
ONE-TIME UPDATE OF converting SubredditPage.created_at, FrontPage.created_at to utc
Daylight Savings Time = Nov 6 2am
if we see the ET time Nov 6 12am, then it is EDT: EDT-->UTC = +4 = Nov 6 4am
if we see the ET time Nov 6 1-2am, then it is unclear whether it is EDT or EST; assume it is EST
> assumption is bec... | c4fcm/CivilServant | utils/data_migrations/12.06.2016.updated_page_created_at_to_utc.py | Python | mit | 2,850 | 0.022105 |
"""Contains a baseclass for plugins."""
###############################################################################
#
# TODO: [ ]
#
###############################################################################
# standard library imports
from collections import Iterable
from functools import wraps
import loggin... | Sirs0ri/PersonalAssistant | samantha/plugins/plugin.py | Python | mit | 4,002 | 0 |
class A:
def test(self):
print "I##|nitializing A", "test"##|
attribute = "hello"
def my_method(self):
print self.attribute
a = A()
a.test()
##r Should expand to Full String "Initializing A"
# Invalid selection:
# nitializing A", "test" | aptana/Pydev | tests/org.python.pydev.refactoring.tests/src/python/visitor/selectionextension/testSelectionExtensionExprFail.py | Python | epl-1.0 | 286 | 0.027972 |
#!/usr/bin/env python
# This document is part of CrowdProjects
# https://github.com/skytruth/CrowdProjects
# =========================================================================== #
#
# Copyright (c) 2014, SkyTruth
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without... | SkyTruth/CrowdProjects | Data/FrackFinder/PA/2013/Transformations_and_QAQC/MoorFrog/bin/task2shp.py | Python | bsd-3-clause | 22,106 | 0.002171 |
"""Module defining ``Eigensolver`` classes."""
import numpy as np
from gpaw.utilities.blas import axpy
from gpaw.eigensolvers.eigensolver import Eigensolver
from gpaw import extra_parameters
class RMM_DIIS(Eigensolver):
"""RMM-DIIS eigensolver
It is expected that the trial wave functions are orthonormal
... | robwarm/gpaw-symm | gpaw/eigensolvers/rmm_diis_old.py | Python | gpl-3.0 | 4,714 | 0.001697 |
"""empty message
Revision ID: 2728b7328b78
Revises: d7c7f3be40a
Create Date: 2015-10-20 13:44:12.129389
"""
# revision identifiers, used by Alembic.
revision = '2728b7328b78'
down_revision = 'd7c7f3be40a'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - pl... | litnimax/astconfman | astconfman/migrations/versions/2728b7328b78_.py | Python | agpl-3.0 | 724 | 0.012431 |
# Copyright 2022 Google LLC. 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 o... | GoogleCloudPlatform/declarative-resource-client-library | python/services/identitytoolkit/alpha/tenant.py | Python | apache-2.0 | 10,881 | 0.002022 |
# -*- coding: utf-8 -*-
"""The application's model objects"""
from zope.sqlalchemy import ZopeTransactionExtension
from sqlalchemy.orm import scoped_session, sessionmaker
# from sqlalchemy import MetaData
from sqlalchemy.ext.declarative import declarative_base
# Global session manager: DBSession() returns the Thread-l... | LamCiuLoeng/internal | tribal/model/__init__.py | Python | mit | 6,536 | 0.009945 |
import os
import flask
import memdam.blobstore.localfolder
import memdam.eventstore.sqlite
from memdam.server.web import app
def get_archive(username):
"""
:param username: the name of the user for which we should get the event archive
:type username: string
:returns: a new (or cached) archive
... | joshalbrecht/memdam | memdam/server/web/utils.py | Python | gpl-2.0 | 1,213 | 0.003298 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from nipype.testing import assert_equal
from nipype.interfaces.semtools.utilities.brains import BRAINSInitializedControlPoints
def test_BRAINSInitializedControlPoints_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
use... | wanderine/nipype | nipype/interfaces/semtools/utilities/tests/test_auto_BRAINSInitializedControlPoints.py | Python | bsd-3-clause | 1,433 | 0.020237 |
#! /usr/bin/python
# Copyright (c) 2015, Matthew P. Grosvenor
# 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
# ... | camsas/qjump-nsdi15-plotting | table1/do_hist.py | Python | bsd-3-clause | 2,737 | 0.008403 |
import psyco
psyco.full()
import linker.coff
from linker import store
m,n='python26.dll','Py_DecRef'
localname = None,'__imp__<%s!%s>'%(m,n)
if True:
# this should import from python26.lib,Py_DecRef
# this should export ia32.obj,stuff
a = linker.coff.object.open('~/work/syringe/src/ia32.obj')
# impor... | arizvisa/syringe | src/hooktest.py | Python | bsd-2-clause | 3,457 | 0.01186 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from unittest import TestLoader, TextTestRunner, TestSuite
from hwt.simulator.simTestCase import SimTestCase
from hwtLib.abstract.busEndpoint_test import BusEndpointTC
from hwtLib.abstract.frame_utils.alignment_utils_test import FrameAlignmentUtilsTC
from hwtL... | Nic30/hwtLib | hwtLib/tests/all.py | Python | mit | 22,367 | 0.001162 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 ... | 244xiao/blender-java | blender-java/src/resources/release/scripts/ui/properties_data_metaball.py | Python | gpl-2.0 | 3,814 | 0.000524 |
import os
def create_fds():
(fd1, fd2) = os.pipe()
return (os.fdopen(fd2, "w"), os.fdopen(fd1, "r"))
def filename(pipef):
return 'pipe:[%d]' % os.fstat(pipef.fileno()).st_ino
def dump_opts(sockf):
return [ ]
| ldu4/criu | test/inhfd/pipe.py | Python | lgpl-2.1 | 215 | 0.037209 |
"""MiniAEFrame - A minimal AppleEvent Application framework.
There are two classes:
AEServer -- a mixin class offering nice AE handling.
MiniApplication -- a very minimal alternative to FrameWork.py,
only suitable for the simplest of AppleEvent servers.
"""
from warnings import warnpy3k
warnpy3k("In 3... | teeple/pns_server | work/install/Python-2.7.4/Lib/plat-mac/MiniAEFrame.py | Python | gpl-2.0 | 6,519 | 0.004295 |
"""
Test basic std::weak_ptr functionality.
"""
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestSharedPtr(TestBase):
mydir = TestBase.compute_mydir(__file__)
@add_test_categories(["libc++"])
@skipIf(compiler=no_match("clang"))
... | endlessm/chromium-browser | third_party/llvm/lldb/test/API/commands/expression/import-std-module/weak_ptr/TestWeakPtrFromStdModule.py | Python | bsd-3-clause | 944 | 0.003178 |
"""Support for Alexa skill auth."""
import asyncio
from datetime import timedelta
import json
import logging
import aiohttp
import async_timeout
from homeassistant.core import callback
from homeassistant.helpers import aiohttp_client
from homeassistant.util import dt
_LOGGER = logging.getLogger(__name__)
LWA_TOKEN_... | postlund/home-assistant | homeassistant/components/alexa/auth.py | Python | apache-2.0 | 5,485 | 0.000365 |
import requests
import time
import json
# ------------ Do data need to roll
def roll_data_if_needed(secondsAllowed):
# calculate last time
last_roll_time = get_status()
now = int(time.time())
time_since_roll = now - last_roll_time
# do I need to roll?
if time_since_roll > secondsAllowed:
... | mrnohr/pi-temperature-firebase | firebase_log_roll.py | Python | mit | 1,702 | 0.006463 |
"""
Tests for the plugin API
"""
from __future__ import absolute_import
from django.test import TestCase
from openedx.core.lib.plugins import PluginError
from openedx.core.lib.course_tabs import CourseTabPluginManager
class TestCourseTabApi(TestCase):
"""
Unit tests for the course tab plugin API
"""
... | ESOedX/edx-platform | openedx/core/lib/tests/test_course_tab_api.py | Python | agpl-3.0 | 653 | 0 |
#!/usr/bin/env python
# File created on 09 Aug 2012
from __future__ import division
__author__ = "Jon Sanders"
__copyright__ = "Copyright 2014, Jon Sanders"
__credits__ = ["Jon Sanders"]
__license__ = "GPL"
__version__ = "1.9.1"
__maintainer__ = "Jon Sanders"
__email__ = "jonsan@gmail.com"
__status__ = "Development"
... | tanaes/decontaminate | decontaminate_unitary.py | Python | mit | 40,011 | 0.006148 |
#!/usr/bin/env vpython
# Copyright 2016 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.
"""A script to recover devices in a known bad state."""
import argparse
import glob
import logging
import os
import signal
import sys
... | catapult-project/catapult | devil/devil/android/tools/device_recovery.py | Python | bsd-3-clause | 9,284 | 0.010448 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018-2019 Matthias Klumpp <matthias@tenstral.net>
#
# Licensed under the GNU Lesser General Public License Version 3
#
# 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... | tanglu-org/laniakea | src/lighthouse/lighthouse/events_receiver.py | Python | gpl-3.0 | 3,808 | 0.002101 |
from __future__ import absolute_import
from collections import namedtuple
# Other useful structs
TopicPartition = namedtuple("TopicPartition",
["topic", "partition"])
BrokerMetadata = namedtuple("BrokerMetadata",
["nodeId", "host", "port", "rack"])
PartitionMetadata = namedtuple("PartitionMetadata",
["... | mumrah/kafka-python | kafka/structs.py | Python | apache-2.0 | 801 | 0.008739 |
import argparse
import changeling_client.api
import changeling_client.commands
parser = argparse.ArgumentParser()
parser.add_argument('--endpoint', required=True)
subparsers = parser.add_subparsers()
changeling_client.commands.register(subparsers)
def main():
args = parser.parse_args()
service = changelin... | bcwaldon/changeling-client | changeling_client/core.py | Python | apache-2.0 | 386 | 0 |
"""Implements generic utilities for monitoring classes.
"""
import sys
import re
import subprocess
import urllib, urllib2
import socket
import telnetlib
__author__ = "Ali Onur Uyar"
__copyright__ = "Copyright 2011, Ali Onur Uyar"
__credits__ = []
__license__ = "GPL"
__version__ = "0.9.12"
__maintainer__ = "Ali Onur... | aouyar/PyMunin | pysysinfo/util.py | Python | gpl-3.0 | 13,551 | 0.006937 |
"""EAS two-devices turn
Revision ID: 17dc9c049f8b
Revises: ad7b856bcc0
Create Date: 2014-10-21 20:38:14.311747
"""
# revision identifiers, used by Alembic.
revision = '17dc9c049f8b'
down_revision = 'ad7b856bcc0'
from datetime import datetime
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import... | Eagles2F/sync-engine | migrations/versions/115_eas_twodevices_turn.py | Python | agpl-3.0 | 3,146 | 0.003179 |
import asyncio
import pip
import pickle
import os.path
try:
import discord
except:
pip.main(['install', 'git+https://github.com/Rapptz/discord.py@async#egg=discord.py'])
try:
import win_unicode_console
except:
0
try:
from lxml import html
except ImportError:
pip.main(['install', 'lxml'])
t... | Wicloz/AnimeNotifierBot | bot.py | Python | mit | 8,060 | 0.005335 |
'''trec_dd.* namespace package can have several subpackages, see
http://github.com/trec-dd for more info
.. This software is released under an MIT/X11 open source license.
Copyright 2015 Diffeo, Inc.
'''
import pkg_resources
pkg_resources.declare_namespace(__name__)
| trec-dd/trec-dd-simulation-harness | trec_dd/__init__.py | Python | mit | 272 | 0 |
# Copyright (c) 2001-2015, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public tr... | CanalTP/navitia | source/jormungandr/jormungandr/scenarios/journey_filter.py | Python | agpl-3.0 | 32,453 | 0.00265 |
from django import forms
from depotwork.questions.models import Question, Answer
class QuestionForm(forms.ModelForm):
title = forms.CharField(widget=forms.TextInput(attrs={'class':'form-control'}),
max_length=255)
description = forms.CharField(widget=forms.Textarea(attrs={'class':'form-control'}),
... | lirui0081/depotwork | depotwork/questions/forms.py | Python | mit | 1,000 | 0.023 |
"""
==========================================
Author: Tyler Brockett
Username: /u/tylerbrockett
Description: Alert Bot (Formerly sales__bot)
Date Created: 11/13/2015
Date Last Edited: 12/20/2016
Version: v2.0
==========================================
"""
import praw
im... | tylerbrockett/reddit-bot-buildapcsales | src/bot_modules/reddit_handler.py | Python | mit | 3,944 | 0.002535 |
#!/usr/bin/python2
import collections
import os
from loranode import RN2483Controller
# from ../_examplify.py import Examplify
import os
os.sys.path.append(os.path.dirname(os.path.abspath('.')))
from _examplify import Examplify
import lora, pmt, osmosdr
from gnuradio import gr, blocks
class ReceiveWhitening:
de... | Wosser1sProductions/gr-lora | examples/lora-whitening/createWhiteningValues.py | Python | gpl-3.0 | 3,178 | 0.011328 |
#
# Allows GTK 3 python applications to exit when CTRL-C is raised
# From https://bugzilla.gnome.org/show_bug.cgi?id=622084
#
# Author: Simon Feltman
# License: Presume same as pygobject
#
import sys
import signal
from typing import ClassVar, List
from gi.repository import GLib
class InterruptibleLoopContext:
... | exaile/exaile | xl/externals/sigint.py | Python | gpl-2.0 | 2,472 | 0.002427 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | var/spack/repos/builtin/packages/texlive/package.py | Python | lgpl-2.1 | 3,446 | 0.00058 |
import os
import qprompt
path = qprompt.ask_str("Enter path to file", vld=lambda x: os.path.isfile(x))
size = qprompt.ask_int("Enter number less than 10", vld=lambda x: x < 10)
| jeffrimko/Qprompt | examples/ask_2.py | Python | mit | 177 | 0 |
import os
from unittest import skip
from django.core.files.base import ContentFile
from django.core.urlresolvers import reverse
from onadata.apps.main.views import show, form_photos, update_xform, profile,\
enketo_preview
from onadata.apps.logger.models import XForm
from onadata.apps.logger.views import download_... | jomolinare/kobocat | onadata/apps/main/tests/test_form_show.py | Python | bsd-2-clause | 18,586 | 0 |
# Copyright (c) 2017 SUSE LLC
import logging
import re
import subprocess
# Run a command, and return the result in string format, stripped. Return None if command fails.
def _run_cmd(cmd_array):
try:
return subprocess.check_output(cmd_array).decode("utf-8").strip()
except subprocess.CalledProcessErro... | ceph/ceph-docker | maint-lib/stagelib/git.py | Python | apache-2.0 | 1,889 | 0.004764 |
#!/usr/bin/env python
##########################
# Modules import.
##########################
import f_dist # to prevent segmentation fault
import os
import logging
import sys, argparse
import numpy as np
import time
from shutil import copy as shcopy
import modules as mod
####################################... | brunetto/MasterThesisCode | master_code/otherMiscCode/CF_CCF-code-template/serial.py | Python | mit | 14,251 | 0.008841 |
#!/bin/python
import suds
from suds.client import Client
u = 'http://owsx:owsx_user@localhost:8080/orawsv/OWSX/OWSX_UTL/PAY_RAISE'
h = {'User-Agent':'Mozilla/4.0'}
client = Client(u)
print(client)
| devnull5475/SI_ORAWSV_POC | src/test/py/test.py | Python | gpl-2.0 | 206 | 0.004854 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-08-06 14:35
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('players', '0006_statistics'),
]
operations = [
... | xeroz/admin-django | apps/players/migrations/0007_auto_20170806_1435.py | Python | mit | 561 | 0.001783 |
import curses
from pygments import token
class ColorProfile:
def __init__(self):
self._map = {
token.Text : 4,
token.Keyword : 3,
token.Comment : 2,
token.Number : 5,
token.Name : 6,
token.Error : 7,
token.Punctuation : 8,
token.Whitespace : 0
}
def color_for(self, attr):
#this shoul... | federicotdn/piter | src/colors.py | Python | gpl-3.0 | 477 | 0.069182 |
"""
Definition of models.
"""
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
# python manage.py makemigrations app
progress = models.IntegerField(default=0)
progress_v1 = models.IntegerField(default=0)
progress_v2 = models.IntegerField(default=0)
progress_v3 = mod... | 0909023/Dev6B_English_Website | DjangoWebProject1/DjangoWebProject1/app/models.py | Python | mit | 1,227 | 0.00978 |
import pandas as pd
import numpy as np
import warnings
from clint.textui import colored
warnings.simplefilter("ignore")
class Sweetcat:
"""Load SWEET-Cat database"""
def __init__(self):
# self.fname_sc = 'WEBSITE_online_EU-NASA_full_database.rdb'
self.fname_sc = 'WEBSITE_online_EU-NASA_full_d... | DanielAndreasen/SWEET-Cat | checkDuplicates.py | Python | mit | 4,561 | 0.000658 |
from .logic import LogicAdapter
class NoKnowledgeAdapter(LogicAdapter):
"""
This is a system adapter that is automatically added
to the list of logic adapters durring initialization.
This adapter is placed at the beginning of the list
to be given the highest priority.
"""
def process(self... | imminent-tuba/thesis | server/chatterbot/chatterbot/adapters/logic/no_knowledge_adapter.py | Python | mit | 659 | 0 |
# Copyright 2008-2010 by Peter Cock. All rights reserved.
#
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Bio.AlignIO support for the "nexus" file format.
You are expected to use this module... | Ambuj-UF/ConCat-1.0 | src/Utils/Bio/AlignIO/NexusIO.py | Python | gpl-2.0 | 7,881 | 0.002665 |
from django.apps import apps
from django.conf import settings
from django.core import checks
from django.db import connections as django_connections, DEFAULT_DB_ALIAS, router
from corehq.sql_db.exceptions import PartitionValidationError
@checks.register('settings')
def custom_db_checks(app_configs, **kwargs):
er... | dimagi/commcare-hq | corehq/sql_db/__init__.py | Python | bsd-3-clause | 5,334 | 0.002437 |
# snapy - a python snmp library
#
# Copyright (C) 2009 ITA Software, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 2 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be ... | marineam/nagcat | python/snapy/netsnmp/unittests/test_netsnmp.py | Python | apache-2.0 | 4,936 | 0.003241 |
from __future__ import unicode_literals
import sys
sys.path = sys.path[1:]
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import render, render_to_response
from django.core.mail import send_mail
from django.conf import settings
import os
def blog(request):
context = {}
context... | neuropower/neuropower | neuropower/apps/blog/views.py | Python | mit | 393 | 0.015267 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Raspberry.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that th... | CodeHuntersLab/RaspberryPi | WEB/Raspberry/manage.py | Python | gpl-3.0 | 807 | 0 |
from . import account_journal
from . import barcode_rule
from . import pos_config
from . import pos_order
from . import product_category
from . import product_template
| lachouettecoop/chouette-odoo | addons/chouette/pos_meal_voucher/models/__init__.py | Python | gpl-2.0 | 168 | 0 |
import numpy as np
from moha.system.basis import SlaterDeterminant
class state(object):
def __init__(self):
pass
class WaveFunction(state):
def __init__(self):
pass
class HFWaveFunction(WaveFunction):
"""
"""
def __init__(self,dim,occ,coefficient,density,fock,eorbitals,Eelec,Etot)... | fhqgfss/MoHa | moha/system/state.py | Python | mit | 741 | 0.017544 |
from setuptools import setup
'''
The packages subprocess and tkinter is also required from the standard library
'''
setup(
name='PLOD',
version='1.0',
description='Matplotlib plot designer',
author='David Kleiven',
licence='MIT',
author_email='davidkleiven446@gmail.com',
install_requires=['... | davidkleiven/PLOD | setup.py | Python | mit | 534 | 0.001873 |
import deck
class Hand:
def __init__(self):
self.cards = []
def add(self, card):
self.cards.append(card)
def size(self):
return len(self.cards)
def score(self):
# sperate cards into aces and others
regular_cards = [c for c in self.cards if c.value != "A"]
... | chrfrantz/op-papers | oosd/week02/blackjack/hand.py | Python | gpl-3.0 | 952 | 0.003151 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-dialogflow-cx | google/cloud/dialogflowcx_v3/services/flows/transports/base.py | Python | apache-2.0 | 9,463 | 0.001585 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import zmq
from zmq.eventloop import ioloop as ioloop_mod
import zmqdecorators
import time
SERVICE_NAME = "urpobot.motor"
SERVICE_PORT = 7575
SIGNALS_PORT = 7576
# How long to wait for new commands before stopping automatically
COMMAND_GRACE_TIME = 0.250
class motorserv... | HelsinkiHacklab/urpobotti | python/motorctrl.py | Python | mit | 3,257 | 0.00522 |
# Include the Dropbox SDK
import dropbox
class DropBoxSDK():
# Get your app key and secret from the Dropbox developer website
app_key = ''
app_secret = ''
def authorize(self):
flow = dropbox.client.DropboxOAuth2FlowNoRedirect(self.app_key, self.app_secret)
authorize_url = flow.start()
# Have the ... | anithag/Shield | Authenticate.py | Python | gpl-2.0 | 851 | 0.025852 |
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
import os.path
import subprocess
import sys
libpg_query = os.path.join('.', 'libpg_query')
class PSqlParseBuildExt(build_ext):
def run(self):
return_code = subprocess.call(['make', '-C', libpg_query, 'build'])
... | alculquicondor/psqlparse | setup.py | Python | bsd-3-clause | 1,405 | 0 |
import sys
import gc
import pygame
from pygame.locals import *
from input import *
import snd
TICKS_PER_SECOND = 25
GAMETICKS = 1000 / TICKS_PER_SECOND
def set_game_speed( slowdown ):
global TICKS_PER_SECOND
global GAMETICKS
TICKS_PER_SECOND = int( 25 * slowdown )
GAMETICKS = 100... | koonsolo/MysticMine | monorail/koon/app.py | Python | mit | 4,111 | 0.016784 |
#!/usr/bin/env python
import errno
import os
import re
import sys
from configparser import ConfigParser
import jinja2
from errbot.version import VERSION
def new_plugin_wizard(directory=None):
"""
Start the wizard to create a new plugin in the current working directory.
"""
if directory is None:
... | apophys/err | errbot/plugin_wizard.py | Python | gpl-3.0 | 4,848 | 0.001444 |
#! /usr/bin/env python
import logging, logtool
from .page import Page
from .xlate_frame import XlateFrame
LOG = logging.getLogger (__name__)
class Contents:
@logtool.log_call
def __init__ (self, canvas, objects):
self.canvas = canvas
self.objects = objects
@logtool.log_call
def render (self):
w... | clearclaw/xxpaper | xxpaper/contents.py | Python | gpl-3.0 | 590 | 0.030508 |
from PyQt5 import QtWidgets, uic, QtCore
import sys
class MainWindow(QtWidgets.QMainWindow):
def __init__(self, *args, **kwargs):
# Load the UI Page. uic is the thing that lets us use a .ui file
# This only works if the .ui file is in the same directory
super(MainWindow, self).__in... | UVicRocketry/Hybrid-Test-Stand-Control | client/hybrid_test_backend.py | Python | gpl-3.0 | 4,879 | 0.005124 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# 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) an... | hryamzik/ansible | lib/ansible/parsing/yaml/dumper.py | Python | gpl-3.0 | 2,336 | 0.001284 |
#
# This file is part of Invenio.
# Copyright (C) 2016, 2017 CERN.
#
# Invenio 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.
#
# Inve... | hachreak/invenio-access | invenio_access/alembic/67ba0de65fbb_create_access_branch.py | Python | gpl-2.0 | 1,279 | 0 |
import angr
######################################
# socket
######################################
class socket(angr.SimProcedure):
#pylint:disable=arguments-differ
def run(self, domain, typ, protocol):
conc_domain = self.state.solver.eval(domain)
conc_typ = self.state.solver.eval(typ)
... | iamahuman/angr | angr/procedures/posix/socket.py | Python | bsd-2-clause | 728 | 0.005495 |
import os
import numpy as np
import sfh_tests
import ResolvedStellarPops as rsp
from TPAGBparams import snap_src
import galaxy_tests
def ms_color_cut():
comp90 = sfh_tests.read_completeness_table(absmag=True)
tri_dir = os.environ['TRILEGAL_ROOT']
# make these simulations by editing a constant sf trilegal f... | philrosenfield/TPAGB-calib | selection_tests.py | Python | bsd-3-clause | 8,573 | 0.008748 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from nose.tools import assert_raises
from nose.tools import assert_dict_equal
from numpy.testing import assert_array_equal
from numpy.testing ... | bnoi/scikit-tracker | sktracker/trajectories/tests/test_trajectories.py | Python | bsd-3-clause | 14,672 | 0.003476 |
from __future__ import absolute_import, division, print_function
from functools import partial, wraps
from itertools import product, repeat
from math import factorial, log, ceil
import operator
import numpy as np
from toolz import compose, partition_all, merge, get, accumulate, pluck
from . import chunk
from .core i... | cowlicks/dask | dask/array/reductions.py | Python | bsd-3-clause | 22,730 | 0.001232 |
# Generated from STIXPattern.g4 by ANTLR 4.9.2
from antlr4 import *
if __name__ is not None and "." in __name__:
from .STIXPatternParser import STIXPatternParser
else:
from STIXPatternParser import STIXPatternParser
# This class defines a complete generic visitor for a parse tree produced by STIXPatternParser.... | oasis-open/cti-pattern-validator | stix2patterns/v21/grammars/STIXPatternVisitor.py | Python | bsd-3-clause | 6,827 | 0.01787 |
def Woody():
# complete
print "Reach for the sky but don't burn your wings!"# this will make it much easier in future problems to see that something is actually happening | forgeousgeorge/new_dir | code.py | Python | mit | 179 | 0.01676 |
# This file is part of Mylar.
#
# Mylar 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.
#
# Mylar is distributed in the hope that... | evilhero/mylar | mylar/parseit.py | Python | gpl-3.0 | 36,412 | 0.010354 |
from __future__ import unicode_literals, division, absolute_import
import logging
import threading
import hashlib
import random
import socket
from sqlalchemy import Column, Integer, Unicode
from flask import Flask, abort, redirect
from flask.ext.login import UserMixin
from flexget import options, plugin
from flexget... | offbyone/Flexget | flexget/webserver.py | Python | mit | 9,166 | 0.002837 |
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
#
# 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 lat... | retr0h/ansible | lib/ansible/inventory/__init__.py | Python | gpl-3.0 | 15,950 | 0.005078 |
import re, requests, csv, time, traceback
from bs4 import BeautifulSoup
teams = []
for group in ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']:
try:
url = "http://www.oddschecker.com/football/champions-league/champions-league-group-%s/to-qualify" % group
print "getting {}".format(url)
soup = Beau... | Saturn/champsleagueviz | qualify/dl.py | Python | mit | 1,765 | 0.006799 |
# 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
# distributed under the... | damien-dg/horizon | openstack_dashboard/contrib/sahara/api/sahara.py | Python | apache-2.0 | 15,639 | 0 |
from bson.objectid import ObjectId
import json
class Room():
def __init__(self, players_num, objectid, table, current_color='purple'):
if players_num:
self.players_num = players_num
else:
self.players_num = 0
for el in ['p', 'b', 'g', 'r']:
if ... | Andrey-Tkachev/infection | models/room.py | Python | mit | 6,066 | 0.000989 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# anchor extraction from html document
from bs4 import BeautifulSoup
import urllib2
import urlparse
import re
import csv
import time
cityId='712'
webpage = urllib2.urlopen('http://domofoto.ru/list.php?cid='+cityId)
soup = BeautifulSoup(webpage)
maxST=0
for eleme... | trolleway/domofoto_parser | parce_city.py | Python | cc0-1.0 | 4,024 | 0.044757 |
from xmlrpclib import Fault
from yaml import dump
from twisted.internet.defer import succeed, inlineCallbacks
from juju.errors import ProviderError
from juju.lib.testing import TestCase
from juju.providers.orchestra.machine import OrchestraMachine
from juju.providers.orchestra.tests.common import OrchestraTestMixin
... | mcclurmc/juju | juju/providers/orchestra/tests/test_bootstrap.py | Python | agpl-3.0 | 5,474 | 0 |
# -*- coding: utf-8 -*-
# HORTON: Helpful Open-source Research TOol for N-fermion systems.
# Copyright (C) 2011-2015 The HORTON Development Team
#
# This file is part of HORTON.
#
# HORTON is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by th... | eustislab/horton | horton/io/test/test_cp2k.py | Python | gpl-3.0 | 2,512 | 0.004379 |
#!/usr/bin/python
from cm_api.api_client import ApiResource
import time
api = ApiResource(sys.argv[1], 7180, "acm", "SCALE42secretly", version=15)
cluster = None
try:
cluster = api.get_cluster(name = "ACM Cluster")
except Exception, e:
if e.message[-10:-1].lower() == "not found":
print "<ACM CLUSTER> NOT FOUND !... | krakky/market | cloudera_cdh/bin/ubuntu/xenial/12-activate-parcel.py | Python | apache-2.0 | 1,599 | 0.026892 |
# -*- coding: utf-8 -*-
{
"A location that specifies the geographic area for this region. This can be a location from the location hierarchy, or a 'group location', or a location that has a boundary for the area.": 'この地域を地理的に指定するロケーション。これはロケーションの階層構造のうちの一つか、ロケーショングループの一つか、この地域の境界に面するロケーションです。',
"Acronym of the organ... | bobrock/eden | languages/ja.py | Python | mit | 353,167 | 0.022626 |
# -*- coding: utf-8 -*-
# Copyright (C) 2012-2018 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed ... | j-mracek/dnf | tests/test_config.py | Python | gpl-2.0 | 5,503 | 0.000545 |
# -*- coding: utf-8 -*-
# Copyright 2015 Telefonica Investigación y Desarrollo, S.A.U
#
# This file is part of FIWARE project.
#
# 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://w... | telefonicaid/fiware-facts | tests/acceptance/fiwarecloto_client/client.py | Python | apache-2.0 | 4,297 | 0.002095 |
#!/usr/bin/env python
#import logging
from webserver import *
if __name__ == '__main__':
#logging.basicConfig(
# format="[%(asctime)s] %(name)s/%(levelname)-6s - %(message)s",
# level=logging.CRITICAL,
# datefmt='%Y-%m-%d %H:%M:%S'
#)
# Only enable debug level for bbot
#logger =... | elamperti/bastardbot | webserver.py | Python | mit | 507 | 0.013807 |
# -*- coding: utf-8 -*-
import logging
# define here the methods needed to be run at install time
def importVarious(context):
if context.readDataFile('sc.blueprints.soundcloud_various.txt') is None:
return
logger = logging.getLogger('sc.blueprints.soundcloud')
# add here your custom methods tha... | jsbueno/sc.blueprints.soundcloud | sc/blueprints/soundcloud/setuphandlers.py | Python | gpl-2.0 | 386 | 0 |
import os, sys
import json
import copy
import numpy as np
import random
from multiprocessing import Pool
import ipdb
################################################################################################
utils_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),'nlp scripts')
source_vh_dir = '/ho... | ronaldahmed/labor-market-demand-analysis | rule based major_extractor/count_custom_vhs.py | Python | mit | 4,738 | 0.041368 |
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... | gkc1000/pyscf | pyscf/gto/test/test_ecp.py | Python | apache-2.0 | 10,394 | 0.010391 |
import numpy as np
from numpy.testing import (assert_equal, assert_array_almost_equal,
assert_raises)
from skimage.transform._geometric import _stackcopy
from skimage.transform._geometric import GeometricTransform
from skimage.transform import (estimate_transform, matrix_transform,
... | almarklein/scikit-image | skimage/transform/tests/test_geometric.py | Python | bsd-3-clause | 7,870 | 0 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "MovingAverage", cycle_length = 12, transform = "BoxCox", sigma = 0.0, exog_count = 20, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_BoxCox/trend_MovingAverage/cycle_12/ar_12/test_artificial_32_BoxCox_MovingAverage_12_12_20.py | Python | bsd-3-clause | 266 | 0.086466 |
"""
Given an array of integers, find out whether there are two distinct indices i
and j in the array such that the difference between nums[i] and nums[j] is at
most t and the difference between i and j is at most k.
"""
class Solution(object):
def containsNearbyAlmostDuplicate(self, nums, k, t):
"""
... | ufjfeng/leetcode-jf-soln | python/220_contains_duplicate_iii.py | Python | mit | 1,718 | 0.001746 |
import os
import numpy
from numpy import *
import math
from scipy import integrate, linalg
from matplotlib import pyplot
from pylab import *
class Freestream:
"""
Freestream conditions.
"""
def __init__(self, u_inf=1.0, alpha=0.0):
"""
Sets the freestream speed and angle (in degrees).
... | Sparsh-Sharma/SteaPy | steapy/freestream.py | Python | mit | 651 | 0.004608 |
from pkg_resources import parse_version
from pyramid.interfaces import (
PHASE1_CONFIG,
PHASE2_CONFIG,
)
import venusian
def includeme(config):
config.registry['migrator'] = Migrator()
config.add_directive('add_upgrade', add_upgrade)
config.add_directive('add_upgrade_step', add_upgrade_step)
c... | ClinGen/clincoded | src/contentbase/upgrader.py | Python | mit | 6,948 | 0.000288 |
import tsp.algorithms
import time
if __name__ == "__main__":
cities_number = 5
max_distance = 100
distances_matrix = tsp.algorithms.get_random_distances_matrix(cities_number, max_distance)
start = time.time()
optimal_path = tsp.algorithms.BruteForceTSPSolver(distances_matrix).solve()
print(... | PuchatekwSzortach/travelling_salesman_problem | main.py | Python | mit | 1,223 | 0.004906 |
import os
import re
from nose.tools import raises
import seqpoet
class TestSequence:
def setup(self):
self.seq1 = 'ACATacacagaATAgagaCacata'
self.illegal = 'agagcatgcacthisisnotcorrect'
def test_sequence_length(self):
s = seqpoet.Sequence(self.seq1)
assert len(s) == len(self... | maehler/seqpoet | seqpoet/tests/test_sequence.py | Python | mit | 1,544 | 0.000648 |
from twython import Twython, TwythonError, TwythonAuthError
from .config import app_key, app_secret, screen_name
import unittest
class TwythonAuthTestCase(unittest.TestCase):
def setUp(self):
self.api = Twython(app_key, app_secret)
self.bad_api = Twython('BAD_APP_KEY', 'BAD_APP_SECRET')
... | alex-pardo/6degrees | twython-master/twython-master/tests/test_auth.py | Python | gpl-2.0 | 3,025 | 0.001983 |
# -*- coding: utf-8 -*-
"""
All known information on metadata is exposed in ``gmusicapi.protocol.metadata.md_expectations``.
This holds a mapping of *name* to *Expectation*, where *Expectation* has
the following fields:
*name*
key name in the song dictionary (equal to the *name* keying ``md_expectations``).
*type... | nvbn/Unofficial-Google-Music-API | gmusicapi/protocol/metadata.py | Python | bsd-3-clause | 8,707 | 0.004709 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.