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 |
|---|---|---|---|---|---|---|
from django import template
from symposion.proposals.models import AdditionalSpeaker
register = template.Library()
class AssociatedProposalsNode(template.Node):
@classmethod
def handle_token(cls, parser, token):
bits = token.split_contents()
if len(bits) == 3 and bits[1] == "as":
... | NelleV/pyconfr-test | symposion/proposals/templatetags/proposal_tags.py | Python | bsd-3-clause | 2,245 | 0.0049 |
# -*- coding:utf-8 -*-
# Copyright 2015 NEC Corporation. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
# you may not use this file except in compliance with the License... | nis-sdn/odenos | src/main/python/org/o3project/odenos/core/manager/component_manager.py | Python | apache-2.0 | 5,084 | 0.00059 |
import re
# cat_list = ['Programming','Trending on Reddit','Trailers','Stand-up']
# def urlify(ip):
# # Remove all non-word characters (everything except numbers and letters)
# only_num_and_letters = re.sub(r'[^\w\d\s]','',ip)
# # Replace all runs of whitespace with a single dash
# output = re.sub(r'... | darth-dodo/what_2_watch | test.py | Python | mit | 759 | 0.02108 |
from django.urls import url, include, path
from rest_framework import routers
from users import views
# router = routers.DefaultRouter()
# router.register(r'users', views.UserViewSet)
# router.register(r'groups', views.GroupViewSet)
#
# # Wire up our API using automatic URL routing.
# # Additionally, we include login ... | indrz/indrz | indrz/users/urls.py | Python | gpl-3.0 | 1,054 | 0.001898 |
import pytest
from mock import patch, Mock, call
from nefertari.json_httpexceptions import (
JHTTPBadRequest,
JHTTPNotFound,
)
from .fixtures import (
simple_model, id_model, story_model, person_model,
tag_model, parent_model)
from nefertari_es import documents as docs
from nefertari_es import fields
... | brandicted/nefertari-es | tests/test_documents.py | Python | apache-2.0 | 35,116 | 0.000057 |
# -*- coding: utf-8 -*-#
__author__ = 'dolacmeo'
| dolaCmeo/quick_flask | flask_site/user/__init__.py | Python | mit | 49 | 0 |
# Enter your code here. Read input from STDIN. Print output to STDOUT
class Node:
def __init__(self, letter):
self.letter = letter
self.children = {}
self.isWord = False
class Trie:
def __init__(self):
self.root = Node("*")
def buildTrie(self, word):
curr_node = sel... | MithileshCParab/HackerRank-10DaysOfStatistics | Problem Solving/Data Structure/Trie/no_prefix_set.py | Python | apache-2.0 | 2,190 | 0.010959 |
# Generated by Django 3.2.12 on 2022-02-23 08:07
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
import opaque_keys.edx.django.models
import simple_history.models
class Migration(migrations.Migration):
... | eduNEXT/edx-platform | openedx/core/djangoapps/course_live/migrations/0001_initial.py | Python | agpl-3.0 | 3,720 | 0.004839 |
# -*- coding: utf-8 -*-
#
# ChatterBot documentation build configuration file, created by
# sphinx-quickstart on Mon May 9 14:38:54 2016.
import sys
import os
import sphinx_rtd_theme
from datetime import datetime
# Insert the project root dir as the first element in the PYTHONPATH.
# This lets us ensure that the so... | Gustavo6046/ChatterBot | docs/conf.py | Python | bsd-3-clause | 6,225 | 0.00241 |
import sys
try:
from django.conf import settings
from django.test.utils import get_runner
settings.configure(
DEBUG=True,
USE_TZ=True,
DATABASES={
"default": {
"ENGINE": "django.db.backends.sqlite3",
}
},
TEMPLATES=[
... | Matusf/django-konfera | runtests.py | Python | mit | 2,158 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Andrew Dunham <andrew@du.nham.ca>
# (c) 2013, Daniel Jaouen <dcj24@cornell.edu>
# (c) 2015, Indrajit Raychaudhuri <irc+code@indrajit.com>
#
# Based on macports (Jimmy Tang <jcftang@gmail.com>)
#
# This module is free software: you can redistribute it and/or modify
... | kbrebanov/ansible-modules-extras | packaging/os/homebrew.py | Python | gpl-3.0 | 28,076 | 0.000712 |
# 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/.
import pytest
import math as m
import numpy as np
from sisl import Spin
pytestmark = [pytest.mark.physics, pytest.ma... | zerothi/sisl | sisl/physics/tests/test_spin.py | Python | mpl-2.0 | 4,252 | 0.002352 |
"""Unit tests of resource managers."""
import pytest
from ..utilities.general import is_never_authz, is_no_authz, uses_cataloging, uses_filesystem_only
from dlkit.abstract_osid.osid import errors
from dlkit.abstract_osid.type.objects import TypeList as abc_type_list
from dlkit.primordium.id.primitives import Id
fro... | mitsei/dlkit | tests/resource/test_managers.py | Python | mit | 26,397 | 0.002652 |
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2014 The python-semanticversion project
# This code is distributed under the two-clause BSD License.
try: # pragma: no cover
import django
from django.conf import settings
django_loaded = True
except ImportError: # pragma: no cover
django_loaded = False
... | marcelometal/python-semanticversion | tests/django_test_app/__init__.py | Python | bsd-2-clause | 941 | 0 |
"""stockretriever"""
from setuptools import setup
setup(
name='portfolio-manager',
version='1.0',
description='a web app that keeps track of your investment portfolio',
url='https://github.com/gurch101/portfolio-manager',
author='Gurchet Rai',
author_email='gurch101@gmail.com',
license='MI... | gurch101/portfolio-manager | setup.py | Python | mit | 973 | 0.001028 |
from django.db.models.sql import compiler
class SQLCompiler(compiler.SQLCompiler):
def as_sql(self, with_limits=True, with_col_aliases=False, subquery=False):
if with_limits and self.query.low_mark == self.query.high_mark:
return '', ()
raw_sql, fields = super(SQLCompiler, self).as_sql... | leowa/django_informixdb | django_informixdb/compiler.py | Python | apache-2.0 | 1,808 | 0.001106 |
#!/usr/bin/env python
# class to allow watching multiple files and
# calling a callback when any change (size or mtime)
#
# We take exclusive use of SIGIO and maintain a global list of
# watched files.
# As we cannot get siginfo in python, we check every file
# every time we get a signal.
# we report change is size, m... | neilbrown/susman | dnotify.py | Python | gpl-2.0 | 3,660 | 0.003552 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will ... | marcellodesales/svnedge-console | svn-server/lib/suds/xsd/query.py | Python | agpl-3.0 | 6,451 | 0.002945 |
#!/usr/bin/env python
#
# -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2015 PyBuilder Team
#
# 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
#
# ... | esc/pybuilder | build.py | Python | apache-2.0 | 6,011 | 0.001497 |
from cStringIO import StringIO
import sys
import cgi
import urllib
import urlparse
import re
import textwrap
from Cookie import BaseCookie
from rfc822 import parsedate_tz, mktime_tz, formatdate
from datetime import datetime, date, timedelta, tzinfo
import time
import calendar
import tempfile
import warnings
from webob.... | sizzlelab/pysmsd | extras/webob/__init__.py | Python | mit | 82,534 | 0.001648 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-14 14:32
from __future__ import unicode_literals
from django.db import migrations
from osf.models import MetaSchema
from website.project.metadata.schemas import LATEST_SCHEMA_VERSION
def update_metaschema_active(*args, **kwargs):
MetaSchema.objects... | aaxelb/osf.io | osf/migrations/0055_update_metaschema_active.py | Python | apache-2.0 | 594 | 0.001684 |
"""
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 this ... | alexryndin/ambari | ambari-server/src/main/resources/common-services/AMBARI_INFRA/0.1.0/package/scripts/setup_infra_solr.py | Python | apache-2.0 | 5,041 | 0.004761 |
#!/usr/bin/env python
import rospy
import actionlib
from flexbe_core import EventState, Logger
from vigir_flexbe_states.proxy import ProxyMoveitClient
"""
Created on 04/13/2014
@author: Philipp Schillinger
"""
class MoveitPredefinedPoseState(EventState):
"""
Uses moveit to go to one of the pre-defined poses.
-... | team-vigir/vigir_behaviors | vigir_flexbe_states/src/vigir_flexbe_states/moveit_predefined_pose_state.py | Python | bsd-3-clause | 13,581 | 0.030705 |
# -*- coding: utf-8 -*-
# Copyright (c) 2014, Andreas Pakulat <apaku@gmx.de>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright n... | apaku/jenkinstray | jenkinstray/jenkinsjob.py | Python | bsd-2-clause | 3,238 | 0.005559 |
'''
Created on Nov 8, 2011
@author: mmornati
'''
from webui.abstracts import ContextOperation
from webui import settings
from webui.core import kermit_modules
from guardian.shortcuts import get_objects_for_user
from webui.agent.models import Agent, Action
class JbossDeployContextMenu(ContextOperation):
def g... | kermitfr/kermit-webui | src/webui/platforms/jboss/operations.py | Python | gpl-3.0 | 3,848 | 0.013773 |
"""
Grades Service Tests
"""
from datetime import datetime
import ddt
import pytz
from freezegun import freeze_time
from lms.djangoapps.grades.constants import GradeOverrideFeatureEnum
from lms.djangoapps.grades.models import (
PersistentSubsectionGrade,
PersistentSubsectionGradeOverride,
PersistentSubsecti... | jolyonb/edx-platform | lms/djangoapps/grades/tests/test_services.py | Python | agpl-3.0 | 12,114 | 0.002311 |
"""
Copyright (C) 2008-2013 Tomasz Bursztyka
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program ... | tbursztyka/python-elf | elf/program.py | Python | lgpl-3.0 | 5,074 | 0.019511 |
import clss
import os
def setup_sql():
menu()
s = clss.sql()
s.meta.create_all(s.eng)
def menu():
txt = open('auth_sql', 'w')
print
print '-----SQL Database setup-----'
print
print '=Select SQL type='
print ' (1) sqlite'
print ' (2) MySQL'
print
typ = int(raw_input('... | rosspalmer/bitQuant | bitquant/sql/setup.py | Python | mit | 857 | 0.002334 |
"""
Reads vehicle status from BMW connected drive portal.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.bmw_connected_drive/
"""
import asyncio
import logging
from homeassistant.components.binary_sensor import BinarySensorDevice
from home... | persandstrom/home-assistant | homeassistant/components/binary_sensor/bmw_connected_drive.py | Python | apache-2.0 | 8,080 | 0 |
import subprocess
import unittest
import os
class TestCmdLine(unittest.TestCase):
"""
Those tests are against the lwp command lines
"""
def test_01_generate_secret(self):
assert not os.path.exists('/etc/lwp/session_secret')
assert not os.path.exists('/etc/lwp/lwp.conf')
subpr... | claudyus/LXC-Web-Panel | tests/utils.py | Python | mit | 755 | 0.002649 |
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from scheduler.views.rest_dispatch import RESTDispatch
from uw_r25.spaces import get_spaces, get_space_by_id
import logging
logger = logging.getLogger(__name__)
class Space(RESTDispatch):
def __init__(self):
self._sp... | uw-it-aca/django-panopto-scheduler | scheduler/views/api/space.py | Python | apache-2.0 | 1,252 | 0 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic import TemplateView
admin.autodiscover()
urlpatterns = patterns('',
# Home Page -- Replace as you prefer
url(r'^$', TemplateView.as_view(template_name='home.html'), name='home'),
url(r'^admin/do... | bung87/django-html5-boilerplate | project_name/urls/base.py | Python | mit | 417 | 0.004796 |
"""
Franca abstract syntax tree representation.
"""
from abc import ABCMeta
from collections import OrderedDict
class ASTException(Exception):
def __init__(self, message):
super(ASTException, self).__init__()
self.message = message
def __str__(self):
return self.message
class Pack... | zayfod/pyfranca | pyfranca/ast.py | Python | mit | 15,502 | 0.000387 |
import re
from datetime import datetime
from flask import current_app as app
from flask_jwt import current_identity
from flask_restplus import Namespace, Resource, fields, reqparse
from sqlalchemy.exc import IntegrityError
from packr.models import Message
api = Namespace('contact',
description='Opera... | KnightHawk3/packr | packr/api/contact.py | Python | mit | 4,011 | 0 |
import unittest
from biicode.common.dev.system_resource_names import SystemResourceNames
from biicode.common.dev.system_id import SystemID
class SystemResourceNamesTest(unittest.TestCase):
def setUp(self):
self.sut = SystemResourceNames(SystemID("open_gl", "CPP"))
def test_add_names(self):
s... | zhangf911/common | test/dev/system_resource_names_test.py | Python | mit | 936 | 0.001068 |
# 对ass弹幕文件进行延时。。。
# 为什么会有这个需求呢?因为妈蛋ffmpeg剪切ts视频失败啊!!
# 只好弹幕来配合了。。。
# 如果以后经常遇到。。再整理得好用一些。。。
# 酱~
import re
def t_delay(h,m,s,delay):
s += delay;
if s >= 60:
s -= 60
m += 1
if m >= 60:
m -= 60
h += 1
return [h,m,s]
filename = r'in.ass'
delay = 30;
fid = open(... | claudelee/bilibili-api | danmu-Delay/danmu_delay.py | Python | mit | 966 | 0.045894 |
from .generate_detachment_ltd_erosion import DetachmentLtdErosion
from .generate_erosion_by_depth_slope import DepthSlopeProductErosion
__all__ = ["DetachmentLtdErosion", "DepthSlopeProductErosion"]
| landlab/landlab | landlab/components/detachment_ltd_erosion/__init__.py | Python | mit | 200 | 0 |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from sqlalchemy import DDL, text
SQL_FUNCTION_NATSORT = '''
... | mic4ael/indico | indico/core/db/sqlalchemy/custom/natsort.py | Python | mit | 1,070 | 0.001869 |
# Standard Modules
import apt
from datetime import datetime
import decimal
import json
import os
import Queue
import random
import socket
import subprocess
import sys
import traceback
# Kodi Modules
import xbmc
import xbmcaddon
import xbmcgui
# Custom modules
__libpath__ = xbmc.translatePath(os.path.join(xbmcaddon.Ad... | fernandog/osmc | package/mediacenter-addon-osmc/src/script.module.osmcsetting.updates/resources/lib/update_service.py | Python | gpl-2.0 | 47,883 | 0.03425 |
#!/usr/bin/env python3
# Copyright (C) 2013-2018 Florian Festi
#
# 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.... | florianfesti/boxes | boxes/generators/unevenheightbox.py | Python | gpl-3.0 | 4,609 | 0.003688 |
from bokeh.charts import Scatter, output_file, show
x = [1, 2, 3, 4, 5, 6, 7, 8]
y = [2.1, 6.45, 3, 1.4, 4.55, 3.85, 5.2, 0.7]
z = [.5, 1.1, 1.9, 2.5, 3.1, 3.9, 4.85, 5.2]
species = ['cat', 'cat', 'cat', 'dog', 'dog', 'dog', 'mouse', 'mouse']
country = ['US', 'US', 'US', 'US', 'UK', 'UK', 'BR', 'BR']
df = {'time': x,... | Serulab/Py4Bio | code/ch14/scatter.py | Python | mit | 618 | 0.004854 |
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
import re
import sys
import os
from .ansi import AnsiFore, AnsiBack, AnsiStyle, Style
from .winterm import WinTerm, WinColor, WinStyle
from .win32 import windll, winapi_test
winterm = None
if windll is not None:
winterm = WinT... | croxis/SpaceDrive | spacedrive/renderpipeline/rplibs/colorama/ansitowin32.py | Python | mit | 9,904 | 0.001918 |
# Taken from https://github.com/salesforce/awd-lstm-lm/blob/master/weight_drop.py
import torch
from torch.nn import Parameter
from functools import wraps
class WeightDrop(torch.nn.Module):
def __init__(self, module, weights, dropout=0, variational=False):
super(WeightDrop, self).__init__()
self.mod... | eladhoffer/seq2seq.pytorch | seq2seq/models/modules/weight_drop.py | Python | mit | 1,803 | 0.003882 |
# Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | jdanbrown/pydatalab | legacy_tests/kernel/sql_tests.py | Python | apache-2.0 | 7,834 | 0.003957 |
# 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 ... | Azure/azure-sdk-for-python | sdk/powerbiembedded/azure-mgmt-powerbiembedded/azure/mgmt/powerbiembedded/models/power_bi_embedded_management_client_enums.py | Python | mit | 660 | 0 |
# -*- coding: utf-8 -*-
""" Tests used to check the operation of log collecting.
Author: Milan Falešník <mfalesni@redhat.com>
Since: 2013-02-20
"""
from datetime import datetime
import fauxfactory
import pytest
import re
from cfme import test_requirements
from cfme.configure import configuration as configure
from ut... | jteehan/cfme_tests | cfme/tests/configure/test_log_depot_operation.py | Python | gpl-2.0 | 12,788 | 0.00305 |
#!/usr/bin/python
import sys
import btceapi
# This sample shows use of a KeyHandler. For each API key in the file
# passed in as the first argument, all pending orders for the specified
# pair and type will be canceled.
if len(sys.argv) < 4:
print "Usage: cancel_orders.py <key file> <pair> <order type>"
pri... | blorenz/btce-api | samples/cancel-orders.py | Python | mit | 1,343 | 0.006701 |
# -*- coding: utf-8 -*-
{
'name': 'Time Tracking',
'version': '1.0',
'category': 'Human Resources',
'sequence': 23,
'description': """
This module implements a timesheet system.
==========================================
""",
'author': 'OpenERP SA',
'website': 'http://www.openerp.com',
... | syci/ingadhoc-odoo-addons | hr_timesheet_project/__openerp__.py | Python | agpl-3.0 | 591 | 0 |
"""
websocket - WebSocket client library for Python
Copyright (C) 2010 Hiroki Ohtani(liris)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, ... | andrewsy97/Treehacks | websocket/websocket/_app.py | Python | mit | 10,379 | 0.002794 |
# -*- coding: utf-8 -*-
from django.db import models
from Corretor.base import CorretorException
from Corretor.base import ExecutorException
from Corretor.base import CompiladorException
from Corretor.base import ComparadorException
from Corretor.base import LockException
from model_utils import Choices
class Retorn... | arruda/amao | AMAO/apps/Corretor/models/retorno.py | Python | mit | 2,633 | 0.012952 |
r"""
Time-dependent linear elasticity with a simple damping.
Find :math:`\ul{u}` such that:
.. math::
\int_{\Omega} c\ \ul{v} \cdot \pdiff{\ul{u}}{t}
+ \int_{\Omega} D_{ijkl}\ e_{ij}(\ul{v}) e_{kl}(\ul{u})
= 0
\;, \quad \forall \ul{v} \;,
where
.. math::
D_{ijkl} = \mu (\delta_{ik} \delta_{jl}+\... | vlukes/sfepy | examples/linear_elasticity/linear_elastic_damping.py | Python | bsd-3-clause | 1,983 | 0.013111 |
import commands
import time
import MySQLdb
from locust import Locust, events, task, TaskSet
def show_tables(self):
print "Running show_tables..."
print self.client.query("SHOW TABLES IN mysql", name="SHOW TABLES")
def mysql_user(self):
print "Running show users..."
pr... | pcrews/rannsaka | mysql/mysql_demo.py | Python | apache-2.0 | 3,820 | 0.012565 |
import csv
import logging
import transaction
DIRNAME = "/opt/Plone-4.3/zeocluster/Extensions/"
FILENAME = "ccdet.dat"
MAXROWS = 100000000
TRANSSIZE = 50
TRANSSIZE_FOR_READING = 5000
FOLDERID = 'cbrf-folder'
logger = logging.getLogger('ccdet_mem')
html_escape_table = {
"&": "&",
}
def html_escape(text):... | uwosh/CCDET-CBRF | ccdet.py | Python | gpl-2.0 | 8,257 | 0.004844 |
# -*- coding: utf-8 -*-
#
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2015 Vauxoo - http://www.vauxoo.com/
# All Rights Reserved.
# info Vauxoo (info@vauxoo.com)
#
# Coded by: Luis Torres (luis_t@vauxoo.com)
#
#
# This program is free software: you can redistribute it and/or modify
# ... | MarcosCommunity/odoo | comunity_modules/stock_no_negative/model/product.py | Python | agpl-3.0 | 1,270 | 0 |
import pandas as pd
import pytest
from athletic_pandas.algorithms import heartrate_models
def test_heartrate_model():
heartrate = pd.Series(range(50))
power = pd.Series(range(0, 100, 2))
model, predictions = heartrate_models.heartrate_model(heartrate, power)
assert model.params['hr_rest'].value == ... | AartGoossens/athletic_pandas | tests/algorithms/test_heartrate_models.py | Python | mit | 701 | 0 |
from ceph_deploy.util import pkg_managers
def install(distro, packages):
return pkg_managers.yum(
distro.conn,
packages
)
def remove(distro, packages):
return pkg_managers.yum_remove(
distro.conn,
packages
)
| jumpstarter-io/ceph-deploy | ceph_deploy/hosts/rhel/pkg.py | Python | mit | 260 | 0 |
import os
DATABASE = {
'drivername': os.environ['NBA_DB_DRIVER'],
'host': os.environ['NBA_DB_HOST'],
'port': os.environ['NBA_DB_PORT'],
'username': os.environ['NBA_DB_USER'],
'password': os.environ['NBA_DB_PW'],
'database': os.environ['NBA_DB_NAME'],
}
| arosenberg01/asdata | settings.py | Python | mit | 279 | 0.003584 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# king_phisher/client/widget/managers.py
#
# 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
# n... | securestate/king-phisher | king_phisher/client/widget/managers.py | Python | bsd-3-clause | 17,478 | 0.023058 |
"""
Renames files in a directory (command line argument) to not have intermediate extensions.
Works for cTAKES xmi or xml files if the original file extension has been retained.
"""
import re
import subprocess
import sys
import os
try:
d = sys.argv[1]
except:
print('usage:\npython ' + sys.argv[0] + ' <path-... | gpfinley/ensembles | scripts/remove_extraneous_extensions.py | Python | apache-2.0 | 664 | 0.00753 |
from scoring_engine.engine.basic_check import BasicCheck, CHECKS_BIN_PATH
class RDPCheck(BasicCheck):
required_properties = []
CMD = CHECKS_BIN_PATH + '/rdp_check {0} {1} {2} {3}'
def command_format(self, properties):
account = self.get_random_account()
return (
account.userna... | pwnbus/scoring_engine | scoring_engine/checks/rdp.py | Python | mit | 410 | 0 |
# -*- coding: utf-8 -*-
"""
consolor
Copyright (c) 2013-2014, Friedrich Paetzke (f.paetzke@gmail.com)
All rights reserved.
"""
from __future__ import print_function
from consolor import BgColor, Color, get_line
try:
from unittest.mock import call, patch
except ImportError:
from mock import call, patch
def... | paetzke/consolor | tests/test_consolor.py | Python | bsd-2-clause | 3,238 | 0 |
# Copyright 2014 Cloudbase Solutions Srl
#
# 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 ... | takeshineshiro/nova | nova/tests/unit/virt/hyperv/test_vmutilsv2.py | Python | apache-2.0 | 11,758 | 0 |
#-*- coding: utf-8 -*-
import pygame.key
from pygame.font import Font
from lib.base_screen import BaseScreen, ChangeScreenException
from pygame.locals import K_SPACE as SPACE
class MenuScreen(BaseScreen):
def init_entities_before(self, surface):
self.font = Font(None, 30)
self.textImg = self.fon... | Bobbyshow/Avoid | screen/menu.py | Python | unlicense | 923 | 0.010834 |
# -*- 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):
# Changing field 'Post.link'
db.alter_column(u'social_post', 'link', self.gf('django.db.models.fields.URLFi... | pavlenko-volodymyr/codingmood | codemood/social/migrations/0004_auto__chg_field_post_link.py | Python | mit | 4,577 | 0.007865 |
import ujson
from django.http import HttpResponse
from mock import patch
from typing import Any, Dict
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.stream_topic import StreamTopicTarget
from zerver.models import (
get_realm,
get_stream,
get_stream_recipient,
get_user,
Recipie... | Galexrt/zulip | zerver/tests/test_muting.py | Python | apache-2.0 | 4,650 | 0.00086 |
#!/usr/bin/env python
def load_velocity(filename):
import os
if not os.path.exists(filename):
return None
from numpy import zeros
from vtk import vtkPolyDataReader, vtkCellDataToPointData
reader = vtkPolyDataReader()
reader.SetFileName(filename)
reader.ReadAllVectorsOn()
rea... | mrklein/vtk-plot | plot-vtk.py | Python | unlicense | 2,344 | 0 |
from django.test import TestCase
from freezegun import freeze_time
from unittest.mock import patch
from testil import eq
from corehq.util.soft_assert.core import SoftAssert
from casexml.apps.case.exceptions import ReconciliationError
from casexml.apps.case.xml.parser import CaseUpdateAction, KNOWN_PROPERTIES
from core... | dimagi/commcare-hq | corehq/form_processor/tests/test_sql_update_strategy.py | Python | bsd-3-clause | 8,947 | 0.001229 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2012-2014 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the... | elopezga/ErrorRate | ivi/agilent/agilentDSA91204A.py | Python | mit | 1,632 | 0.004289 |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
import re
import weakref
from telemetry.core import extension_page
from telemetry.core.backends.chrome import inspector_backend
class ExtensionN... | Philippe12/external_chromium_org | tools/telemetry/telemetry/core/backends/chrome/extension_dict_backend.py | Python | bsd-3-clause | 2,641 | 0.008709 |
"""Mercator proposal."""
from adhocracy_core.resources import add_resource_type_to_registry
from adhocracy_core.resources import process
from adhocracy_core.resources import proposal
from adhocracy_core.sheets.geo import IPoint
from adhocracy_core.sheets.geo import ILocationReference
from adhocracy_core.sheets.image im... | liqd/adhocracy3.mercator | src/adhocracy_meinberlin/adhocracy_meinberlin/resources/kiezkassen.py | Python | agpl-3.0 | 1,552 | 0 |
import _plotly_utils.basevalidators
class CmidValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="cmid", parent_name="cone", **kwargs):
super(CmidValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_type=... | plotly/plotly.py | packages/python/plotly/plotly/validators/cone/_cmid.py | Python | mit | 443 | 0 |
"""CS411Project URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Clas... | cs411sp15vmnjhtdw/MeetU | CS411Project/urls.py | Python | mit | 837 | 0 |
# -*- 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 index on 'Organization', fields ['name']
db.create_index('main_organization', ['name'])
# ... | mattr555/AtYourService | main/migrations/0011_auto__add_index_organization_name__add_index_userevent_date_end__add_i.py | Python | mit | 8,705 | 0.007007 |
#!/usr/bin/env python
# Copyright 2021 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.
# This is generated, do not edit. Update BuildConfigGenerator.groovy and
# 3ppFetch.template instead.
from __future__ import print_fun... | nwjs/chromium.src | third_party/android_deps/libs/org_apache_maven_wagon_wagon_http_shared/3pp/fetch.py | Python | bsd-3-clause | 1,402 | 0.000713 |
import pytest
import vaex
pytest.importorskip("sklearn")
from vaex.ml.sklearn import Predictor, IncrementalPredictor
import numpy as np
# Regressions
from sklearn.linear_model import LinearRegression, Ridge, Lasso, SGDClassifier, SGDRegressor
from sklearn.svm import SVR
from sklearn.ensemble import AdaBoostRegressor,... | maartenbreddels/vaex | tests/ml/sklearn_test.py | Python | mit | 11,265 | 0.002929 |
import re
from blaze import resource, DataFrame
import pandas as pd
from snakemakelib.odo.pandas import annotate_by_uri
@resource.register('.+fastq.summary')
@annotate_by_uri
def resource_fastqc_summary(uri, **kwargs):
with open(uri):
data = pd.read_csv(uri, sep=",", index_col=["fileName"])
return Dat... | Oliver-Lab/snakemakelib-oliver | snakemakelib_oliver/odo/geo.py | Python | mit | 333 | 0 |
from setuptools import setup
from setuptools import find_packages
import os
requirements = ['numpy',
'netCDF4',
'pyresample',
'pyyaml',
'pillow',
'rasterio']
readme_contents = ""
setup(
name='satistjenesten',
version=0.5,
... | metno/satistjenesten | setup.py | Python | mit | 1,107 | 0.009033 |
import re
from .common import InfoExtractor
class GamekingsIE(InfoExtractor):
_VALID_URL = r'http://www\.gamekings\.tv/videos/(?P<name>[0-9a-z\-]+)'
_TEST = {
u"url": u"http://www.gamekings.tv/videos/phoenix-wright-ace-attorney-dual-destinies-review/",
u'file': u'20130811.mp4',
# MD5 ... | Grassboy/plugin.video.plurkTrend | youtube_dl/extractor/gamekings.py | Python | mit | 1,331 | 0.003005 |
#!/usr/bin/env python
import os
import sys
import time
import platform
import argparse
from datetime import datetime
from space_checker_utils import wget_wrapper
import ConfigParser
def create_directory(directory):
"""Create parent directories as necessary.
:param directory: (~str) Path of directory to be ... | DePierre/owtf | install/install.py | Python | bsd-3-clause | 10,142 | 0.003352 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010 Camptocamp SA (http://www.camptocamp.com)
# All Right Reserved
#
# Author : Nicolas Bessi (Camptocamp)
# Contributor(s) : Florent Xicluna (Wingo SA)
#
# WARNING: This program as such is intended... | ncliam/serverpos | openerp/addons/report_webkit/webkit_report.py | Python | agpl-3.0 | 16,744 | 0.005256 |
# Requires trailing commas in Py2 but syntax error in Py3k
def True(
foo
):
True(
foo
)
def False(
foo
):
False(
foo
)
def None(
foo
):
None(
foo
)
def nonlocal (
foo
):
nonlocal(
foo
)
| zedlander/flake8-commas | test/data/keyword_before_parenth_form/py2_bad.py | Python | mit | 273 | 0 |
# __author__ = 'Exter'
from functools import wraps
import time
def timed(f):
@wraps(f)
def wrapper(*args, **kwds):
current_milli_time = lambda: int(round(time.time() * 1000))
start = current_milli_time()
result = f(*args, **kwds)
elapsed = current_milli_time() - start
print "%s took %d ms to ... | exter/pycover | tools/timed_wrapper.py | Python | mit | 386 | 0.015544 |
# Copyright Hybrid Logic Ltd. See LICENSE file for details.
"""
Network utilities.
"""
from ipaddr import IPAddress
import netifaces
def ipaddress_from_string(ip_address_string):
"""
Parse an IPv4 or IPv6 address string and return an
IPAddress instance.
Remove the "embedded scope id" from IPv6 addr... | jml/flocker | flocker/common/_net.py | Python | apache-2.0 | 1,289 | 0 |
#!/usr/bin/env python
import os
from watermark.config import config as conf
from watermark import connect
config_name = os.getenv('WM_CONFIG_ENV') or 'default'
config = conf[config_name]()
conn = connect.get_connection(config)
conn.message.create_queue(name=config.NAME)
print("{name} queue created".format(name=con... | danabauer/app-on-openstack | code/worker/deploy.py | Python | mit | 331 | 0 |
"""
Read SAS sas7bdat or xport files.
"""
from pandas import compat
from pandas.io.common import _stringify_path
def read_sas(filepath_or_buffer, format=None, index=None, encoding=None,
chunksize=None, iterator=False):
"""
Read SAS files stored as either XPORT or SAS7BDAT format files.
Param... | NixaSoftware/CVis | venv/lib/python2.7/site-packages/pandas/io/sas/sasreader.py | Python | apache-2.0 | 2,558 | 0.000391 |
import xml.etree.ElementTree as XMLFactory
import subprocess
import os
import signal
import utils
from buffers import Text, Color
class CoqManager:
def __init__(self, WM):
# The coqtop process
self.coqtop = None
# The string return by 'coqtop --version'
self.coqtopVersion = ''
# The windows manager insta... | QuanticPotato/vcoq | plugin/coq.py | Python | gpl-2.0 | 3,667 | 0.035451 |
import factory
from django.contrib.auth.models import User
from django.utils import timezone
from events.models import Event, EventInvite
from userprofiles.models import FriendRequest
class UserFactory(factory.django.DjangoModelFactory):
class Meta:
model = User
class Params:
join_event = No... | kosior/eventful | eventful/events/tests/factories.py | Python | mit | 2,221 | 0.00045 |
from PyQt4 import QtCore, QtGui
from components.propertyeditor.Property import Property
from components.RestrictFileDialog import RestrictFileDialog
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import sys, os
class QPropertyModel(QtCore.QAbstractItemModel):
def __init__(self, parent):
super(QProp... | go2net/PythonBlocks | components/propertyeditor/QPropertyModel.py | Python | mit | 7,747 | 0.013037 |
# -*- coding: utf-8; -*-
#
# The MIT License (MIT)
#
# Copyright (c) 2014 Flavien Charlon
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation t... | OpenAssets/openassets | openassets/protocol.py | Python | mit | 19,047 | 0.002888 |
import os
from datetime import datetime
os.chdir(r"E:\__data_2015\___john\Desenvolvimentos\aplications\Aplicacoes_grass\LSCorridors\___dados_cortados_teste_desenvolvimento")
now = datetime.now() # INSTANCE
day_start=now.day
month_start=now.month
year_start=now.year
hour_start=now.hour # GET START HOUR
minuts_start=n... | LEEClab/LS_CORRIDORS | old_versions/before_v1_0_0/log_def.py | Python | gpl-2.0 | 2,333 | 0.045864 |
#! /usr/bin/env python
#
# Copyright (C) 2008 Lorenzo Pallara, l.pallara@avalpa.com
#
# 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... | philotas/opencaster | tutorials/psi-generation/firstsdt.py | Python | gpl-2.0 | 2,269 | 0.032613 |
from collections import defaultdict
import pandas as pd
import pickle
from sqlalchemy import create_engine, inspect, Table, Column
from sqlalchemy.engine.url import make_url
from sys import exit
class DatabaseClient:
""" Takes care of the database pass opening to find the url and can query
the respected ... | tgbugs/pyontutils | ilxutils/ilxutils/database_client.py | Python | mit | 2,525 | 0.00198 |
import os
import wave
import platform
import threading
from functools import wraps
import time
import pyaudio
CUSTOMCMDS = (),
AUTOCMDS = (
'BufNewFile', 'BufReadPre', 'BufRead', 'BufReadPost',
'BufReadCmd', 'FileReadPre', 'FileReadPost', 'FileReadCmd',
'FilterReadPre', 'FilterReadPost', 'StdinReadPre',
... | timeyyy/orchestra.nvim | rplugin/python3/orchestra/util.py | Python | unlicense | 7,671 | 0.001825 |
# 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 Li... | pypa/warehouse | warehouse/search/queries.py | Python | apache-2.0 | 3,381 | 0.000592 |
#
# Copyright (c) 2012 Patrice Munger
# This file is part of pynetdicom, released under a modified MIT license.
# See the file license.txt included with this distribution, also
# available at http://pynetdicom.googlecode.com
#
import DIMSEmessages
import DIMSEparameters
from DIMSEmessages import DIMSEMessage
fro... | patmun/pynetdicom | netdicom/DIMSEprovider.py | Python | mit | 4,422 | 0.000678 |
# -*- coding: utf-8 -*-
# Copyright (c) 2018 TinEye. All rights reserved worldwide.
from .matchengine_request import MatchEngineRequest
class MobileEngineRequest(MatchEngineRequest):
"""
Class to send requests to a MobileEngine API.
Adding an image using data:
>>> from tineyeservices import Mob... | TinEye/tineyeservices_python | tineyeservices/mobileengine_request.py | Python | mit | 1,115 | 0 |
#!/usr/bin/env python
'''
'roi_gcibs.py' compares two groups informed by an a priori bootstrap analysis.
'''
import os
import sys
import argparse
import tempfile, shutil
import json
import pprint
import copy
from collections import defaultdict
from _common import systemMisc a... | FNNDSC/roi_tag | roi_gcibs.py | Python | mit | 37,159 | 0.010603 |
# 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... | dims/heat | heat/db/sqlalchemy/migrate_repo/versions/043_migrate_template_versions.py | Python | apache-2.0 | 2,285 | 0 |
""""Argo Workflow for testing notebook-server-jupyter-scipy OCI image"""
from kubeflow.kubeflow.ci import workflow_utils
from kubeflow.testing import argo_build_util
class Builder(workflow_utils.ArgoTestBuilder):
def __init__(self, name=None, namespace=None, bucket=None,
test_target_name=None, **... | kubeflow/kubeflow | py/kubeflow/kubeflow/ci/notebook_servers/notebook_server_jupyter_scipy_tests.py | Python | apache-2.0 | 1,826 | 0.001095 |
#!/usr/bin/python
# Python DB APIs:
#for more: http://www.mikusa.com/python-mysql-docs/index.html
#and more: http://zetcode.com/db/mysqlpython/
#and else: http://mysql-python.sourceforge.net/MySQLdb.html
import MySQLdb as mdb
import itertools
from pprint import pprint
import ConfigParser
def db_connect(properties_fil... | ssamot/vgdl_competition | src/server/db_utils.py | Python | gpl-3.0 | 3,033 | 0.012199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.