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 csv
from bs4 import BeautifulSoup
from collections import Counter
import re
import os
OUTPUT_NAME = os.getenv('OUTPUT_NAME',
'data_detikcom_labelled_740_7_class.csv')
csv_file = open('data_detikcom_labelled_740.csv')
csv_reader = csv.DictReader(csv_file)
# Tranform individual label to candidate pair labe... | CodeRiderz/rojak | rojak-analyzer/convert_13_labels_to_7_labels.py | Python | bsd-3-clause | 1,929 | 0.004147 |
# Copyright (c) 2016 Iotic Labs Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://github.com/Iotic-Labs/py-IoticAgent/blob/master/LICENSE
#
# Unless re... | Iotic-Labs/py-IoticAgent | src/IoticAgent/Datatypes.py | Python | apache-2.0 | 4,222 | 0.005921 |
'''
Kaya Baber
Physics 440 - Computational Physics
Assignment 3
Problem 1
Hamiltonian Dynamics of a Nonlinear Pendulum
Consider a simple pendulum of length in
gravitational field g. The frequency in the limit of small angles is Ω_0 ≡ radical(g/l) , but do not assume the limit
of small angles for the following calculat... | KayaBaber/Computational-Physics | Assignment_3_chaos_and_pendulums/Pre-GitHub-versions/Phys440_Assignment03_Prob1 (1).py | Python | mit | 1,186 | 0.009434 |
# Copyright (c) 2013 Jordan Halterman <jordan.halterman@gmail.com>
# See LICENSE for details.
import sys, os
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
from active_redis import ActiveRedis
redis = ActiveRedis()
# Create an unnamed set.
myset = redis.set()
# Add items to the set.
myset.add('foo')
... | kuujo/active-redis | examples/set.py | Python | mit | 554 | 0.00722 |
#!/usr/bin/env python
# encoding: utf-8
"""A test module"""
import datetime
import tempfile
import os
import shutil
import scores.common as common
class TestCommon(object):
""" A Test class"""
def test_date_function(self):
"""Test"""
a_date = datetime.datetime.now()
a_date = a_date... | zesk06/scores | tests/common_test.py | Python | mit | 524 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-31 00:22
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('configuration_management_tools', '0001_initial'),
]
operations = [
migrations.Alter... | lsantagata/smslib_ui | src/configuration_management_tools/migrations/0002_auto_20170731_0022.py | Python | gpl-3.0 | 608 | 0 |
import os, sys, shutil
# change back to the build dir
if os.path.dirname( sys.argv[0] ) != "":
os.chdir( os.path.dirname( sys.argv[0] ) )
# find setuptools
scramble_lib = os.path.join( "..", "..", "..", "lib" )
sys.path.append( scramble_lib )
import get_platform # fixes fat python 2.5
from ez_setup import use_set... | volpino/Yeps-EURAC | scripts/scramble/scripts/generic.py | Python | mit | 1,149 | 0.035683 |
"""
__graph_MT_post__OUT2.py___________________________________________________________
Automatically generated graphical appearance ---> MODIFY DIRECTLY WITH CAUTION
__________________________________________________________________________
"""
import tkFont
from graphEntity import *
from GraphicalForm import ... | levilucio/SyVOLT | UMLRT2Kiltera_MM/graph_MT_post__OUT2.py | Python | mit | 2,604 | 0.024578 |
r'''
<license>
CSPLN_MaryKeelerEdition; Manages images to which notes can be added.
Copyright (C) 2015-2016, Thomas Kercheval
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 L... | SpaceKatt/CSPLN | scripts/create_web_apps_linux.py | Python | gpl-3.0 | 5,043 | 0.00238 |
from __future__ import print_function
import glob
import os
import re
import warnings
try:
from importlib import import_module
except ImportError:
import_module = __import__
from distutils.version import LooseVersion
import pytest
import numpy as np
from numpy.random import rand
from pandas import (DataFr... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/pandas/tests/io/test_html.py | Python | mit | 33,092 | 0 |
class Solution(object):
def strStr(self, haystack, needle):
"""
:type haystack: str
:type needle: str
:rtype: int
"""
for i in range(len(haystack)-len(needle) + 1):
if haystack[i: i + len(needle)] == needle:
return i
return -1
| scream7/leetcode | algorithms/python/28.py | Python | apache-2.0 | 315 | 0 |
import logging
from ..models import Activity
from .date import activity_stream_date_to_datetime, datetime_to_string
log = logging.getLogger(__name__)
def activity_from_dict(data):
log.debug("Converting YouTube dict to Activity Model")
activity_dict = activity_dict_from_dict(data)
return Activity.from_ac... | blitzagency/django-chatterbox | chatterbox/utils/youtube.py | Python | mit | 4,331 | 0.000693 |
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 7 13:10:05 2016
@author: thasegawa
"""
import os
import pandas as pd
economic_list = list(pd.read_excel('data\\fields\\economicIndicators_Real.xlsx', header=None)[0])
#fuel_list = list(pd.read_excel('data\\fields\\fuel_binary.xlsx', header=None)[0]) + [None]
fuel_list ... | tzechiop/PANYNJ-Regression-Analysis-for-Toll-Traffic-Elasticity | mergeResults.py | Python | mit | 2,928 | 0.003415 |
# Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# This file is licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# This f... | awsdocs/aws-doc-sdk-examples | lambda_functions/codecommit/MyCodeCommitFunction.py | Python | apache-2.0 | 2,083 | 0.005281 |
"""Facility to use the Expat parser to load a minidom instance
from a string or file.
This avoids all the overhead of SAX and pulldom to gain performance.
"""
# Warning!
#
# This module is tightly bound to the implementation details of the
# minidom DOM and can't be used with other DOM implementations. This
# is due... | huran2014/huran.github.io | wot_gateway/usr/lib/python2.7/xml/dom/expatbuilder.py | Python | gpl-2.0 | 36,382 | 0.00044 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-11-17 19:24
from __future__ import unicode_literals
import c3nav.mapdata.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('mapdata', '0047_remove_mapupdat... | c3nav/c3nav | src/c3nav/mapdata/migrations/0048_ramp.py | Python | apache-2.0 | 1,532 | 0.004569 |
def _checkInput(index):
if index < 0:
raise ValueError("Indice negativo non supportato [{}]".format(index))
elif type(index) != int:
raise TypeError("Inserire un intero [tipo input {}]".format(type(index).__name__))
def fib_from_string(index):
_checkInput(index)
serie = "0 1 1 2 3 5 8".... | feroda/lessons-python4beginners | students/2016-09-04/simone-cosma/fibonacci.py | Python | agpl-3.0 | 1,035 | 0.016425 |
#!/usr/bin/env python
import analyze_conf
import sys
import datetime, glob, job_stats, os, subprocess, time
import operator
import matplotlib
# Set the matplotlib output mode from config if it exists
if not 'matplotlib.pyplot' in sys.modules:
try:
matplotlib.use(analyze_conf.matplotlib_output_mode)
except NameE... | ubccr/tacc_stats | analyze/process_pickles/miss_vs_stall.py | Python | lgpl-2.1 | 5,040 | 0.044048 |
def populate(template, values):
# template is a string containing tags. the tags get replaced with the entries from the values dictionary.
# example:
# > template = "hello there <<your name>>!"
# > values = {"your name": "bukaroo banzai"}
# > populateTemplate( template, values)
# "hello ... | nomel/beaglebone | pru-gpio/templates.py | Python | unlicense | 3,354 | 0.004472 |
# Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# 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, publ... | sidzan/netforce | netforce_mfg/netforce_mfg/models/bom_line.py | Python | mit | 1,967 | 0.004575 |
#!/usr/bin/python
import re
userInput = raw_input("input equation\n")
numCount = 0
operandCount = 0
entryBracketCount = 0
exitBracketCount = 0
charCount = 0
endOfLine = len(userInput) - 1
for i in range(len(userInput)):
if (re.search('[\s*a-z\s*A-Z]+', userInput[i])):
charCount = charCount + 1
print operandCoun... | dominickhera/PosaRepo | cis3250labs/parseTest.py | Python | apache-2.0 | 2,244 | 0.039661 |
"""Support for Zigbee switches."""
import voluptuous as vol
from homeassistant.components.switch import SwitchDevice
from . import PLATFORM_SCHEMA, ZigBeeDigitalOut, ZigBeeDigitalOutConfig
CONF_ON_STATE = "on_state"
DEFAULT_ON_STATE = "high"
STATES = ["high", "low"]
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({vol.O... | leppa/home-assistant | homeassistant/components/zigbee/switch.py | Python | apache-2.0 | 669 | 0.001495 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Python 3.2 code
#
# Copyright (c) 2012 Jeff Smits
#
# 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 opt... | Apanatshka/C3P | c3p/tests/all_tests.py | Python | gpl-3.0 | 1,036 | 0.003861 |
#!/usr/bin/env python2
#
# wsi_bot_codebook3
#
# Version 3 of codebook construction:
#
# -uses OpenCV for faster operation - but different local descriptors than in the 1st version;
# -uses annotation files for defining the regions from where the descriptors are to be
# extracted
# - try to optimize the codebook with... | vladpopovici/WSItk | WSItk/tools/wsi_bot_codebook3.py | Python | mit | 7,170 | 0.007671 |
"""Image renderer module."""
from mfr.core import RenderResult
def render_img_tag(fp, src=None, alt=''):
"""A simple image tag renderer.
:param fp: File pointer
:param src: Path to file
:param alt: Alternate text for the image
:return: RenderResult object containing the content html
"""
#... | icereval/modular-file-renderer | mfr/ext/image/render.py | Python | apache-2.0 | 481 | 0 |
from zeit.cms.i18n import MessageFactory as _
import grokcore.component as grok
import logging
import zeit.cms.interfaces
import zeit.objectlog.interfaces
import zeit.push.interfaces
import zope.cachedescriptors.property
import zope.component
log = logging.getLogger(__name__)
class Message(grok.Adapter):
grok.... | ZeitOnline/zeit.push | src/zeit/push/message.py | Python | bsd-3-clause | 13,344 | 0 |
import sys
import os
from scale_model import StartupDataModel, VCModel
from flask.ext.restful import Resource, reqparse
from flask import Flask, jsonify, request, make_response
import os
from database import db
from flask.ext.security import current_user
from json import dumps
class Scale_DAO(object):
def __init_... | wigginslab/lean-workbench | lean_workbench/scale/scale_resource.py | Python | mit | 1,731 | 0.005777 |
import numpy
# from nmt import train
# from nmtlm import train
from nmt import train
def main(job_id, params):
print params
trainerr, validerr, testerr = train(saveto=params['model'][0],
reload_=params['reload'][0],
dim_word=param... | tangyaohua/dl4mt | session2/train_nmt.py | Python | bsd-3-clause | 1,646 | 0.003645 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/monitoring/bigpanda.py | Python | bsd-3-clause | 5,763 | 0.002776 |
import socket
import random
from PIL import Image
import json
import sys, getopt
import math
import pika
# Screen VARS
offset_x = 80
offset_y = 24
screen_width = 240
screen_height = 240
# Internal options
queueAddress = ''
fileName = ''
workers = 36
Matrix = []
def main(argv):
global fileName, workers
inp... | jargij/led-pomper-sha2017 | img_to_queue.py | Python | mit | 3,094 | 0.005171 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 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... | sileht/deb-openstack-nova | nova/db/sqlalchemy/migrate_repo/versions/035_secondary_dns.py | Python | apache-2.0 | 1,198 | 0 |
# Generated by Django 2.1.5 on 2019-10-01 19:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('comment', '0005_auto_20191001_1559'),
]
operations = [
migrations.AlterField(
model_name='dataset',
name='dts_type',... | linea-it/dri | api/comment/migrations/0006_auto_20191001_1943.py | Python | gpl-3.0 | 596 | 0.001678 |
#!/usr/bin/env python
#coding:utf-8
# Author: mozman --<mozman@gmx.at>
# Purpose: test mixin Clipping
# Created: 31.10.2010
# Copyright (C) 2010, Manfred Moitzi
# License: GPLv3
import unittest
from svgwrite.mixins import Clipping
from svgwrite.base import BaseElement
class SVGMock(BaseElement, Clippin... | hirobert/svgwrite | tests/test_clipping.py | Python | gpl-3.0 | 800 | 0.0075 |
from typing import Iterable, Callable, Optional, Any, List, Iterator
from dupescan.fs._fileentry import FileEntry
from dupescan.fs._root import Root
from dupescan.types import AnyPath
FSPredicate = Callable[[FileEntry], bool]
ErrorHandler = Callable[[EnvironmentError], Any]
def catch_filter(inner_filter: FSPredicat... | yellcorp/dupescan | dupescan/fs/_walker.py | Python | mit | 4,089 | 0.005625 |
#!/usr/bin/env python3
from pyserv.databrowse import main
main()
| Vierkantor/PyServ | run.py | Python | gpl-3.0 | 67 | 0 |
import os, sys
up_path = os.path.abspath('..')
sys.path.append(up_path)
from numpy import *
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from matplotlib import rc
from objects import SimObject
from utils import scalar
from covar import draw_ellipsoid, vec2cov, cov2vec,\
pr... | viswimmer1/PythonGenerator | data/python_files/30585323/ravebot.py | Python | gpl-2.0 | 7,909 | 0.013529 |
class Solution:
def toLowerCase(self, str: str) -> str:
rs = ""
# 32
section = ord("a") - ord("A")
for s in str:
if ord(s) >= ord("A") and ord(s) <= ord("Z"):
rs = rs + chr(ord(s) + section)
else:
rs = rs + s
return r... | yleo77/leetcode | To_Lower_Case/answer.py | Python | mit | 372 | 0.002688 |
from .nucleicacidpartitemcontroller import NucleicAcidPartItemController
from .oligoitemcontroller import OligoItemController
from .stranditemcontroller import StrandItemController
from .viewrootcontroller import ViewRootController
from .virtualhelixitemcontroller import VirtualHelixItemController | scholer/cadnano2.5 | cadnano/controllers/__init__.py | Python | mit | 298 | 0.003356 |
r""""DeepHOL large scale reporting in Apache Beam."""
from __future__ import absolute_import
from __future__ import division
# Import Type Annotations
from __future__ import print_function
import io
import os
import apache_beam as beam
from apache_beam.metrics import Metrics
import matplotlib.pyplot as plot
import ten... | tensorflow/deepmath | deepmath/deephol/deephol_loop/report.py | Python | apache-2.0 | 8,295 | 0.005907 |
def propagate(la): # la: [list(int)]
print la, la # [str], [str]
propagate([1]) # []
propagate([2]) # []
| shedskin/shedskin | tests/28.py | Python | gpl-3.0 | 210 | 0.009524 |
from brms.settings.base import *
import dj_database_url
DEBUG = False
ALLOWED_HOSTS = ['.example.com']
# Use the cached template loader so template is compiled once and read from
# memory instead of reading from disk on each load.
TEMPLATES[0]['OPTIONS']['loaders'] = [
('django.template.loaders.cached.Loader', ... | maurobaraldi/brms | brms/_settings/production.py | Python | mit | 491 | 0.002037 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-07 19:20
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('posts', '0001_initial'),
]
operations = [
migrations.AlterField(
... | rodriguesrl/reddit-clone-udemy | posts/migrations/0002_auto_20170307_1920.py | Python | mit | 419 | 0 |
# -*- coding: utf-8 -*-
import os,math
from qgis.core import NULL
from mole import oeq_global
from mole.project import config
from mole.extensions import OeQExtension
from mole.stat_corr import rb_contemporary_base_uvalue_by_building_age_lookup
def calculation(self=None, parameters={},feature = None):
from math i... | UdK-VPT/Open_eQuarter | mole/extensions/eval_enev/oeq_AHDE.py | Python | gpl-2.0 | 1,413 | 0.008499 |
"""
Serializers for Video Abstraction Layer
Serialization is usually sent through the VideoSerializer which uses the
EncodedVideoSerializer which uses the profile_name as it's profile field.
"""
from rest_framework import serializers
from django.core.exceptions import ValidationError
from edxval.models import Profile... | GbalsaC/bitnamiP | edx-val/edxval/serializers.py | Python | agpl-3.0 | 4,408 | 0.001361 |
from django.conf.urls.defaults import patterns, url
urlpatterns = ()
| praekelt/jmbo-janrain | janrain/urls.py | Python | bsd-3-clause | 70 | 0 |
# Import a whole load of stuff
from System.IO import *
from System.Drawing import *
from System.Runtime.Remoting import *
from System.Threading import *
from System.Windows.Forms import *
from System.Xml.Serialization import *
from System import *
from Analysis.EDM import *
from DAQ.Environment import *
fro... | jstammers/EDMSuite | EDMScripts/EDMLoop_neg_slope.py | Python | mit | 14,423 | 0.026555 |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
long_desc = '''
This package contains the ${name} Sphinx extension.
.. add description here ..
'''
requires = ['Sphinx>=0.6']
setup(
name='sphinxcontrib-${name}',
version='0.1',
url='http://bitbucket.org/birkenfeld/sphinx-contrib',
... | Lemma1/MAC-POSTS | doc_builder/sphinx-contrib/_template/setup.py | Python | mit | 1,194 | 0.000838 |
from collections import defaultdict
from datetime import datetime
import gc
import json
import math
import random
import sys
from .config_sample import MAX_ITERATIONS, DEBUG, PRETTY_LOG, MAX_DOCS_PER_QUERY, SERP_SIZE, TRANSFORM_LOG, QUERY_INDEPENDENT_PAGER, DEFAULT_REL
class NotImplementedError(Exception):
pass
... | varepsilon/clickmodels | clickmodels/inference.py | Python | bsd-3-clause | 36,839 | 0.005076 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | ywcui1990/nupic | src/nupic/data/stats.py | Python | agpl-3.0 | 6,351 | 0.013384 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-08-02 21:54
from __future__ import unicode_literals
from django.db import migrations, models
def copy_to_question_page(apps, schema_editor):
current_database = schema_editor.connection.alias
QuestionPage = apps.get_model('wizard_builder.QuestionPag... | scattermagic/django-wizard-builder | wizard_builder/migrations/0009_pagebase_to_questionpage.py | Python | bsd-3-clause | 1,476 | 0.001355 |
#!/bin/python
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
import os, struct, sys, pty, tty, termios, shlex, signal, pyte, time, fcntl ,getpass
from select import select
from fenrirscreenreader.core import debug
from fenrirscreenreader.core.eventData import fenrirEven... | chrys87/fenrir | src/fenrirscreenreader/screenDriver/ptyDriver.py | Python | lgpl-3.0 | 9,221 | 0.010845 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-12-17 20:50
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('jordbruksmark', '0002_auto_20161217_2140'),
]
operations = [
migrations.AlterModelO... | ortoloco/jordbruksmark | jordbruksmark/migrations/0003_auto_20161217_2150.py | Python | gpl-3.0 | 472 | 0.002119 |
# Copyright 2020 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 l... | stackforge/cloudbase-init | cloudbaseinit/metadata/services/nocloudservice.py | Python | apache-2.0 | 11,949 | 0 |
#!/usr/bin/env python
import sys
def inv(s):
if s[0] == '-':
return s[1:]
elif s[0] == '+':
return '-' + s[1:]
else: # plain number
return '-' + s
if len(sys.argv) != 1:
print 'Usage:', sys.argv[0]
sys.exit(1)
for line in sys.stdin:
linesplit = line.strip().split()
if len(linesplit) == 3:
... | hlzz/dotfiles | graphics/cgal/Segment_Delaunay_graph_Linf_2/developer_scripts/lsprotate90.py | Python | bsd-3-clause | 636 | 0.023585 |
# -*- coding: utf-8 -*-
"""
anparser - an Open Source Android Artifact Parser
Copyright (C) 2015 Preston Miller
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
(a... | anparser/anparser | anparser/plugins/other_plugins/yara_parser.py | Python | gpl-3.0 | 3,312 | 0.001208 |
from dart.model.base import BaseModel, dictable
@dictable
class ApiKey(BaseModel):
def __init__(self, id, user_id, api_key, api_secret):
"""
:type user_id: str
:type api_key: str
:type api_secret: str
"""
self.id = id
self.user_id = user_id
self.api_k... | RetailMeNotSandbox/dart | src/python/dart/model/api_key.py | Python | mit | 370 | 0.002703 |
import time
import recordlib
if __name__ == "__main__":
recordlib.initialize()
print("waiting for input")
recordlib.logging.info("waiting for input")
try:
# define interrupt, get rising signal, debounce pin
recordlib.GPIO.add_event_detect(
recordlib.TASTER_1,
rec... | benjaminhabbel/motion_recorder | old/button_loop.py | Python | gpl-3.0 | 770 | 0 |
from __future__ import print_function
from imports import *
import common
class Base( common.Base ):
pass
class TestUnitMiSeqToNewbler( Base ):
def _C( self, *args, **kwargs ):
from bactpipeline.fix_fastq import miseq_to_newbler_id
return miseq_to_newbler_id( *args, **kwargs )
def test_r1... | VDBWRAIR/bactpipeline | test/test_fix_fastq.py | Python | gpl-2.0 | 2,468 | 0.040519 |
"""
@brief test log(time=200s)
"""
import os
import unittest
import math
import warnings
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import get_temp_folder, is_travis_or_appveyor
from ensae_teaching_cs.special.image.image_synthese_base import Vecteur, Couleur, Source, Repere
from ensae_teach... | sdpython/ensae_teaching_cs | _unittests/ut_special/test_LONG_image2.py | Python | mit | 2,586 | 0.001933 |
# ===========================================================================
# Copyright 2013 University of Limerick
#
# This file is part of DREAM.
#
# DREAM 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 Founda... | bchiroma/dreamproject | dream/simulation/Frame.py | Python | gpl-3.0 | 1,515 | 0.014521 |
#
# This is a parser that generates the document tree for you.
#
# To use this parser, create an instance of XElementParser:
# parser = saxexts.make_parser()
# xp = XElementParser(parser)
#
# If you have defined classes in the current environment, you might want ot
# pass this environment *to* the parser, so your... | aarestad/gradschool-stuff | xml-class/python-xml/JobMarkupLanguage/xparser.py | Python | gpl-2.0 | 2,877 | 0.014599 |
import os
import re
BROKER_URL = os.getenv("CLOUDAMQP_URL", 'amqp://')
# BROKER_POOL_LIMIT = None
MONGOLAB_URI = None
MONGOLAB_DB = None
URI_WITH_AUTH = None
mongolab = os.getenv("MONGOLAB_URI")
if mongolab is not None:
uri_pat = r"mongodb://([^:]+):([^@]+)@([^:]+):(\d+)/(.+)"
user, passwd, host, port, db = ... | susurrant-audio/scdown | scdown/celeryconfig.py | Python | mit | 747 | 0 |
# -*- coding: utf-8 -*-
# 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 http://mozilla.org/MPL/2.0/.
import json
import re
from django.conf import settings
from django.db.models import Q
from dja... | kewisch/bedrock | bedrock/firefox/views.py | Python | mpl-2.0 | 18,915 | 0.000212 |
# -*- coding: utf-8 -*-
#
# This file is part of REANA.
# Copyright (C) 2019 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Job Manager."""
import json
import shlex
from flask import current_app
from reana_commons... | diegodelemos/reana-job-controller | reana_job_controller/job_manager.py | Python | mit | 4,466 | 0.000224 |
#!/usr/bin/env python
#encode=utf-8
#vim: tabstop=4 shiftwidth=4 softtabstop=4
#Created on 2013-6-24
#Copyright 2013 nuoqingyun xuqifeng
from bson.code import Code
traffic_map = Code("function () {"
"emit(this.domain, this.bytes);"
"}")
traffic_reduce = Code("function (key, values) {"
... | homhei/glance | glance/db/js.py | Python | apache-2.0 | 1,449 | 0.014493 |
from pandac.PandaModules import Vec3
from direct.interval.IntervalGlobal import Sequence, Parallel, Wait, Func
from direct.interval.IntervalGlobal import LerpScaleInterval
from direct.interval.IntervalGlobal import WaitInterval, ActorInterval, FunctionInterval
from direct.task.Task import Task
from direct.directnotify ... | ksmit799/Toontown-Source | toontown/parties/PartyCatchActivityToonSD.py | Python | mit | 9,299 | 0.003979 |
import datetime
try:
import cPickle as pickle
except ImportError:
import pickle
from django.db import models
from django.db.models.query import QuerySet
from django.conf import settings
from django.core.urlresolvers import reverse
from django.template import Context
from django.template.loader import render_t... | soad241/django-notification | notification/models.py | Python | mit | 14,929 | 0.002612 |
# coding=utf-8
# Copyright 2018 The Google Research 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 applicab... | google-research/policy-learning-landscape | eager_pg/trajectory_batch_stats_test.py | Python | apache-2.0 | 5,906 | 0.003725 |
#!/usr/bin/env python
# This file is part of nexdatas - Tango Server for NeXus data writer
#
# Copyright (C) 2012-2017 DESY, Jan Kotanski <jkotan@mail.desy.de>
#
# nexdatas is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the ... | nexdatas/configtool | test/DefinitionDlg_test.py | Python | gpl-3.0 | 85,762 | 0 |
#!/usr/bin/env python3
import sys
import numatuned
dryrun = False
if len(sys.argv) > 1:
if sys.argv[1] == '-n':
dryrun = True
numatuned.fire(60, dryrun)
| dionbosschieter/numatuned | numatuned.py | Python | mit | 167 | 0 |
import tflearn
from tflearn.data_utils import to_categorical, pad_sequences
from tflearn.datasets import imdb
# IMDB Dataset loading
train, test, _ = imdb.load_data(path='imdb.pkl', n_words=10000,
valid_portion=0.1)
trainX, trainY = train
testX, testY = test
# Data preprocessing
# Sequ... | sethuiyer/mlhub | Deep Sentiment Analysis/build_sentiment_model.py | Python | mit | 1,105 | 0.000905 |
# Copyright (c) 2020, Djaodjin Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... | djaodjin/djaodjin-signup | signup/docs.py | Python | bsd-2-clause | 2,317 | 0.001295 |
from fabric.api import env, local, run, sudo
env.user = 'root'
env.hosts = ['204.232.205.6']
env.code_dir = '/home/docs/sites/readthedocs.org/checkouts/readthedocs.org'
env.virtualenv = '/home/docs/sites/readthedocs.org'
env.rundir = '/home/docs/sites/readthedocs.org/run'
env.chef_executable = '/var/lib/gems/1.8/bin/... | alex/readthedocs.org | deploy/fabfile.py | Python | mit | 940 | 0.004255 |
class Solution(object):
def maxProfit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
low=1<<31
profit=0
for p in prices:
if p<low:
low=p
if p-low>profit:
profit=p-low
return profit | Tanych/CodeTracking | 121-Best-Time-to-Buy-and-Sell-Stock/solution.py | Python | mit | 316 | 0.025316 |
import sqlalchemy as sa
from oslo_db.sqlalchemy import types as db_types
from nca47.db.sqlalchemy.models import base as model_base
from nca47.objects import attributes as attr
HasTenant = model_base.HasTenant
HasId = model_base.HasId
HasStatus = model_base.HasStatus
HasOperationMode = model_base.HasOperationMode
c... | willowd878/nca47 | nca47/db/sqlalchemy/models/dns.py | Python | apache-2.0 | 1,680 | 0 |
from utile import pretty_xml, xml_to_dict, element_to_dict
from testsuite.support import etree, TestCase
import unittest
XML_DATA = "<html><body><h1>test1</h1><h2>test2</h2></body></html>"
XML_PRETTY = """\
<html>
<body>
<h1>test1</h1>
<h2>test2</h2>
</body>
</html>
"""
XML_DICT = {'body': {'h2': 'test2',... | marwano/utile | testsuite/test_xml.py | Python | bsd-3-clause | 709 | 0 |
#!/usr/bin/env python
#
# Original filename: config.py
#
# Author: Tim Brandt
# Email: tbrandt@astro.princeton.edu
# Date: August 2011
#
# Summary: Set configuration parameters to sensible values.
#
import re
from subprocess import *
import multiprocessing
import numpy as np
def config(nframes, framesize):
####... | t-brandt/acorns-adi | utils/config.py | Python | bsd-2-clause | 2,628 | 0.002664 |
# (c) 2018 Red Hat Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
from ansible.module_utils._text import to_text
from ansible.module_utils.connection import Connectio... | romain-dartigues/ansible | lib/ansible/plugins/httpapi/nxos.py | Python | gpl-3.0 | 5,290 | 0.001323 |
import json
import re
import uuid
from django.utils.translation import ugettext as _
from ide.utils.project import APPINFO_MANIFEST, PACKAGE_MANIFEST, InvalidProjectArchiveException
__author__ = 'katharine'
def manifest_name_for_project(project):
if project.is_standard_project_type and project.sdk_version == '... | thunsaker/cloudpebble | ide/utils/sdk/manifest.py | Python | mit | 11,537 | 0.001127 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Comment.score'
db.add_column(u'comment', 'score', self.gf('django.db.models.fields.Int... | maxwward/SCOPEBak | askbot/migrations/0021_auto__add_field_comment_score.py | Python | gpl-3.0 | 25,917 | 0.008604 |
# -*- coding=utf8 -*-
#******************************************************************************
# MediaTypes.py
#------------------------------------------------------------------------------
#
# Copyright (c) 2015 LivingOn <LivingOn@xmail.net>
#
# This program is free software; you can redistribute it and/or mod... | LivingOn/xbmc-script.youtube2kodi | resources/lib/MediaTypes.py | Python | gpl-2.0 | 5,517 | 0.005982 |
"""
This module is meant for vendorizing Python libraries. Most libraries will need
to have some ``sys.path`` alterations done unless they are doing relative
imports.
Do **not** add anything to this module that does not represent a vendorized
library.
Vendored libraries should go into the ``vendor`` directory and imp... | SUSE/ceph-deploy | ceph_deploy/lib/__init__.py | Python | mit | 817 | 0 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RPbdzmq(RPackage):
"""Programming with Big Data -- Interface to 'ZeroMQ'
'ZeroMQ' is... | LLNL/spack | var/spack/repos/builtin/packages/r-pbdzmq/package.py | Python | lgpl-2.1 | 1,667 | 0.002999 |
# Copyright (c) 2010 Mitch Garnaat http://garnaat.org/
#
# 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, m... | sorenh/cc | vendor/boto/boto/sns/__init__.py | Python | apache-2.0 | 13,553 | 0.003394 |
'''
Created on Jul 28, 2013
@author: Rob
'''
import os, yaml
config = {
'names': [
'NT',
'VGTestServer'
],
'servers':{
'irc.server.tld': {
'port':6667,
'password':None,
'channels':{
'#vgstati... | mph55/lanstation13 | tools/bot/vgstation/common/config.py | Python | gpl-3.0 | 1,605 | 0.011838 |
# -*- coding: utf-8 -*-
#from __future__ import print_function, division, absolute_import, unicode_literals
#from gmusicapi.clients.webclient import Webclient
#from gmusicapi.clients.musicmanager import Musicmanager
from gmusicapi.clients.mobileclient import Mobileclient
#(Webclient, Musicmanager, Mobileclient) # no... | vially/googlemusic-xbmc | resources/Lib/gmusicapi/clients/__init__.py | Python | gpl-3.0 | 323 | 0.01548 |
l = []
for x in range(int(input())):
l.append(int(input()))
l.sort()
print(' '.join(str(x) for x in l[::-1]))
| NendoTaka/CodeForReference | Codingame/Python/Clash/SortHighLowReverse.py | Python | mit | 112 | 0.017857 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'RemoveInstanceDatabase'
db.create_table(u'maintenance_rem... | globocom/database-as-a-service | dbaas/maintenance/migrations/0051_auto__add_removeinstancedatabase.py | Python | bsd-3-clause | 78,775 | 0.007553 |
from mrq.task import Task
from mrq.context import connections
class MongoTimeout(Task):
def run(self, params):
res = connections.mongodb_jobs.eval("""
function() {
var a;
for (i=0;i<10000000;i++) {
for (y=0;y<10000000;y++) {
a = Math.max(y);
}
... | IAlwaysBeCoding/mrq | tests/tasks/mongodb.py | Python | mit | 381 | 0 |
# -*- coding: utf-8 -*-
# Copyright 2017-2019 Barroux Abbey (www.barroux.org)
# Copyright 2017-2019 Akretion France (www.akretion.com)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields
class BaseConfigSettings(mo... | OCA/vertical-abbey | mass/base_config_settings.py | Python | agpl-3.0 | 793 | 0 |
# coding=utf-8
import socket
import thread
import time
import Queue
import re
import random
class IrcClient:
def __init__(self, host, port, nick, realname, printAll=True, isMibbitBot=False):
self.nick = nick
self.realname = realname
self.host = host
self.port = port
self.sock = socket.socket()
self.RecvQ... | mkalte666/Dragonflame | IrcClient.py | Python | mit | 3,540 | 0.05113 |
#!/usr/bin/env python
import setuptools
if __name__ == "__main__":
setuptools.setup(
name="aecg100",
version="1.1.0.18",
author="WHALETEQ Co., LTD",
description="WHALETEQ Co., LTD AECG100 Linux SDK",
url="https://www.whaleteq.com/en/Support/Download/7/Linux%20SDK",
include_package_data=Tru... | benian/aecg100 | setup.py | Python | mit | 418 | 0.023923 |
# Copyright (c) 2012 - 2015 Lars Hupfeldt Nielsen, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.
from jenkinsflow.flow import serial
from .framework import api_select
prefixed_jobs = """
serial flow: [
job: 'top_quick1'
serial flow: [
job: 'top_x_quick2-1'
]
... | lhupfeldt/jenkinsflow | test/prefix_test.py | Python | bsd-3-clause | 1,934 | 0.003619 |
#!/usr/bin/python
import apt_pkg
import logging
import os
import mock
import sys
import tempfile
import unittest
sys.path.insert(0, "..")
from unattended_upgrade import _setup_logging
class MockOptions:
dry_run = False
debug = False
class TestLogdir(unittest.TestCase):
def setUp(self):
self.tem... | Jimdo/unattended-upgrades | test/test_logdir.py | Python | gpl-2.0 | 1,396 | 0.002149 |
def countingsort(sortablelist):
maxval = max(sortablelist)
m = maxval + 1
count = [0] * m # init with zeros
for a in sortablelist:
count[a] += 1 # count occurences
i = 0
for a in range(m): # emit
for c in range(count[a]): # - emit 'count[a]' c... | NendoTaka/CodeForReference | Python/Sort/CountingSort.py | Python | mit | 511 | 0.007828 |
# $Id$
#
from rdkit import Chem
from rdkit.Chem import rdReducedGraphs as rdRG
from rdkit import RDConfig
import numpy
import unittest
class TestCase(unittest.TestCase) :
def setUp(self):
pass
def test1(self):
m = Chem.MolFromSmiles('OCCc1ccccc1')
mrg = rdRG.GenerateMolExtendedReducedGraph(m)
mrg.... | soerendip42/rdkit | Code/GraphMol/ReducedGraphs/Wrap/testReducedGraphs.py | Python | bsd-3-clause | 1,470 | 0.014286 |
# -*- encoding: utf-8 -*-
{
'name': 'Export Inventory Costs',
'version': '3.0.0.0',
'category': "Warehouse Management",
'description': """
Export Inventory Costs
""",
'author': 'Didotech SRL',
'website': 'http://www.didotech.com',
'license': 'AGPL-3',
"depends": [
'b... | iw3hxn/LibrERP | stock_inventory_export/__openerp__.py | Python | agpl-3.0 | 541 | 0 |
## numpy-oldnumeric calls replaced by custom script; 09/06/2016
## Automatically adapted for numpy-oldnumeric Mar 26, 2007 by alter_code1.py
##
## Biskit, a toolkit for the manipulation of macromolecular structures
## Copyright (C) 2004-2018 Raik Gruenberg & Johan Leckner
##
## This program is free software; you can r... | graik/biskit | archive_biskit2/Biskit/AmberEntropyMaster.py | Python | gpl-3.0 | 25,638 | 0.017396 |
#! /usr/bin/env python
#coding=utf-8
## @Configuration of Preprocessing for SEIMS
#
# TODO, give more detailed description here.
import os,platform
## Directionaries
if platform.system() == "Windows":
DATA_BASE_DIR = r'E:\github-zlj\model_data\model_dianbu_30m_longterm\data_prepare'
PREPROC_SCRIPT_DIR = r'E... | SmileEric/SEIMS | preprocess/config.py | Python | gpl-2.0 | 6,003 | 0.01266 |
# -*- coding: utf-8 -*-
# outgoing/service.py
# Copyright (C) 2013-2017 LEAP
#
# 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 ve... | leapcode/bitmask-dev | src/leap/bitmask/mail/outgoing/service.py | Python | gpl-3.0 | 17,108 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.