repo_name stringlengths 5 92 | path stringlengths 4 221 | copies stringclasses 19
values | size stringlengths 4 6 | content stringlengths 766 896k | license stringclasses 15
values | hash int64 -9,223,277,421,539,062,000 9,223,102,107B | line_mean float64 6.51 99.9 | line_max int64 32 997 | alpha_frac float64 0.25 0.96 | autogenerated bool 1
class | ratio float64 1.5 13.6 | config_test bool 2
classes | has_no_keywords bool 2
classes | few_assignments bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mvendra/mvtools | security/hash_check.py | 1 | 1222 | #!/usr/bin/env python3
import sys
import os
import sha256_wrapper
def puaq():
print("Usage: %s archive-to-check [hash-file]" % os.path.basename(__file__))
sys.exit(1)
def sha256sum_check(archive_file, hash_file):
hash_file_contents = ""
with open(hash_file, "r") as f:
hash_file_contents = f... | mit | 7,459,735,787,600,688,000 | 21.62963 | 80 | 0.576923 | false | 3.174026 | false | false | false |
Kokemomo/Kokemomo | kokemomo/plugins/engine/model/km_storage/impl/km_rdb_adapter.py | 1 | 4103 | from sqlalchemy import Column, Integer, String, DateTime, Boolean, Text, func
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker
from kokemomo.plugins.engine.model.km_s... | mit | 8,601,652,151,066,538,000 | 25.642857 | 82 | 0.60078 | false | 3.991245 | false | false | false |
prashanthpai/swift | swift/common/ring/builder.py | 1 | 73566 | # Copyright (c) 2010-2012 OpenStack Foundation
#
# 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 agree... | apache-2.0 | -738,666,777,734,163,300 | 41.572917 | 79 | 0.551532 | false | 4.356111 | false | false | false |
oz123/radiopy | rpy.py | 1 | 1118 | from subprocess import Popen
import pty
import os
import sys
import pynotify
def parse_ICY(line):
aline = line.split('\r\n')[-1]
junk, info = aline.split('=', 1)
try:
info, junk = info.split(';', 1)
except ValueError:
pass
artist, title = info.split('-')
return artist.strip("'"... | gpl-3.0 | 1,780,432,038,875,164,700 | 23.844444 | 76 | 0.592129 | false | 3.122905 | false | false | false |
HartBlanc/Mastercard_Exchange_Rates | rate__retriever.py | 1 | 7513 | # 151 currencies, 22650 currency pairs, 364 days (period 1) 134 days (period 2) => 3,035,100(20,100/from_c) - 8,221,950 entries(8361.157)
print('importing packages')
import time
import sqlite3
import json
import requests
import datetime
import math
import pytz
from datetime import date
from multiprocessing.pool impor... | mit | 8,326,743,759,790,757,000 | 35.64878 | 156 | 0.508585 | false | 3.86074 | false | false | false |
linebp/pandas | pandas/tests/reshape/test_reshape.py | 1 | 43476 | # -*- coding: utf-8 -*-
# pylint: disable-msg=W0612,E1101
import pytest
from pandas import DataFrame, Series
import pandas as pd
from numpy import nan
import numpy as np
from pandas.util.testing import assert_frame_equal
from pandas.core.reshape.reshape import (
melt, lreshape, get_dummies, wide_to_long)
impor... | bsd-3-clause | -60,484,100,107,960,040 | 42.959555 | 79 | 0.426281 | false | 3.403209 | true | false | false |
xclxxl414/rqalpha | rqalpha/mod/rqalpha_mod_alphaStar_utils/mod.py | 1 | 2371 | #coding=utf-8
"""
@author: evilXu
@file: mod.py
@time: 2018/2/28 16:59
@description:
"""
from rqalpha.interface import AbstractMod
from rqalpha.utils.logger import system_log,user_system_log
import pandas as pd
from rqalpha.api import *
class UtilsMod(AbstractMod):
def __init__(self):
self._inject_api()... | apache-2.0 | -1,318,417,233,380,429,800 | 39.896552 | 107 | 0.566428 | false | 3.745656 | false | false | false |
data-tsunami/museo-cachi | cachi/admin.py | 1 | 1605 | # -*- coding: utf-8 -*-
#======================================================================
# This file is part of "Museo-Cachi".
#
# Museo-Cachi 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,... | gpl-3.0 | 8,912,619,328,321,128,000 | 40.153846 | 73 | 0.71028 | false | 3.459052 | false | false | false |
sciapp/pyMolDyn | src/config/configuration.py | 1 | 6186 | import configobj
import validate
import os
import os.path
import inspect
CONFIG_DIRECTORY = '~/.pymoldyn/' # MUST be written with ~ to save a path in the config file that is relative to the user's home directory
CONFIG_FILE = os.path.expanduser('%s/config.cfg' % CONFIG_DIRECTORY)
CONFIG_SPEC_FILE = os.path.expanduse... | mit | 8,964,271,255,305,038,000 | 30.561224 | 140 | 0.57032 | false | 3.973025 | true | false | false |
rosix-ru/django-directapps-client | setup.py | 1 | 2120 | # -*- coding: utf-8 -*-
#
# Copyright 2016 Grigoriy Kramarenko <root@rosix.ru>
#
# This file is part of DjangoDirectAppsClient.
#
# DjangoDirectAppsClient is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public License
# as published by the Free Software F... | agpl-3.0 | 4,842,296,416,597,150,000 | 38.259259 | 93 | 0.675943 | false | 3.992467 | false | false | false |
jared0x90/ArenaGame | parse-cards.py | 1 | 1309 | #!/usr/bin/env python
# Use the built in json and sqlite library
import json
import sqlite3
def main():
# Running card counter
card_count = 0
# Load all json data into a collection
card_data = json.load(open('cards.collectible.json'))
# Connect to our database and creat table if it doesn't e... | mit | -7,381,918,792,961,908,000 | 30.926829 | 126 | 0.565317 | false | 3.85 | false | false | false |
jpludens/quartrmastr | db/tables/equip_traits.py | 1 | 5244 | import sqlite3
from db import get_connection, get_from_datamaster, get_equip_keys
from db.tables import equips, traits
requirements = [equips, traits]
def build():
with get_connection() as con:
con.row_factory = sqlite3.Row
cur = con.cursor()
equip_ids_by_name = get_equip_keys(cur)
... | mit | 2,389,829,314,110,966,300 | 40.291339 | 88 | 0.466438 | false | 4.301887 | false | false | false |
aarontuor/antk | antk/scripts/dssmgrid.py | 1 | 2443 | from __future__ import print_function
import argparse
from antk.core import loader
import numpy
def return_parser():
parser = argparse.ArgumentParser(description="Command line utility for performing grid search on a matrix factorization model.")
parser.add_argument("datadir", type=str,
... | mit | -7,314,639,539,161,021,000 | 41.859649 | 132 | 0.57675 | false | 3.619259 | false | false | false |
kidscancode/gamedev | tutorials/examples/pathfinding/part2_test.py | 1 | 4760 | import pygame as pg
from collections import deque
from os import path
vec = pg.math.Vector2
TILESIZE = 48
GRIDWIDTH = 28
GRIDHEIGHT = 15
WIDTH = TILESIZE * GRIDWIDTH
HEIGHT = TILESIZE * GRIDHEIGHT
FPS = 30
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
CYAN = (0, 255, 255)
MAGENTA = (2... | mit | -7,233,398,497,294,835,000 | 35.615385 | 744 | 0.532563 | false | 2.723112 | false | false | false |
nimbis/django-guardian | guardian/view_mixins.py | 1 | 5462 | from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.auth.decorators import REDIRECT_FIELD_NAME
from django.http import HttpResponseForbidden
from django.http import HttpResponseRedirect
from django.utils.http import urlquote
from django.utils.decorators i... | bsd-2-clause | 9,121,473,484,465,784,000 | 45.086207 | 211 | 0.643903 | false | 4.67637 | false | false | false |
martinogden/django-banner-rotator | banner_rotator/admin.py | 1 | 3825 | #-*- coding:utf-8 -*-
from __future__ import unicode_literals
import logging
from functools import update_wrapper
from django import forms, template
from django.contrib import admin
from django.contrib.admin.util import unquote
from django.db import models
from django.shortcuts import get_object_or_404, render_to_resp... | mit | 6,486,784,982,969,740,000 | 35.778846 | 117 | 0.608889 | false | 3.601695 | false | false | false |
DailyActie/Surrogate-Model | 01-codes/deap-master/examples/coev/coop_evol.py | 1 | 6195 | # This file is part of DEAP.
#
# DEAP 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.
#
# DEAP is distributed ... | mit | 5,767,746,708,003,492,000 | 33.226519 | 105 | 0.585149 | false | 3.62069 | false | false | false |
ragupta-git/ImcSdk | imcsdk/mometa/bios/BiosVfLegacyUSBSupport.py | 1 | 3878 | """This module contains the general information for BiosVfLegacyUSBSupport ManagedObject."""
from ...imcmo import ManagedObject
from ...imccoremeta import MoPropertyMeta, MoMeta
from ...imcmeta import VersionMeta
class BiosVfLegacyUSBSupportConsts:
VP_LEGACY_USBSUPPORT_AUTO = "Auto"
VP_LEGACY_USBSUPPORT_DISA... | apache-2.0 | -8,197,067,225,577,513,000 | 49.363636 | 274 | 0.625064 | false | 3.465594 | false | false | false |
spino327/sdr_testbed | DistributedTestbed/receiver/RXGui.py | 1 | 8188 | '''
Copyright (c) 2010, Universidad Industrial de Santander, Colombia
University of Delaware
All rights reserved.
@author: Sergio Pino
@author: Henry Arguello
Website: http://www.eecis.udel.edu/
emails : sergiop@udel.edu - henarfu@udel.edu
Date : Nov, 2010
'''
from gnuradio.wxgui import fftsink2, scopesink2
from g... | apache-2.0 | -2,311,429,111,140,030,000 | 32.153846 | 102 | 0.51319 | false | 3.487223 | false | false | false |
nfqsolutions/nfq-conductor | nfq/conductor/server.py | 1 | 5092 | # NFQ Conductor. A tool for centralizing and visualizing logs.
# Copyright (C) 2017 Guillem Borrell Nogueras
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# Li... | agpl-3.0 | 8,734,836,519,722,331,000 | 33.639456 | 86 | 0.616064 | false | 3.898928 | false | false | false |
akhilaananthram/nupic.research | classification/LanguageSensor.py | 1 | 9726 | #!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions... | gpl-3.0 | 5,535,361,808,632,589,000 | 33.489362 | 91 | 0.599321 | false | 4.443125 | false | false | false |
google-research/fixmatch | ict.py | 1 | 5150 | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 | 1,690,494,292,168,825,600 | 40.869919 | 113 | 0.639223 | false | 3.245117 | false | false | false |
siemens/django-dingos | dingos/migrations/0007_auto__add_userdata__add_unique_userdata_user_data_kind.py | 1 | 16414 | # -*- 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 model 'UserData'
db.create_table(u'dingos_userdata', (
(u'id', self.gf('django.db.model... | gpl-2.0 | -1,355,547,385,660,828,000 | 75.705607 | 187 | 0.557268 | false | 3.585408 | false | false | false |
openstack/oslo.context | doc/source/user/examples/usage.py | 1 | 1601 | #!/usr/bin/env python3
#
# Copyright (c) 2015 OpenStack Foundation
#
# 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 appl... | apache-2.0 | -5,818,148,704,935,449,000 | 30.392157 | 75 | 0.713929 | false | 3.914425 | false | false | false |
wojciechpolak/webxiangpianbu | tools/staticgen.py | 1 | 12710 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# WebXiangpianbu Copyright (C) 2014, 2015 Wojciech Polak
#
# 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... | gpl-3.0 | 6,789,874,336,057,884,000 | 31.589744 | 84 | 0.525649 | false | 3.712033 | false | false | false |
bmng-dev/PyBitmessage | src/inventory.py | 1 | 10082 | import collections
import Queue
import time
from threading import enumerate as threadingEnumerate
from threading import RLock, current_thread
from helper_sql import SqlBulkExecute, sqlExecute, sqlQuery
from singleton import Singleton
@Singleton
class Inventory(collections.MutableMapping):
def __init__(self):
... | mit | 2,504,208,822,498,780,700 | 39.48996 | 361 | 0.583515 | false | 4.443367 | false | false | false |
kaiyou/pyircbot | src/pyircbot/behavior.py | 1 | 6125 | #!/usr/bin/python
#
# PyIRCBot
# Copyright (C) Pierre Jaury 2011 <pierre@jaury.eu>
#
# PyIRCBot 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... | gpl-3.0 | 1,358,964,609,801,808,000 | 33.217877 | 88 | 0.691429 | false | 3.312601 | false | false | false |
tomchadwin/qgis2web | qgis2web/maindialog.py | 1 | 39316 | # -*- coding: utf-8 -*-
# qgis-ol3 Creates OpenLayers map from QGIS layers
# Copyright (C) 2014 Victor Olaya (volayaf@gmail.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... | gpl-2.0 | -2,166,607,151,134,969,000 | 38.83384 | 79 | 0.555321 | false | 4.630314 | false | false | false |
inean/python-oauth2 | oauth2/__init__.py | 1 | 24530 | """
The MIT License
Copyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel
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 ... | mit | 6,820,572,739,031,814,000 | 32.37415 | 265 | 0.600163 | false | 4.217675 | false | false | false |
pombredanne/cliques | poll/views.py | 1 | 5047 | from collections import defaultdict
import datetime
import logging
import operator
import random
from django.contrib.auth import get_user_model
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound
from django.utils.timezone import utc
from django.views.generic import CreateView, DetailView
... | apache-2.0 | 8,324,600,533,763,739,000 | 33.806897 | 80 | 0.624728 | false | 4.0376 | false | false | false |
sebastian-software/jasy | jasy/core/Util.py | 1 | 4039 | #
# Jasy - Web Tooling Framework
# Copyright 2010-2012 Zynga Inc.
# Copyright 2013-2014 Sebastian Werner
#
import re
import os
import hashlib
import tempfile
import subprocess
import sys
import shlex
import jasy.core.Console as Console
import jasy.core.Base62 as Base62
def executeCommand(args, failMessage=None, pat... | mit | 8,754,968,981,034,551,000 | 24.402516 | 114 | 0.657836 | false | 3.719153 | false | false | false |
pozytywnie/webapp-health-monitor | webapp_health_monitor/management/commands/verify.py | 1 | 1307 | import importlib
import sys
from django.apps import apps
from django.core.management.base import BaseCommand
from webapp_health_monitor.verification_suit import VerificationSuit
class Command(BaseCommand):
SUBMODULE_NAME = 'verificators'
def add_arguments(self, parser):
parser.add_argument('--tag', ... | mit | -4,889,517,402,081,881,000 | 35.305556 | 88 | 0.625096 | false | 4.04644 | false | false | false |
MoRgUiJu/morguiju.repo | plugin.video.pelisalacarta/channels/pelisadicto.py | 1 | 10054 | # -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Canal para cuevana
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import re
import sys
import urlparse
from core import config
f... | gpl-2.0 | 6,785,634,815,207,113,000 | 57.22093 | 579 | 0.67156 | false | 2.960095 | false | false | false |
Inspq/ansible | lib/ansible/plugins/action/fetch.py | 1 | 8462 | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | gpl-3.0 | -1,681,434,668,187,707,000 | 44.010638 | 152 | 0.589931 | false | 4.357364 | false | false | false |
polyaxon/polyaxon | sdks/python/http_client/v1/polyaxon_sdk/models/v1_compiled_operation.py | 1 | 21129 | #!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | apache-2.0 | 1,406,717,811,419,982,800 | 25.847522 | 439 | 0.582328 | false | 4.141317 | false | false | false |
lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/troubleshooting_details.py | 1 | 1830 | # 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 ... | mit | 1,079,771,110,420,915,600 | 39.666667 | 108 | 0.610929 | false | 4.084821 | false | false | false |
Mathew/psychoanalysis | psychoanalysis/apps/pa/aggregation.py | 1 | 6791 | from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from itertools import chain
def make_query(query_dict):
query_type = 0
if 'result type' in query_dict:
if query_dict['result type'] == 'percent':
query_type = 1
data_set = 0
if 'data set' in ... | mit | -728,023,969,507,841,200 | 38.254335 | 206 | 0.566485 | false | 2.643441 | false | false | false |
gregpuzzles1/Sandbox | Example Programs/Ch_07_Student_Files/pilimages.py | 1 | 4982 | """
images.py
This module, writtn by Kenneth Lambert, supports simple image processing.
The Image class represents either an image loaded from a GIF file or a
blank image.
To instantiate an image from a file, enter
image = Image(aGifFileName)
To instantiate a blank image, enter
image = Ima... | gpl-3.0 | -1,244,779,245,137,367,800 | 27.965116 | 76 | 0.540145 | false | 3.925926 | false | false | false |
ernstblecha/gen.sh | waitforstring.py | 1 | 1698 | #!/usr/bin/python3 -u
# using -u here to make stdin unbuffered
# This file is part of gen.sh.
#
# gen.sh 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) ... | gpl-3.0 | -159,925,529,795,135,940 | 29.321429 | 77 | 0.691402 | false | 3.34252 | false | false | false |
Charley-fan/metaArray | metaFunc.py | 1 | 10584 | # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in ... | gpl-3.0 | -2,785,566,513,698,070,000 | 31.268293 | 115 | 0.606293 | false | 3.879765 | false | false | false |
alenickwork/python_training | fixture/orm.py | 1 | 4159 | from pony.orm import *
from datetime import datetime
from model.group import Group
from model.contact import Contact
from pymysql.converters import decoders
from pymysql.converters import encoders, decoders, convert_mysql_timestamp
conv = encoders
conv.update(decoders)
conv[datetime] = convert_mysql_timestamp
clas... | apache-2.0 | -884,994,360,897,504,300 | 39.378641 | 135 | 0.591248 | false | 3.94592 | false | false | false |
linted/Skip-Trace | common/STcommon.py | 1 | 1245 | try:
import logging
from Crypto.PublicKey import RSA
except ImportError as e:
print("[-] {}, exiting".format(e))
exit(1)
def configDebugLog(logFileName):
log_file = logging.FileHandler(logFileName,mode='w')
log_file.setLevel(logging.DEBUG)
log_file.setFormatter(logging.Formatter('%(asctime)s - %(levelname)s - %... | mit | -4,271,112,123,629,025,000 | 28.666667 | 86 | 0.724498 | false | 3.259162 | false | false | false |
MaxTyutyunnikov/lino | lino/projects/min2/settings.py | 1 | 2156 | # -*- coding: UTF-8 -*-
## Copyright 2012-2013 Luc Saffre
## This file is part of the Lino project.
## Lino 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 y... | gpl-3.0 | 804,034,290,664,175,200 | 32.774194 | 71 | 0.641466 | false | 3.546053 | false | false | false |
vlegoff/tsunami | src/primaires/scripting/actions/equiper.py | 1 | 5397 | # -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# ... | bsd-3-clause | 5,963,677,848,703,850,000 | 40.757813 | 79 | 0.674275 | false | 3.466278 | false | false | false |
fiduswriter/fiduswriter | fiduswriter/base/tests/test_prelogin.py | 1 | 2855 | from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from testing.testcases import LiveTornadoTestCase
from testing.selenium_helper import SeleniumHelper
class PreloginTest(LiveTornadoTestCase, SeleniumHe... | agpl-3.0 | -6,557,665,526,337,172,000 | 29.361702 | 67 | 0.539944 | false | 3.97493 | true | false | false |
TobleMiner/fahrschulcard | solver.py | 1 | 2470 | import sqlite3
from question import Question, Answer
conn = sqlite3.connect('license.db')
c = conn.cursor()
c.execute('CREATE TABLE IF NOT EXISTS "answers" (\
`id` INTEGER PRIMARY KEY AUTOINCREMENT,\
`answer` TEXT,\
`question` INTEGER)')
c.execute('CREATE TABLE IF NOT EXISTS "questions" (\
`id` INTEGER PRIMARY K... | mit | 8,390,763,817,388,021,000 | 34.285714 | 81 | 0.604453 | false | 3.841369 | false | false | false |
r-martin-/Code_College | PythonProgramming/poker_hands_v2.py | 1 | 1983 | """Count poker hands
Sample program to count poker hands and thus estimate the probability of a given hand occurring .
The file contains 1 million records randomly distributed and is, therefore, statistically valid.
The data looks like this:
1,1,1,13,2,4,2,3,1,12,0
3,12,3,2,3,11,4,5,2,5,1
1,9,4,6,1,4,3,2,3,9,1
1,4,3... | mit | -5,603,430,153,374,674,000 | 30.47619 | 115 | 0.672718 | false | 3.004545 | false | false | false |
tvuillemin/nicetypes | setup.py | 1 | 2325 | import codecs
import os
import re
from setuptools import setup, find_packages
###################################################################
NAME = "nicetypes"
PACKAGES = find_packages(where="src")
META_PATH = os.path.join("src", "nicetypes", "__init__.py")
KEYWORDS = ["class", "attribute", "boilerplate"]
CLAS... | mit | -7,027,364,177,655,694,000 | 28.43038 | 77 | 0.569892 | false | 3.927365 | false | false | false |
martynovp/edx-platform | lms/djangoapps/instructor_task/tasks_helper.py | 1 | 62345 | """
This file contains tasks that are designed to perform background operations on the
running state of a course.
"""
import json
from collections import OrderedDict
from datetime import datetime
from django.conf import settings
from eventtracking import tracker
from itertools import chain
from time import time
import... | agpl-3.0 | -3,188,295,569,391,423,000 | 43.820273 | 142 | 0.663117 | false | 4.053641 | false | false | false |
aubzen/sheltermanager | src/waitinglist.py | 1 | 14773 | #!/usr/bin/python
import additional
import al
import animal
import audit
import configuration
import db
import diary
import log
import media
import utils
from i18n import _, after, now, python2display, subtract_years, add_days, date_diff
def get_waitinglist_query():
"""
Returns the SELECT and JOIN commands ne... | gpl-3.0 | -4,002,365,165,038,267,000 | 42.967262 | 145 | 0.6057 | false | 3.401566 | true | false | false |
pwwang/bioprocs | bioprocs/utils/meme.py | 1 | 5335 | """
Read or write MEME motif file
"""
import re
import math
from collections import OrderedDict
class MemeRecord(object):
def __init__(self,
name,
matrix,
altname = '',
mtype = 'letter-probability',
alength = None,
w = None,
nsites = 20,
E = 0,
URL = None
):
self.name = nam... | mit | -8,825,826,625,067,057,000 | 23.813953 | 124 | 0.597938 | false | 2.754259 | false | false | false |
fin/froide | froide/publicbody/csv_import.py | 1 | 3665 | # -*- encoding: utf-8 -*-
import requests
from django.contrib.auth import get_user_model
from django.contrib.sites.models import Site
from django.template.defaultfilters import slugify
from django.utils.six import StringIO, BytesIO, PY3
from taggit.utils import parse_tags
if PY3:
import csv
else:
import unic... | mit | 4,057,306,953,763,655,700 | 32.623853 | 88 | 0.583356 | false | 3.621542 | false | false | false |
OpenTransportDataProject/ckanext-customharvesters | ckanext/dcat/harvesters/createorg.py | 1 | 2400 | # Description: create harvested organizations from orgfile.txt
# Author: Shanshan Jiang, last modified 14.12.2016
import json
import urllib
import urllib2
import pprint
print "create organizations"
org_dict = {
'name': 'testagain',
'title': 'test again',
'image_url': ''
}
def create_org(dataset_dict)... | agpl-3.0 | -3,692,371,861,684,130,000 | 26.586207 | 80 | 0.646667 | false | 3.550296 | false | false | false |
tusharmakkar08/AlphaPy | Syntax/syntaxhighlighter.py | 1 | 2865 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# syntaxhighlighter.py
#
# Copyright 2013 tusharmakkar08 <tusharmakkar08@gmail.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; eit... | mit | 668,118,477,405,931,000 | 20.222222 | 72 | 0.669459 | false | 2.757459 | false | false | false |
mjtamlyn/django-denorm | test_project/test_app/tests.py | 1 | 17380 | from djangosanetesting import cases
from django.contrib.auth.models import User,Permission
from django.contrib.contenttypes.models import ContentType
import denorm
from denorm import denorms
import models
class TestSkip(cases.DestructiveDatabaseTestCase):
"""
Tests for the skip feature.
"""
def ... | bsd-3-clause | -3,809,027,810,471,516,000 | 37.030635 | 111 | 0.637112 | false | 3.248598 | true | false | false |
fgirault/smeuhsocial | apps/threadedcomments/tests/test_views.py | 1 | 26436 | from django.core.urlresolvers import reverse
from django.test import TestCase
from json import loads
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from threadedcomments.models import FreeThreadedComment, ThreadedComment
from threadedcomments.models import TestM... | mit | 5,914,407,054,020,151,000 | 30.174528 | 76 | 0.511235 | false | 3.786308 | true | false | false |
delfick/harpoon | harpoon/helpers.py | 1 | 2085 | from contextlib import contextmanager
from io import StringIO
import tempfile
import logging
import time
import os
log = logging.getLogger("harpoon.helpers")
@contextmanager
def a_temp_file():
"""Yield the name of a temporary file and ensure it's removed after use"""
filename = None
try:
tmpfile ... | mit | -888,619,971,368,138,900 | 26.077922 | 78 | 0.606235 | false | 4.025097 | false | false | false |
simbha/GAE-appswell | appspot/framework/lib/error_handling.py | 1 | 1373 | """
Appswell Error Handling Lib
functions for handling errors
USAGE
from lib import error_handling
error_details = error_handling.get_error_details()
error_page = error_handling.render_error_page(error_details)
"""
#
# IMPORTS
#
import sys, os, logging, inspect
from os.path import (abspath, di... | mit | 4,580,432,256,818,936,000 | 29.511111 | 76 | 0.654042 | false | 3.911681 | false | false | false |
edgedb/edgedb | edb/schema/schema.py | 1 | 63607 | #
# This source file is part of the EdgeDB open source project.
#
# Copyright 2008-present MagicStack Inc. and the EdgeDB 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... | apache-2.0 | -8,112,427,022,049,611,000 | 30.118885 | 79 | 0.517647 | false | 3.844485 | false | false | false |
yytang2012/novels-crawler | simpleSpiders/m-ifuwen.py | 1 | 1913 | import os
import requests
from parsel import Selector
from urllib.parse import urljoin
from libs.polish import polish_content, polish_title, polish_subtitle
def parse_content(url):
page = requests.get(url)
html = page.text
sel = Selector(text=html)
title = sel.xpath('//title/text()').extract()[0]
... | mit | -1,006,423,881,069,310,800 | 29.365079 | 95 | 0.598014 | false | 3.136066 | false | false | false |
hortonworks/hortonworks-sandbox | apps/oozie/src/oozie/management/commands/oozie_setup.py | 1 | 3188 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (... | apache-2.0 | -7,638,046,287,902,017,000 | 38.8375 | 119 | 0.709131 | false | 3.452871 | false | false | false |
ddworken/cubeOfResistors | 2D.py | 1 | 2155 | DIFF_THRESHOLD = 1e-40
width = height = 10
class Fixed:
FREE = 0
A = 1
B = 2
class Node:
__slots__ = ["voltage", "fixed"]
def __init__(self, v=0.0, f=Fixed.FREE):
self.voltage = v
self.fixed = f
def set_boundary(mesh):
mesh[width / 2][height / 2] = Node(1.0, Fixed.A)
m... | gpl-2.0 | 5,152,036,103,168,269,000 | 26.278481 | 99 | 0.508121 | false | 3.585691 | false | false | false |
mjvakili/ccppabc | ccppabc/code/archive/wp_covariance.py | 1 | 1717 | from halotools.empirical_models import Zheng07 , model_defaults
from halotools.mock_observables import wp
from halotools.mock_observables.clustering import tpcf
from halotools.empirical_models.mock_helpers import (three_dim_pos_bundle,
infer_mask_from_kwargs)
from ha... | mit | 7,285,614,063,505,886,000 | 32.019231 | 90 | 0.664531 | false | 2.861667 | false | false | false |
vprime/puuuu | env/bin/pilfile.py | 1 | 2645 | #!/Users/Vincent/lm_svn/checkouts/personal/papertrail-django/env/bin/python
#
# The Python Imaging Library.
# $Id$
#
# a utility to identify image files
#
# this script identifies image files, extracting size and
# pixel mode information for known file formats. Note that
# you don't need the PIL C extension to use thi... | mit | 2,741,384,306,119,726,000 | 26.842105 | 77 | 0.564461 | false | 3.494055 | false | false | false |
swegener/gruvi | src/build_http.py | 1 | 3155 | #
# This file is part of Gruvi. Gruvi is free software available under the
# terms of the MIT license. See the file "LICENSE" that was provided
# together with this source file for the licensing terms.
#
# Copyright (c) 2012-2017 the Gruvi authors. See the file "AUTHORS" for a
# complete list.
from __future__ import a... | mit | 1,236,139,961,076,085,500 | 30.868687 | 78 | 0.626941 | false | 3.467033 | false | false | false |
aroberge/docpicture | examples/fake_turtle.py | 1 | 7015 | """
This is a fake turtle module (with no relevant executable code, other than
a local docpicture parser included for testing) obtained through
severely amputating the original turtle module, for the purpose of
demonstrating the docpicture concept.
We start by including a drawing made with a docpicture "parser"
that i... | bsd-3-clause | 6,207,094,637,867,796,000 | 28.351464 | 95 | 0.594726 | false | 3.814573 | false | false | false |
hmarkus/dynclasp | DflatDecomposition.py | 1 | 2536 | #!/bin/python
class DflatIdentifiable(object):
def __init__(self, keys):
self._keys = keys
def add(self, val):
self._keys.append(val)
def __repr__(self):
return self.__str__()
def __str__(self):
return str(self._keys)
def id(self):
return DflatIdentifiable.idstr(self._keys)
def keys(self):
retu... | gpl-3.0 | 3,731,327,717,661,745,700 | 18.658915 | 102 | 0.630521 | false | 2.80531 | false | false | false |
QueenMargaretsCompSci/PiWars2016 | source/wii_remote_test.py | 1 | 3219 | #!/usr/bin/python
# import our modules
import cwiid
import time
import RPi.GPIO as GPIO
import piconzero as pz
import sensorlibs as sl
from picamera import PiCamera
# setup our camera
cam = PiCamera()
# setup our constants
button_delay = 0.1
PIN_LED = sl.GPIOtoBoard(4)
GPIO.setup(PIN_LED, GPIO.OUT)
GPIO.output(PIN_L... | gpl-3.0 | 1,293,673,930,725,031,700 | 22.326087 | 70 | 0.636533 | false | 2.977798 | false | false | false |
google/closure-templates | python/runtime.py | 1 | 22615 | # 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 a... | apache-2.0 | -4,886,007,463,098,833,000 | 28.446615 | 87 | 0.691576 | false | 3.894438 | false | false | false |
nodakai/watchman | tests/integration/test_sock_perms.py | 1 | 10512 | # vim:ts=4:sw=4:et:
# Copyright 2016-present Facebook, Inc.
# Licensed under the Apache License, Version 2.0
# no unicode literals
from __future__ import absolute_import, division, print_function
import os
import random
import stat
import string
import sys
import time
import pywatchman
import WatchmanInstance
import... | apache-2.0 | 3,227,173,042,821,205,500 | 35.884211 | 88 | 0.612348 | false | 3.880399 | true | false | false |
dgrtwo/gleam | examples/baseball.py | 1 | 2364 | import os
from collections import OrderedDict
from flask import Flask
from wtforms import fields
from ggplot import (aes, stat_smooth, geom_point, geom_text, ggtitle, ggplot,
xlab, ylab)
import numpy as np
import pandas as pd
from gleam import Page, panels
# setup
stats = ['At-Bats (AB)', 'Runs... | mit | 4,333,654,083,607,356,400 | 28.924051 | 77 | 0.60533 | false | 3.2879 | false | false | false |
gangadhar-kadam/mic-erpnext | stock/report/delivery_note_trends/delivery_note_trends.py | 1 | 1058 | # ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# 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 yo... | agpl-3.0 | -2,810,063,489,910,439,000 | 36.821429 | 71 | 0.751418 | false | 3.833333 | false | false | false |
sevikkk/django-sql-explorer | explorer/forms.py | 1 | 3003 | from django import forms
from django.forms import ModelForm, Field, ValidationError
from explorer.models import Query, MSG_FAILED_BLACKLIST
from django.db import DatabaseError, connections
from crontab import CronTab
from explorer.utils import get_connections_list
_ = lambda x: x
class SqlField(Field):
def vali... | mit | 8,805,063,488,350,659,000 | 25.584071 | 118 | 0.586414 | false | 4.396779 | false | false | false |
ywang037/delta-ntu-slerp4 | Training/train_mobilenet_casia_1771.py | 1 | 7420 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 4 14:47:47 2017
@author: slerp4
Compared with _debug version, this version excludes RMSprop optimizer
"""
#import tensorflow as tf
from keras import backend as K
from keras.applications.mobilenet import MobileNet
from keras.preprocessing.image im... | mit | -1,016,345,155,239,914,100 | 35.732673 | 120 | 0.684097 | false | 3.331837 | false | false | false |
gslab-econ/gslab_python | gslab_make/get_externals.py | 1 | 4632 | #! /usr/bin/env python
import os
import private.preliminaries as prelim
import private.metadata as metadata
import private.messages as messages
from private.getexternalsdirectives import SystemDirective
def get_externals(externals_file,
external_dir = '@DEFAULTVALUE@',
... | mit | -6,831,750,537,376,042,000 | 45.265306 | 106 | 0.618523 | false | 4.790072 | false | false | false |
anselmobd/fo2 | script/TussorBipaRolo.py | 1 | 1346 | import sys
import android
import os
import json
import urllib.request
print('\n'*10)
print('='*30)
print(' Tussor')
print(' Coletor de códigos de barras')
print('='*30)
droid = android.Android()
print('\nCelular: "{}"'.format(os.environ['QPY_USERNO']))
choice = ' '
while choice == ' ':
print('')
print('='*... | mit | 2,331,994,624,095,525,400 | 25.27451 | 75 | 0.54403 | false | 3.198091 | false | false | false |
facelessuser/TabsExtra | tabs_extra.py | 1 | 32989 | """
TabsExtra.
Copyright (c) 2014 - 2016 Isaac Muse <isaacmuse@gmail.com>
License: MIT
"""
import sublime_plugin
import sublime
import time
import sys
from TabsExtra import tab_menu
import os
import functools
from operator import itemgetter
import sublime_api
from urllib.parse import urljoin
from urllib.request impor... | mit | 4,686,407,101,717,471,000 | 32.593686 | 173 | 0.5363 | false | 4.14643 | false | false | false |
Justaphf/BitcoinUnlimited | qa/rpc-tests/mempool_push.py | 1 | 9835 | #!/usr/bin/env python3
# Copyright (c) 2015-2019 The Bitcoin Unlimited developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import test_framework.loginit
# This is a template to make creating new QA tests easy.
# You can als... | mit | -8,783,700,860,843,381,000 | 51.037037 | 175 | 0.642501 | false | 3.646644 | true | false | false |
tonioo/modoboa | modoboa/core/app_settings.py | 1 | 16059 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import forms
from django.conf import settings
from django.contrib.auth import password_validation
from django.utils.translation import ugettext as _, ugettext_lazy
from modoboa.core.password_hashers import get_dovecot_schemes
from modoboa.co... | isc | -478,008,678,375,216,060 | 34.845982 | 79 | 0.609067 | false | 4.263074 | false | false | false |
manxueitp/cozmo-test | cozmo_sdk_examples/tutorials/02_cozmo_face/03_alarm_clock.py | 1 | 9691 | #!/usr/bin/env python3
# Copyright (c) 2016 Anki, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | mit | -5,040,915,958,097,453,000 | 33.610714 | 136 | 0.640594 | false | 3.400351 | false | false | false |
JioCloud/tempest-lib | tempest_lib/services/identity/v3/token_client.py | 1 | 6711 | # Copyright 2015 NEC Corporation. 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 ... | apache-2.0 | 876,780,352,556,253,000 | 36.49162 | 79 | 0.56996 | false | 4.186525 | false | false | false |
cprogrammer1994/ModernGL | examples/old-examples/GLWindow/particle_system_2.py | 1 | 1794 | import math
import random
import struct
import GLWindow
import ModernGL
# Window & Context
wnd = GLWindow.create_window()
ctx = ModernGL.create_context()
prog = ctx.program(
ctx.vertex_shader('''
#version 330
uniform vec2 Screen;
in vec2 vert;
void main() {
gl_Posit... | mit | 3,263,518,089,570,220,000 | 19.386364 | 82 | 0.574136 | false | 2.738931 | false | false | false |
rliskovenko/DataRobot | app/test.py | 1 | 3085 | import random
import string
import app
import json
import unittest
from datetime import datetime
App = app.app
testSet = {
True : [
'''[{"date": "2015-05-12T14:36:00.451765",
"md5checksum": "e8c83e232b64ce94fdd0e4539ad0d44f",
"name": "John Doe",
"uid": "1"},
... | bsd-2-clause | 1,129,024,472,684,088,200 | 33.662921 | 146 | 0.506969 | false | 3.196891 | true | false | false |
tanzer/ls-emacs | scripts/lse_compile_language.py | 1 | 3736 | # -*- coding: utf-8 -*-
# Copyright (C) 1994-2017 Mag. Christian Tanzer. All rights reserved
# Glasauergasse 32, A--1130 Wien, Austria. tanzer@swing.co.at
#
#++
# Name
# lse_compile_language
#
# Purpose
# Compile emacs language definition
#
# Revision Dates
# 14-Nov-2007 (MG) Creation (ported from bash script)... | gpl-2.0 | -165,061,289,321,706,660 | 36.666667 | 78 | 0.539287 | false | 3.279683 | false | false | false |
Cadair/solarbextrapolation | solarbextrapolation/analyticalmodels/base.py | 1 | 8605 | # -*- coding: utf-8 -*-
"""
Created on Mon Sep 28 19:30:22 2015
@author: alex_
"""
# General Imports
import matplotlib as mpl
mpl.use('TkAgg') # Force mpl backend not to use qt. Else we have a conflict.
import numpy as np
#import pickle
import time
from datetime import datetime
#from collections import namedtuple
imp... | mit | -4,708,356,561,791,386,000 | 39.21028 | 264 | 0.604648 | false | 3.072117 | false | false | false |
RNAcentral/rnacentral-import-pipeline | rnacentral_pipeline/rnacentral/r2dt/parser.py | 1 | 3852 | # -*- coding: utf-8 -*-
"""
Copyright [2009-2018] EMBL-European Bioinformatics Institute
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... | apache-2.0 | 3,470,230,791,381,858,300 | 34.666667 | 82 | 0.60514 | false | 3.668571 | false | false | false |
keras-team/autokeras | examples/automodel_with_cnn.py | 1 | 1358 | # Library import
import numpy as np
import tensorflow as tf
import autokeras as ak
# Prepare example Data - Shape 1D
num_instances = 100
num_features = 5
x_train = np.random.rand(num_instances, num_features).astype(np.float32)
y_train = np.zeros(num_instances).astype(np.float32)
y_train[0 : int(num_instances / 2)] = ... | apache-2.0 | 1,371,042,242,022,571,300 | 27.291667 | 81 | 0.72975 | false | 2.877119 | false | false | false |
jeremy-miller/life-python | life/display.py | 1 | 1176 | """This module displays the Life 'grid'."""
import numpy
class DisplayClass(object): # pylint: disable=R0903
"""This class displays the Life 'grid'.
No OpenGL or Matplotlib UI is used since this program is being executed
in a Docker container. The 'curses' Python package is also not used
since it also has... | mit | 8,947,968,542,597,361,000 | 31.666667 | 96 | 0.654762 | false | 3.959596 | false | false | false |
jeffsilverm/presentation | SeaGL-2018/network_stats_result_2_csv.py | 1 | 3115 | #! /usr/bin/python3
# -*- coding: utf-8 -*-
import csv
import datetime
import sys
def str_to_time_delta(string) -> datetime.timedelta:
"""
:param string: Input in format 0:01:37.083557
:return: datetime.timedelta
"""
flds = string.split(":")
hours = flds[0]
minutes = flds[1]
second... | gpl-2.0 | 7,128,494,810,145,858,000 | 36.53012 | 113 | 0.50626 | false | 3.730539 | false | false | false |
bcgsc/ProbeGenerator | probe_generator/reference.py | 1 | 2779 | """Parse and extract base pair sequences from an Ensembl reference genome.
"""
from probe_generator import sequence
from probe_generator.exceptions import NonFatalError
def bases(sequence_range, genome):
"""Return the bases from a SequenceRange object.
"""
raw_bases = _raw_bases(
sequence_range.c... | gpl-3.0 | 8,711,707,107,422,563,000 | 28.252632 | 79 | 0.618928 | false | 4.32866 | false | false | false |
crackinglandia/pype32 | setup.py | 1 | 4235 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2013, Nahuel Riva
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyrigh... | bsd-3-clause | 1,081,775,200,471,822,000 | 39.721154 | 92 | 0.677922 | false | 4.076035 | false | false | false |
myvoice-nigeria/myvoice | myvoice/clinics/migrations/0013_auto__chg_field_visit_service.py | 1 | 13197 | # -*- 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):
# Changing field 'Visit.service'
db.alter_column(u'clinics_visit', 'serv... | bsd-2-clause | -2,682,326,157,635,498,500 | 74.850575 | 195 | 0.548079 | false | 3.568686 | false | false | false |
m00nlight/hackerrank | algorithm/contests/Counter-Code-2015/C.py | 1 | 1148 | from __future__ import division
from sys import stdin
def solve(n, m):
if n % 2 == 0:
if m % n == 0:
return n // 2 + 1
elif m % n % 2 == 1:
return (m % n + 1) // 2
else:
return n + 1 - m % n // 2
else:
idx = m % (2 * n)
if idx == 0:
... | gpl-2.0 | -6,132,813,347,740,916,000 | 27.02439 | 70 | 0.313589 | false | 3.788779 | false | false | false |
linsalrob/PhageHosts | code/codon_distance.py | 1 | 2853 | '''
Calculate the distance between two codon usages.
We have two files, the first with just the phages and the second
with their hosts. Then we need to calculate which of the hosts is
closest
'''
import os
import sys
sys.path.append('/home3/redwards/bioinformatics/Modules')
import numpy as np
import scipy
remove_am... | mit | -4,651,376,398,173,520,000 | 29.351064 | 72 | 0.539783 | false | 3.091008 | false | false | false |
MTgeophysics/mtpy | tests/analysis/test_pt.py | 1 | 7128 | # -*- coding: utf-8 -*-
"""
TEST mtpy.core.mt.MT
@author: YG
"""
from unittest import TestCase
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 31 13:19:35 2017
@author: u64125
Alison.Kirkby@ga.gov.au
"""
import os
import numpy as np
from mtpy.core.mt import MT
from tests import TEST_MTPY_ROOT
import mtpy.analysis.ge... | gpl-3.0 | 4,011,371,443,513,376,300 | 34.824121 | 108 | 0.542789 | false | 2.19661 | true | false | false |
gnmiller/craig-bot | craig-bot/lib/python3.6/site-packages/discord/ext/commands/context.py | 1 | 10694 | # -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2015-2019 Rapptz
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 u... | mit | -5,694,569,240,403,202,000 | 34.885906 | 117 | 0.628016 | false | 4.465136 | false | false | false |
seanbell/opensurfaces | server/bsdfs/experiments.py | 1 | 9415 | import json
from decimal import Decimal
from collections import Counter
from django.conf import settings
from django.db.models import Q
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import User
from accounts.models import UserProfile
from shapes.models import Shape, Materi... | mit | 1,125,210,961,934,694,400 | 38.229167 | 118 | 0.581413 | false | 3.842857 | true | false | false |
N9dZ/LearnCodeTheHardWay | ex24.py | 1 | 1131 | print "Let's practice everything."
print 'You\'d need to know \'bout escapes with \\ that do \n newlines and \t tabs.'
# there's variable for a real poem
poem = """
\tThe lovely world
with logic so firmly planted
cannot discern \n the needs of love
nor comprehend passion from intuition
and requires an explanation
\n\t\... | gpl-2.0 | 2,550,332,171,832,219,600 | 31.342857 | 83 | 0.697613 | false | 3.132964 | false | false | false |
tanghaibao/goatools | goatools/godag/relationship_str.py | 1 | 3956 | """Create strings representing relationships on GO Terms.
+------- has 'part_of' relationship(s)
| +-- pointed to by a GO ID with a 'part_of' relationship
| |
V V
GO:0008150 L00 D00 .... .rdu biological_process
GO:0050896 L01 D01 ....... | bsd-2-clause | 6,686,008,549,504,692,000 | 42.472527 | 99 | 0.63094 | false | 3.299416 | false | false | false |
jclgoodwin/bustimes.org.uk | vehicles/test_service_map_consumer.py | 1 | 3587 | import vcr
from freezegun import freeze_time
from channels.testing import WebsocketCommunicator
from django.test import TestCase, override_settings
from django.core.cache import cache
from django.utils import timezone
from busstops.models import Region, Service, ServiceCode, StopPoint, DataSource, SIRISource, Operator
... | mpl-2.0 | -4,007,397,036,994,494,000 | 51.75 | 119 | 0.647338 | false | 3.717098 | true | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.