code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python2
# encoding=utf-8
from __future__ import division, print_function
from math import ceil, floor, log10, pi
from sys import argv, stdout
from xml.dom import minidom
import bz2
import csv
# local imports
from my_helper_functions_bare import *
def pretty_mean_std(data):
return uncertain_number_... | macioosch/dynamo-hard-spheres-sim | to_csv_pretty.py | Python | gpl-3.0 | 3,184 |
#!/usr/bin/env python
"""Module for making tests on small molecules in GPAW.
One molecule test to rule them all
One molecule test to run them
One molecule test to save them all
And on the webpage plot them (implementation pending)
"""
from gpaw import GPAW, ConvergenceError
from ase.structure import molecule
from as... | ajylee/gpaw-rtxs | gpaw/testing/molecule_test.py | Python | gpl-3.0 | 2,509 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from shuup.utils.importing import cached_load
def get_basket_order_creator... | hrayr-artunyan/shuup | shuup/front/basket/__init__.py | Python | agpl-3.0 | 1,442 |
# 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.
import time
from quodlibet import config
from quodlibet.formats import... | Mellthas/quodlibet | tests/test_query.py | Python | gpl-2.0 | 23,503 |
System:
------
1.) cli to take employee onboard.
name:
age:
location:
generate emp_id
print(emp_id)
save to file
emp_id,name,age,location
2.) swipe in , swipe out
3.) first swipin and last swip out for a day.
total hours spend at office
4.) save it into file
attenence_2017_01_18.csv
emp_id in ... | MortalViews/python-notes | exerices.py | Python | apache-2.0 | 595 |
from matplotlib.patches import Circle
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid.anchored_artists import AnchoredDrawingArea
fig=plt.figure(1, figsize=(3,3))
ax = plt.subplot(111)
ada = AnchoredDrawingArea(40, 20, 0, 0,
loc=1, pad=0., frameon=False)
p1 = Circle((10, 10), 10... | lthurlow/Network-Grapher | proj/external/matplotlib-1.2.1/doc/users/plotting/examples/anchored_box02.py | Python | mit | 451 |
from __future__ import absolute_import, print_function
import datetime
import mimetypes
import os
import posixpath
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.db import transaction
from django.utils.encoding import python_2_unicode_... | lyoniionly/django-cobra | src/cobra/apps/svnkit/abstract_models.py | Python | apache-2.0 | 20,237 |
# Copyright 2017 The UAI-SDK 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 applicable... | ucloud/uai-sdk | uaitrain/arch_conf/base_conf.py | Python | apache-2.0 | 7,027 |
from mucomic.core.models import Issue, Series
from mucomic.core import DB, Api
from mucomic import paths
import shutil
import os.path
from urllib.request import urlopen
import zipfile
import re
class Connector:
def __init__(self, config):
self.config = config
self.db = DB(paths.dbfile)
self.api = Api(self.conf... | christofsteel/mucomicload | src/mucomic/core/connector.py | Python | gpl-3.0 | 3,381 |
# Authors:
# Jason Gerard DeRose <jderose@redhat.com>
#
# Copyright (C) 2008-2016 Red Hat
# see file 'COPYING' for use and warranty inmsgion
#
# 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, ... | redhatrises/freeipa | ipalib/errors.py | Python | gpl-3.0 | 50,733 |
# -*- coding: utf-8 -*-
###
# (C) Copyright (2012-2016) Hewlett Packard Enterprise Development LP
#
# 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 limi... | andreadean5/python-hpOneView | tests/unit/test_servers.py | Python | mit | 10,216 |
from cleo.styles import OutputStyle
from sdoc.sdoc2.formatter.Formatter import Formatter
class HtmlFormatter(Formatter):
"""
Abstract parent class for all formatters for generating the output of nodes in HTML.
"""
# ------------------------------------------------------------------------------------... | SDoc/py-sdoc | sdoc/sdoc2/formatter/html/HtmlFormatter.py | Python | mit | 745 |
# encoding: utf-8
# Copyright 2008 California Institute of Technology. ALL RIGHTS
# RESERVED. U.S. Government Sponsorship acknowledged.
'''
EDRN RDF Service: unit and functional tests.
''' | EDRN/DMCCBackend | src/edrn.rdf/edrn/rdf/tests/__init__.py | Python | apache-2.0 | 189 |
# Declaring constants for use throughout the program
STATE_AUTH = 'AUTH'
STATE_CHAT = 'CHAT'
SIGN_UP = 'SIGN_UP'
LOGIN = 'REGISTER'
EXIT = 'EXIT'
EXIT_COMMAND = '.quit' # This is what the user types when he/she wants to quit
DB_URL = 'storage.db'
PORT = 1236
LOG_FILE_URL = 'chatserver.log'
TEST_USER_FILE = 'sim_users... | srvasn/basic-chat-server | constants.py | Python | gpl-3.0 | 513 |
# -*- coding: utf-8 -*-
'''
@author: arcra
'''
import time, threading, os
import Tkinter as tk
import argparse
import clipsFunctions
from clipsFunctions import clips, _clipsLock
import pyrobotics.BB as BB
from pyrobotics.messages import Command, Response
import GUI
from BBFunctions import assertQueue, ResponseReceiv... | BioRoboticsUNAM/BBCLIPS | BBCLIPS.py | Python | mit | 7,860 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author : Patrick Charron
# Email : patrick.charron.pc@gmail.com
# Description : Top Informations Viewer
#
# 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 Foun... | flyingcoconut/mytop | mytop/drivers/mongodb.py | Python | gpl-3.0 | 2,619 |
# -*- coding: utf-8 -*-
#
# A Base Codec Class for deciphering data that is requiring an external file
#
# Copyright (C) 2016 Chris Caron <lead2gold@gmail.com>
#
# 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 Fre... | caronc/newsreap | newsreap/codecs/CodecFile.py | Python | gpl-3.0 | 14,438 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-03 19:02
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0002_remove_livro_image'),
]
operations = [
... | LEDS/jediteca | jediteca/core/migrations/0003_auto_20151203_1902.py | Python | gpl-2.0 | 895 |
s = raw_input().lower()
score1 = score2 = 0
for i in xrange(len(s)):
if s[i] == 'a' or s[i] == 'e' or s[i] == 'i' or s[i] == 'o' or s[i] == 'u':
score2 += len(s)-i
else:
score1 += len(s)-i
if score1 > score2:
print 'Stuart ' + str(score1)
elif score1 < score2:
print 'Kevin ' + str(score2... | shree-shubham/Unitype | The Minion Game.py | Python | gpl-3.0 | 345 |
# 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 | test/integration/testpaths/testpath_uuid_event.py | Python | gpl-2.0 | 6,637 |
#
# Copyright (C) 2010-2017 Samuel Abels
# The MIT License (MIT)
#
# 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 rights to use, copy,... | maximumG/exscript | Exscript/util/weakmethod.py | Python | mit | 4,132 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# userFacade.py
#
# Copyright 2010-2015 Jose Riguera Lopez <jriguera@gmail.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
#... | jriguera/photoplace | photoplace/lib/PhotoPlace/userFacade.py | Python | apache-2.0 | 19,186 |
#!/usr/bin/env python3
'''
List traffic statistics for IPv4 policies.
Method
https://<DEVICE_IP>/api/v2/monitor/firewall/policy
# PolicyID 0 means 'Implicit Deny' rule
CLI
FG # diag firewall iprope show 00100004 13
idx=13 pkts/bytes=553936822/569261079433 asic_pkts/asic_bytes=373877794/400601238192 nturbo_p... | barbosm/gatepy | examples/monitor_firewall_policy-check_last_used.py | Python | gpl-2.0 | 3,732 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, print_function, with_statement
import codecs
import hashlib
import itertools
import logging
import os
import os.path
import pipes
import random
import shutil
import string
from string import Template
from stat import S_IRUSR
import subpro... | eleflow/uberdata | iuberdata_core/src/main/resources/python/spark_ec2.py | Python | apache-2.0 | 50,532 |
import inspect
import sys
import textwrap
from pathlib import Path
from typing import Callable
from typing import Optional
import pytest
from _pytest.doctest import _get_checker
from _pytest.doctest import _is_main_py
from _pytest.doctest import _is_mocked
from _pytest.doctest import _is_setup_py
from _pytest.doctest ... | RonnyPfannschmidt/pytest | testing/test_doctest.py | Python | mit | 48,157 |
#!/usr/bin/env python
"""Fortran to Python Interface Generator.
"""
from __future__ import division, absolute_import, print_function
__all__ = ['run_main', 'compile', 'f2py_testing']
import sys
import subprocess
import os
import numpy as np
from . import f2py2e
from . import f2py_testing
from . import diagnose
ru... | jorisvandenbossche/numpy | numpy/f2py/__init__.py | Python | bsd-3-clause | 3,138 |
from collections import defaultdict
export_dir = 'marc/'
data_dir = 'raw/'
log_dir = 'logs/'
countries_to_skip = ['Japan', 'France', 'Korea, Republic of']
def is_xml_field(x):
xml_fields = ['100', '200']
return x in xml_fields or len(x)==2
xml_header = '<?xml version="1.0" encoding="ISO-8859-1"?>'
formatti... | jgarcial/inis_to_marc | config.py | Python | gpl-3.0 | 536 |
"""
Simultaneous iteration algorithm
Takes a matrix Q and a parameter p denoting the last column
of A considered for computing the eigenspace
>>> A = array([[ 1.079, 1.105, 0.559],
... [ 1.105, 0.725, 0.988],
... [ 0.559, 0.988, 0.732]])
>>> Q,L,iters,err = simit(A,3, details=True)
>>> iter... | ddrake/mth653 | eigen/simit.py | Python | mit | 838 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
# Greed is a dice game where you roll up to five dice to accumulate
# points. The following "score" function will be used calculate the
# score of a single roll of the dice.
#
# A greed roll is scored as follows:
#
# * A set of three ones is 100... | sourabhv/python-koans-solutions | python3/koans/about_scoring_project.py | Python | mit | 2,529 |
import _plotly_utils.basevalidators
class ValuesValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(self, plotly_name="values", parent_name="sunburst", **kwargs):
super(ValuesValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/sunburst/_values.py | Python | mit | 442 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import asyncio
from collections import OrderedDict
import concurrent.futures
import json
import logging
import aiopg
import psycopg2.extensions
import psycopg2.extras
from fumbbl_base.custom_types import tournament_format as tfmt
import fumbbl_trans.exc
i... | FUMBBLPlus/fplusdb_main | scripts/fplusdbchkgroup.py | Python | mit | 11,627 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.com/license.html.
#
# This software consists of vo... | Puppet-Finland/trac | files/spam-filter/tracspamfilter/adminreport.py | Python | bsd-2-clause | 6,070 |
from datetime import datetime, timedelta, date, time
import nose
from pandas.compat import lrange, zip
import numpy as np
from numpy.testing.decorators import slow
from pandas import Index, Series, DataFrame
from pandas.tseries.index import date_range, bdate_range
from pandas.tseries.offsets import DateOffset, Week... | Vvucinic/Wander | venv_2_7/lib/python2.7/site-packages/pandas/tseries/tests/test_plotting.py | Python | artistic-2.0 | 44,763 |
# print(f'Invoking __init__.py for {__name__}')
from .maths import complexto
from .HP4395A import HP4395A
from .AgilentE8357A import AgilentE8357A
from .Wiltron360 import Wiltron360
# import .Wiltron360
REGISTER = {
'HEWLETT-PACKARD,4395A': HP4395A,
'Agilent Technologies,E8357A': AgilentE8357A,
'Wiltron,... | DavidLutton/EngineeringProject | labtoolkit/NetworkAnalyser/__init__.py | Python | mit | 851 |
from django.conf.urls import patterns, url
from ts_get_started import views
from django.views.generic import TemplateView
urlpatterns = patterns('',
url(r'^$', views.IndexView.as_view(), name='ts_get_started_index'),
url(r'^modeling1/$', views.Modeling1View.as_view(), name='ts_get_started_modeling1'),
url(... | tph-thuering/vnetsource | ts_get_started/urls.py | Python | mpl-2.0 | 1,377 |
from fnmatch import fnmatch
import logging
logger = logging.getLogger("ralybot")
# put your hostmask here for magic
# it's disabled by default, see has_perm_mask()
backdoor = None
class PermissionManager(object):
"""
:type name: str
:type config: dict[str, ?]
:type group_perms: dict[str, list[str]]
... | Jakeable/Ralybot | ralybot/permissions.py | Python | gpl-3.0 | 7,238 |
# -*- coding: UTF-8 -*-
import postmarkup
import unittest
class TestPostmarkup(unittest.TestCase):
def test_textilize(self):
"""Test textilize function"""
tests = [(u"<b>No bold</b>", u"No bold"),
(u'<span class="blah">A span</span>', u"A span"),
(u"Jus... | saknis/upelis | postmarkup/tests.py | Python | lgpl-2.1 | 3,704 |
# Generated by Django 2.0.1 on 2018-01-17 13:57
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('ligand', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Mu... | cmunk/protwis | mutation/migrations/0001_initial.py | Python | apache-2.0 | 10,073 |
import os
import pandas as pd
import pytest
import pickle
import numpy as np
import string
from copy import copy
import pandas.util.testing as tm
import dask
import dask.dataframe as dd
from dask import delayed
from dask.base import compute_as_if_collection
from dask.dataframe.shuffle import (shuffle,
... | TNT-Samuel/Coding-Projects | DNS Server/Source/Lib/site-packages/dask/dataframe/tests/test_shuffle.py | Python | gpl-3.0 | 25,674 |
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/platypus/tableofcontents.py
__version__=''' $Id$ '''
__doc__="""Experimental class to generate Tables of Contents easily
This module defines a single... | yasoob/PythonRSSReader | venv/lib/python2.7/dist-packages/reportlab/platypus/tableofcontents.py | Python | mit | 20,681 |
# -*- coding: utf-8 -*-
# Copyright © 2012-2022 Roberto Alsina and others.
# 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 rights t... | getnikola/nikola | nikola/plugins/task/copy_files.py | Python | mit | 2,163 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# File: cifar.py
# Author: Yuxin Wu <ppwwyyxx@gmail.com>
# Yukun Chen <cykustc@gmail.com>
import os
import pickle
import numpy as np
import six
from six.moves import range
from ...utils import logger
from ...utils.fs import download, get_dataset_path
from ..base i... | haamoon/tensorpack | tensorpack/dataflow/dataset/cifar.py | Python | apache-2.0 | 5,459 |
"""Gold subscription forms"""
from django import forms
from stripe.error import InvalidRequestError
from readthedocs.payments.forms import StripeModelForm, StripeResourceMixin
from .models import LEVEL_CHOICES, GoldUser
class GoldSubscriptionForm(StripeResourceMixin, StripeModelForm):
"""Gold subscription pay... | stevepiercy/readthedocs.org | readthedocs/gold/forms.py | Python | mit | 3,072 |
"""RESTful platform for notify component."""
import logging
import requests
import voluptuous as vol
from homeassistant.components.notify import (
ATTR_MESSAGE,
ATTR_TARGET,
ATTR_TITLE,
ATTR_TITLE_DEFAULT,
PLATFORM_SCHEMA,
BaseNotificationService,
)
from homeassistant.const import (
CONF_A... | turbokongen/home-assistant | homeassistant/components/rest/notify.py | Python | apache-2.0 | 7,690 |
# -*- coding: utf-8 -*-
from bika.lims.content.analysis import Analysis
from bika.lims.testing import BIKA_FUNCTIONAL_TESTING
from bika.lims.tests.base import BikaFunctionalTestCase
from bika.lims.utils import tmpID
from bika.lims.utils.analysisrequest import create_analysisrequest
from bika.lims.workflow import doAct... | labsanmartin/Bika-LIMS | bika/lims/tests/test_LIMS-2001-duplicate-one-analysis.py | Python | agpl-3.0 | 6,785 |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/devtools/resultstore_v2/proto/file_set.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.... | google/resultstoreui | resultstoreui/resultstoreapi/cloud/devtools/resultstore_v2/proto/file_set_pb2.py | Python | apache-2.0 | 7,589 |
"""
Course info page.
"""
from .course_page import CoursePage
class CourseInfoPage(CoursePage):
"""
Course info.
"""
URL_PATH = "info"
def is_browser_on_page(self):
return self.is_css_present('section.updates')
@property
def num_updates(self):
"""
Return the num... | pku9104038/edx-platform | common/test/acceptance/pages/lms/course_info.py | Python | agpl-3.0 | 609 |
# -*- coding: utf-8 -*-
import sys
import logging
import warnings
from logging.config import dictConfig
from twisted.python.failure import Failure
from twisted.python import log as twisted_log
import scrapy
from scrapy.settings import Settings
from scrapy.exceptions import ScrapyDeprecationWarning
from scrapy.utils.... | Ryezhang/scrapy | scrapy/utils/log.py | Python | bsd-3-clause | 6,556 |
import os.path
from robot.errors import DataError
from robot.utils import secs_to_timestr, timestr_to_secs
from selenium import webdriver
from selenium.common.exceptions import NoSuchWindowException
from Selenium2Library import webdrivermonkeypatches
from Selenium2Library.utils import BrowserCache
from Selenium2Libr... | Gaurang033/Selenium2Library | src/Selenium2Library/keywords/_browsermanagement.py | Python | apache-2.0 | 28,305 |
from bokeh.models import Panel, Tabs
from bokeh.io import output_file, show
from bokeh.plotting import figure
output_file("slider.html")
p1 = figure(plot_width=300, plot_height=300)
p1.circle([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], size=20, color="navy", alpha=0.5)
tab1 = Panel(child=p1, title="circle")
p2 = figure(plot_w... | stonebig/bokeh | sphinx/source/docs/user_guide/examples/interaction_tab_panes.py | Python | bsd-3-clause | 511 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import socket
import unittest
import warnings
from unittest import skipUnless
from django.conf import settings
from django.contrib.gis.geoip import HAS_GEOIP
from django.contrib.gis.geos import HAS_GEOS, GEOSGeometry
from django.test import ign... | cloudera/hue | desktop/core/ext-py/Django-1.11.29/tests/gis_tests/test_geoip.py | Python | apache-2.0 | 6,866 |
# pylint: disable=W0614,W0401,W0611
# flake8: noqa
import numpy as np
from pandas.core.algorithms import factorize, match, unique, value_counts
from pandas.core.common import isnull, notnull
from pandas.core.categorical import Categorical
from pandas.core.groupby import Grouper
from pandas.core.format import set_eng... | pjryan126/solid-start-careers | store/api/zillow/venv/lib/python2.7/site-packages/pandas/core/api.py | Python | gpl-2.0 | 1,378 |
#!/usr/bin/env python
import os
"""
def numCPUs():
if not hasattr(os, 'sysconf'):
raise RuntimeError('No sysconf detected.')
return os.sysconf('SC_NPROCESSORS_ONLN')
"""
bind = '0.0.0.0:5000'
workers = 4
# backlog = 2048
# worker_class = 'sync'
worker_class = 'gevent'
debug = True
daemon = True
pidfi... | ianjuma/it-docker-container | config-gunicorn.py | Python | gpl-2.0 | 375 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import ftplib as ftp
import sys
import tarfile
import smtplib
from datetime import datetime, timedelta
from time import time
try:
import ConfigParser
except ImportError:
import configparser as ConfigParser
try:
from StringIO import StringIO
except Im... | tux-00/ezbackup | ezbackup.py | Python | gpl-3.0 | 7,934 |
"""
Goal Sentry API
Models
"""
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime
from datetime import datetime as dt
from sqlalchemy.orm import relationship
from database import Base
class User(Base):
__tablename__ = 'users'
# Basic metadata
id = Column(Integer, primary_key=True)
... | stevenmirabito/GoalSentry | api/goalsentry/models.py | Python | mit | 2,593 |
import gtk, sys, pango
def label(text=None, textmn=None, markup=None, x=0, y=0.5, \
wrap=False, select=False, w=-1, h=-1):
# Defaults to left-aligned, vertically centered
tmplabel = gtk.Label()
if text:
tmplabel.set_text(text)
elif markup:
tmplabel.set_markup(markup)
elif... | KL-7/sonata | sonata/ui.py | Python | gpl-3.0 | 8,517 |
##!/usr/bin/env python
"""Search for sequences of transforms that solve a task"""
import time
import copy
import abc
from collections import namedtuple
import csv
import argparse
import statistics
import Levenshtein
import ftfy
from learning_text_transformer import transforms
from learning_text_transformer import confi... | ianozsvald/learning_text_transformer | learning_text_transformer/learner3.py | Python | mit | 8,533 |
import logging
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core import signals
from haystack.constants import DEFAULT_ALIAS
from haystack.utils import loading
__author__ = 'Daniel Lindsley'
__version__ = (2, 0, 0, 'beta')
# Setup default logging.
log = loggin... | boblefrag/lolyx | haystack/__init__.py | Python | gpl-3.0 | 2,222 |
# -*- coding: utf-8 -*-
__about__ = """
In addition to what is provided by the "zero" project, this project
provides thorough integration with django-user-accounts, adding
comprehensive account management functionality. It is a foundation
suitable for most sites that have user accounts.
"""
default_app_config = "ich_... | postpdm/ich_bau | ich_bau/__init__.py | Python | apache-2.0 | 340 |
# -*- test-case-name: twisted.test.test_randbytes -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Cryptographically secure random implementation, with fallback on normal random.
"""
# System imports
import warnings, os, random
getrandbits = getattr(random, 'getrandbits', None)
class... | waseem18/oh-mainline | vendor/packages/twisted/twisted/python/randbytes.py | Python | agpl-3.0 | 4,144 |
#!/usr/bin/python
import sys
if len(sys.argv) != 3 or sys.argv[2] == sys.argv[1]:
print "usage: dna_to_fastq.py <input_dna_filename> <output_fastq_filename>"
exit(1)
outfile = open(sys.argv[2], 'w')
rec_count = 0
for dna in open(sys.argv[1]):
qua = "H" * (len(dna) - 1)
outfile.write("@TAG.%d\n%s+\n%s\n" % (rec_... | lrog/orcom | scripts/dna_to_fastq.py | Python | gpl-2.0 | 414 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-10 06:04
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Aim',
... | TRIOrganization/TRI | TRI/main/migrations/0001_initial.py | Python | mit | 4,113 |
# -*- coding: UTF-8 -*-
from django.shortcuts import render
from django.template import loader, Context
from django.http import HttpResponse, HttpResponseRedirect
from travels.models import *
from favourite.models import *
from accounts.models import *
from django.shortcuts import render_to_response
from django.templat... | liuasliy/rdstourcms | favourite/views.py | Python | mit | 2,009 |
""""
Classes that each define a smoothly varying component of a scaling model.
These classes use a gaussian smoother (1D, 2D or 3D) to calculate the
inverse scale factors and derivatives with respect to the component
parameters.
"""
from __future__ import annotations
from math import ceil, floor
from scitbx import ... | dials/dials | algorithms/scaling/model/components/smooth_scale_components.py | Python | bsd-3-clause | 25,391 |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("zerver", "0035_realm_message_retention_period_days"),
]
operations = [
migrations.RenameField(
model_name="realm",
old_name="subdomain",
new_name="string_id",
... | rht/zulip | zerver/migrations/0036_rename_subdomain_to_string_id.py | Python | apache-2.0 | 335 |
#!/usr/bin/env python
from pymongo import Connection
from bson.code import Code
connection = Connection()
db = connection.pulp_database
m = Code(open("map.js", "r").read())
r = Code(open("reduce.js", "r").read())
coll = db.packages.map_reduce(m,r)
results = coll.find()
print results[0]
results = coll.find({"value.c... | mhrivnak/pulp | playpen/mongodb/orphaned_packages/driver.py | Python | gpl-2.0 | 756 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import Queue
import sys
import requests
import os
import threading
import time
class Worker(threading.Thread): # 处理工作请求
def __init__(self, workQueue, resultQueue, **kwds):
threading.Thread.__init__(self, **kwds)... | PegasusWang/articles | crawler/thread_pool_spider.py | Python | mit | 2,504 |
from coco.api.permissions import *
from coco.core.helpers import get_server_selection_algorithm
from coco.core.models import *
from coco.api.serializer import *
from django.contrib.auth.models import User, Group
from django.db.models import Q
from django_admin_conf_vars.models import ConfigurationVariable
from rest_fra... | coco-project/coco | coco/api/views.py | Python | bsd-3-clause | 38,697 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-09-19 15:30
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import hindustani.models
class Migration(migrations.Migration):
initial = True
dependencies = [
('data', '0001_in... | MTG/dunya | hindustani/migrations/0001_initial.py | Python | agpl-3.0 | 25,073 |
import sys
f = open(sys.argv[1],'r')#sys call
#reference:http://stackoverflow.com/questions/16233593/how-to-strip-comma-in-python-string
#remove new line,comma and period. rstrip does not work for commas.
line = f.readline().rstrip('\n.').replace(',','')
wordList = line.split(' ')
for word in wordList:
print len(w... | iku000888/Wordprocessing-100-Knoks | prob003/python/prob003.py | Python | mit | 336 |
"""
Deletes the Kubernetes cluster associated with this service. Used by the
Google Kubernetes Engine blueprint.
"""
from __future__ import unicode_literals
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError
from oauth2client.service_account import ServiceAccountCredentials
from ... | CloudBoltSoftware/cloudbolt-forge | blueprints/gke_cluster_legacy/delete_gke_cluster_legacy/delete_gke_cluster_legacy.py | Python | apache-2.0 | 2,203 |
import requests
import bs4
# It's "seems" a good idea to use this "enum", for now
class Category(object):
ALL = 0
MOVIE = 1
GAME = 2
ALBUM = 3
TV = 4
PERSON = 5
TRAILER = 6
COMPANY = 7
# Contains info about the query to be made
class Query(object):
# Standard constructor (w/ parame... | iconpin/pycritic | pycritic/pycritic.py | Python | mit | 4,097 |
# coding=utf-8
# Copyright 2022 The Tensor2Tensor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | tensorflow/tensor2tensor | tensor2tensor/data_generators/inspect_tfrecord.py | Python | apache-2.0 | 3,754 |
#droids.py
import time
import random
from random import randint
print('\n' * 100)
print('\n\n[-Droids : by jay : type help-]')
print('\n\n\n------------------------')
print(' DROIDS')
print('------------------------')
print('\n10.03.2245 : cytek inc.')
time.sleep(1)
print('\nCTRL866 Re-Boot Sequence....')
time.... | ActiveState/code | recipes/Python/578618_Droids__a_text_adventure_/recipe-578618.py | Python | mit | 13,762 |
# Copyright 2012 OpenStack 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 b... | usc-isi/essex-baremetal-support | nova/tests/api/openstack/compute/contrib/test_flavorextradata.py | Python | apache-2.0 | 3,547 |
import sys
import os
from ctypes import windll
user32 = windll.user32
SPI_SETFONTSMOOTHING = 0x004B # dec 75
SPI_SETFONTSMOOTHINGTYPE = 0x200B # dec 8203
SPIF_UPDATEINIFILE = 0x1
SPIF_SENDCHANGE = 0x2
FE_FONTSMOOTHINGCLEARTYPE = 0x2
is_font_smoothing_enabled = 1
if len(sys.argv) > 1:
if ... | ActiveState/code | recipes/Python/578500_Enable_Clear_Type_font_smoothing_Windows_ctypes_/recipe-578500.py | Python | mit | 545 |
""" A component that designates a capacitor. """
import sympy as sy
from component import Component
from config import Config
class Inductor(Component):
""" Inductor component """
def __init__(self, graph, inductance, node_a, node_b, edge_i):
""" Initializes a inductance with two nodes. Current goe... | ThatSnail/impede | impede-app/server/py/inductor.py | Python | mit | 2,635 |
import os
import sys
# Add parent directory to path to make test aware of other modules
srcfolder = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', "src"))
if srcfolder not in sys.path:
sys.path.append(srcfolder)
| lmotta/Roam | tests/__init__.py | Python | gpl-2.0 | 234 |
# Copyright (c) 2013-2016 Christian Geier et al.
#
# 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 rights to use, copy, modify, merge, ... | dzoep/khal | khal/settings/exceptions.py | Python | mit | 1,274 |
import logging
import sys
from argparse2tool import load_argparse
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
class Arg2GxmlParser:
def __init__(self):
ap = load_argparse() # avoid circular imports
help_text = (
"argparse2tool forms Galaxy XML and CWL... | erasche/argparse2tool | argparse2tool/cmdline2gxml/__init__.py | Python | apache-2.0 | 1,040 |
from time import clock
def timer(function):
def wrapper(*args, **kwargs):
start = clock()
print(function(*args, **kwargs))
print("Solution took: %f seconds." % (clock() - start))
return wrapper
@timer
def find_answer():
total = 1
previous_max = 1
size = 1001
for leve... | Igglyboo/Project-Euler | 1-99/20-29/Problem28.py | Python | unlicense | 495 |
import pytest
import sqlalchemy as sa
from sqlalchemy_utils import dependent_objects, get_referencing_foreign_keys
class TestDependentObjects(object):
@pytest.fixture
def User(self, Base):
class User(Base):
__tablename__ = 'user'
id = sa.Column(sa.Integer, primary_key=True)
... | konstantinoskostis/sqlalchemy-utils | tests/functions/test_dependent_objects.py | Python | bsd-3-clause | 10,549 |
import gradient
import grid
import pygame
import sys
from cmath import sqrt
import math
grid_width = 200
grid_height = 200
grid_drawing_mulitplier = 2
g = grid.create_led_grid(grid_width,grid_height)
np = grid.neoPixelRing(8,0)
np2 = grid.neoPixelRing(8,1)
np3 = grid.neoPixelRing(8,2)
g.insertPixelRing(np,7,2)
g.i... | theceremony/pyramids-installation | python/test.py | Python | mit | 2,570 |
"""
bamboo.globals
~~~~~~~~~~~~~
"""
from peak.util.proxies import CallbackProxy
from bamboo.context import context
db = CallbackProxy(lambda: context["db"])
| hahnicity/bamboo | bamboo/globals.py | Python | mit | 159 |
# -*- coding: utf-8 -*-
## begin license ##
#
# "Weightless" is a High Performance Asynchronous Networking Library. See http://weightless.io
#
# Copyright (C) 2006-2011 Seek You Too (CQ2) http://www.cq2.nl
# Copyright (C) 2011-2016, 2020-2021 Seecr (Seek You Too B.V.) https://seecr.nl
#
# This file is part of "Weightle... | seecr/weightless-core | weightless/io/_reactor.py | Python | gpl-2.0 | 22,610 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from multiprocessing import Pool
def test(x):
print('call test')
return x * x
if __name__ == '__main__':
with Pool(5) as p:
print(p.map(test, [1,2,3]))
# https://docs.python.org/dev/library/multiprocessing.html
| sharkspeed/dororis | languages/python/corelibs/test_multiprocess.py | Python | bsd-2-clause | 282 |
# This file is part of the bapsflib package, a Python toolkit for the
# BaPSF group at UCLA.
#
# http://plasma.physics.ucla.edu/
#
# Copyright 2017-2019 Erik T. Everson and contributors
#
# License: Standard 3-clause BSD; see "LICENSES/LICENSE.txt" for full
# license terms and contributor agreement.
#
"""
Decorators ... | rocco8773/bapsflib | bapsflib/utils/decorators.py | Python | bsd-3-clause | 13,153 |
from __future__ import unicode_literals
import os
from collections import OrderedDict
from django.apps import apps
from django.contrib.staticfiles.finders import get_finders
from django.contrib.staticfiles.storage import staticfiles_storage
from django.core.files.storage import FileSystemStorage
from django.core.mana... | KrzysztofStachanczyk/Sensors-WWW-website | www/env/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py | Python | gpl-3.0 | 14,419 |
#Ryan G. Coleman, Kim A. Sharp crystal.med.upenn.edu, ryan.g.coleman ATSYMBOL gmail.com
#bunch of helper methods for orthogonal range searching in the context of depth
import rangesearch
import geometry
import operator
import sys
def getIntersectingPts(
startPt, endPt, longEdge, shortAxis1, shortAxis2, orst, maxI... | ryancoleman/traveldistance | src/orstHelper.py | Python | gpl-2.0 | 13,203 |
#! /usr/bin/python
# Copyright 2004 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
db = {
"QPtrVector<FX::FXWindow>" : "QPtrVectorOfFXWindow"
, "QMemArray<unsigned char>" : "QMemArrayOfU... | ned14/tnfox | Python/aliases.py | Python | lgpl-2.1 | 1,055 |
from math import *
inp = raw_input()
spl = inp.split()
n = int(spl[0])
m = int(spl[1])
a = int(spl[2])
i = int(ceil(n * 1.0 / a))
j = int(ceil(m * 1.0 / a))
print max(1, i * j) | yamstudio/Codeforces | 000/1A - Theatre Square.py | Python | gpl-3.0 | 177 |
import sqlite3
from random import randint
#create a new database called newnum.db if it doesn't already exist
with sqlite3.connect("newnum.db") as connection:
c = connection.cursor()
c.execute("DROP TABLE if exists random_numbers")
c.execute("""CREATE TABLE random_numbers
(rnum INT)
... | joelstanner/RealPython_book2 | assignment3a.py | Python | mit | 559 |
import json
import warnings
import fabricio
from fabricio import utils
from .base import BaseService, Option, Attribute, ServiceError
class ContainerError(ServiceError):
pass
class ContainerNotFoundError(ContainerError):
pass
class Container(BaseService):
command = Attribute()
stop_timeout = ... | renskiy/fabricio | fabricio/docker/container.py | Python | mit | 5,302 |
########################################################################
#
# (C) 2015, Chris Houseknecht <chouse@ansible.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 Fo... | azaghal/ansible | lib/ansible/galaxy/login.py | Python | gpl-3.0 | 4,922 |
import nebu.cli.main
def test_for_version(monkeypatch, invoker):
version = 'X.Y.Z'
monkeypatch.setattr(nebu.cli.main, '__version__', version)
from nebu.cli.main import cli
args = ['--version']
result = invoker(cli, args)
assert result.exit_code == 0
expected_output = 'Nebuchadnezzar {}\... | Connexions/nebuchadnezzar | nebu/tests/cli/test_main.py | Python | agpl-3.0 | 3,573 |
"""initial migration
Revision ID: 43e4ff56fbb
Revises: None
Create Date: 2015-09-15 17:37:55.801842
"""
# revision identifiers, used by Alembic.
revision = '43e4ff56fbb'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! #... | JXNU-ACS/learn-blog | migrations/versions/43e4ff56fbb_initial_migration.py | Python | mit | 865 |
# - *- coding: utf- 8 - *-
import re
from .service import Service
from .utils import geocoding_utils
from .utils import geocoding_constants
from .utils import TableGeocodingLock
from ...utils.logger import log
from ...io.managers.source_manager import SourceManager
from ...io.carto import read_carto, to_carto, has_ta... | CartoDB/cartoframes | cartoframes/data/services/geocoding.py | Python | bsd-3-clause | 21,461 |
#!/usr/bin/env python3
import getopt
import glob
import os
import sys
import diamond.debug as debug
import diamond.schema as schema
def Help():
debug.dprint("Usage: update_options [OPTIONS] ... [FILES]\n" + \
"\n" + \
"Updates flml, and adml files. If FILES is not specified, all .flml... | FluidityStokes/fluidity | tools/update_options.py | Python | lgpl-2.1 | 2,714 |
import logging
import copy
from itertools import count
import claripy
from claripy.vsa import ValueSet, RegionAnnotation
from ..storage.memory import SimMemory, AddressWrapper, MemoryStoreRequest, RegionMap
from ..s_errors import SimMemoryError
from ..s_options import KEEP_MEMORY_READS_DISCRETE, AVOID_MULTIVALUED_REA... | chubbymaggie/simuvex | simuvex/plugins/abstract_memory.py | Python | bsd-2-clause | 25,033 |
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import hr
| OCA/hr | hr_job_category/models/__init__.py | Python | agpl-3.0 | 82 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.