max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
webots_ros2_core/webots_ros2_core/devices/gps_device.py | TaoYibo1866/webots_ros2 | 176 | 9500 | <reponame>TaoYibo1866/webots_ros2
# Copyright 1996-2021 Cyberbotics Ltd.
#
# 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... | 2.578125 | 3 |
players/jeff.py | jtreim/cant-stop | 0 | 9501 | <gh_stars>0
from .player import Player
class JeffPlayer(Player):
"""
JeffPlayer focuses on the odds for continuing turns.
To pick which move, calculates a move value based on odds of continued
turns, moving forward less likely columns when possible, and winning
columns over opponents.
"""
... | 3.125 | 3 |
Python2/src/main.py | nataddrho/digicueblue | 8 | 9502 | #!/usr/bin/env python
# <NAME> 10/13/2017
import serial
import serialport
import bgapi
import gui
import digicueblue
import traceback
import time
import threading
import sys
if sys.version_info[0] < 3:
import Tkinter as Tk
else:
import tkinter as Tk
class App(threading.Thread): # thread GUI to that BGAPI ... | 2.828125 | 3 |
messager.py | plasticruler/newshound | 0 | 9503 | import requests
#newspi key <KEY>
class Article:
link:str
headline:str
summary:str
body:str
| 1.554688 | 2 |
PyMaSC/handler/mappability.py | ronin-gw/PyMaSC | 2 | 9504 | <reponame>ronin-gw/PyMaSC<gh_stars>1-10
import logging
import os
import json
from multiprocessing import Process, Queue, Lock
import numpy as np
from PyMaSC.core.mappability import MappableLengthCalculator
from PyMaSC.utils.progress import ProgressHook, MultiLineProgressManager
from PyMaSC.utils.compatible import tos... | 2.078125 | 2 |
courses/backend/django-for-everybody/Web Application Technologies and Django/resources/dj4e-samples/tmpl/views.py | Nahid-Hassan/fullstack-software-development | 297 | 9505 | <filename>courses/backend/django-for-everybody/Web Application Technologies and Django/resources/dj4e-samples/tmpl/views.py
from django.shortcuts import render
from django.views import View
# Create your views here.
def simple(request):
return render(request, 'tmpl/simple.html')
def guess(request) :
context ... | 2.390625 | 2 |
webapp/ex.py | jykim-rust/python | 0 | 9506 | <reponame>jykim-rust/python<gh_stars>0
from flask import escape
'''with open('ex') as full:
for line in full:
print(line,end='**')
'''
'''
a=[]
with open('ex') as full:
for line in full:
a.append(line.split('|'))
print(a)
'''
'''
with open('ex') as full:
for line in full.readline():
... | 2.609375 | 3 |
lib/twitter_utils.py | Vman45/ask-alexa-twitter | 310 | 9507 | <gh_stars>100-1000
import requests
import jsonpickle
from requests_oauthlib import OAuth1
from urllib.parse import parse_qs, urlencode
import cherrypy
from collections import defaultdict
import json
import os
import re
from collections import defaultdict
# For readable serializations
jsonpickle.set_encoder_options('... | 2.375 | 2 |
sundry/serializable.py | jamesabel/sundry | 2 | 9508 | <reponame>jamesabel/sundry
import json
from enum import Enum
from decimal import Decimal
def convert_serializable_special_cases(o):
"""
Convert an object to a type that is fairly generally serializable (e.g. json serializable).
This only handles the cases that need converting. The json module handles a... | 3.375 | 3 |
legacy/neural_qa/train.py | FrancisLiang/models-1 | 4 | 9509 | import sys
import os
import argparse
import numpy as np
import paddle.v2 as paddle
import reader
import utils
import network
import config
from utils import logger
def save_model(trainer, model_save_dir, parameters, pass_id):
f = os.path.join(model_save_dir, "params_pass_%05d.tar.gz" % pass_id)
logger.info(... | 2.5 | 2 |
yggdrasil/drivers/MatlabModelDriver.py | astro-friedel/yggdrasil | 0 | 9510 | <reponame>astro-friedel/yggdrasil<gh_stars>0
import subprocess
import uuid as uuid_gen
import logging
from datetime import datetime
import os
import psutil
import warnings
import weakref
from yggdrasil import backwards, tools, platform, serialize
from yggdrasil.languages import get_language_dir
from yggdrasil.config im... | 1.929688 | 2 |
analysis/migrations/0032_auto_20210409_1333.py | SACGF/variantgrid | 5 | 9511 | <gh_stars>1-10
# Generated by Django 3.1.3 on 2021-04-09 04:03
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('snpdb', '0030_one_off_fix_cohort_sample_order'),
('analysis', '0031_auto_20210331_1826'),
]
... | 1.421875 | 1 |
ted_sws/mapping_suite_processor/services/conceptual_mapping_generate_sparql_queries.py | meaningfy-ws/ted-sws | 1 | 9512 | <filename>ted_sws/mapping_suite_processor/services/conceptual_mapping_generate_sparql_queries.py<gh_stars>1-10
import pathlib
from typing import Iterator
import pandas as pd
from ted_sws.resources.prefixes import PREFIXES_DEFINITIONS
import re
CONCEPTUAL_MAPPINGS_RULES_SHEET_NAME = "Rules"
RULES_SF_FIELD_ID = 'Standar... | 2.78125 | 3 |
src/__init__.py | codeKgu/BiLevel-Graph-Neural-Network | 20 | 9513 | import sys
from os.path import dirname, abspath, join
cur_folder = dirname(abspath(__file__))
sys.path.insert(0, join(dirname(cur_folder), 'src'))
sys.path.insert(0, dirname(cur_folder))
print(cur_folder) | 2.546875 | 3 |
src/controllers/serie.py | igormotta92/gta-desafio-python-flask-api | 0 | 9514 | <filename>src/controllers/serie.py<gh_stars>0
# https://stackoverflow.com/questions/3300464/how-can-i-get-dict-from-sqlite-query
# from flask import Flask
from flask_restful import Resource, reqparse
from src.model.serie import SerieModel
from src.server.instance import server
from db import db
# books_db = [{"id": 0... | 3.078125 | 3 |
tests/test_random.py | hirnimeshrampuresoftware/python-tcod | 231 | 9515 | <filename>tests/test_random.py<gh_stars>100-1000
import copy
import pickle
import tcod
def test_tcod_random() -> None:
rand = tcod.random.Random(tcod.random.COMPLEMENTARY_MULTIPLY_WITH_CARRY)
assert 0 <= rand.randint(0, 100) <= 100
assert 0 <= rand.uniform(0, 100) <= 100
rand.guass(0, 1)
rand.inv... | 2.5625 | 3 |
src/Products/Five/viewlet/viewlet.py | rbanffy/Zope | 289 | 9516 | ##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | 2.046875 | 2 |
problema21.py | bptfreitas/Project-Euler | 0 | 9517 | <gh_stars>0
#Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n).
#If d(a) = b and d(b) = a, where a b, then a and b are an amicable pair and each of a and b are called amicable numbers.
#For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55... | 3.578125 | 4 |
python-3.6.0/Doc/includes/email-unpack.py | emacslisp/python | 854 | 9518 | #!/usr/bin/env python3
"""Unpack a MIME message into a directory of files."""
import os
import email
import mimetypes
from email.policy import default
from argparse import ArgumentParser
def main():
parser = ArgumentParser(description="""\
Unpack a MIME message into a directory of files.
""")
parser.add_a... | 3.203125 | 3 |
src/streetview/logging_facility.py | juliantrue/Streetview-Segmenting | 1 | 9519 | import sys, os
import logging
import datetime
module_name = 'Streetview_Module'
debug_mode = True
class LoggingWrapper(object):
def __init__(self, log_folder_path=None):
self.debug_mode = debug_mode
# Create logger with module name
logger = logging.getLogger(module_name)
logger.s... | 2.765625 | 3 |
tkinter_examples/draw_chess_board.py | DazEB2/SimplePyScripts | 117 | 9520 | <filename>tkinter_examples/draw_chess_board.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from tkinter import *
root = Tk()
root.title('Chess board')
canvas = Canvas(root, width=700, height=700, bg='#fff')
canvas.pack()
fill = '#fff'
outline = '#000'
size = 88
for i in range(8):
f... | 3.9375 | 4 |
sandbox_api/asandbox.py | PremierLangage/sandbox-api | 4 | 9521 | # asandbox.py
#
# Authors:
# - <NAME> <<EMAIL>>
"""An asynchronous implementation of the Sandbox API."""
import io
import json
import os
from contextlib import AbstractAsyncContextManager
from typing import BinaryIO, Optional, Union
import aiohttp
from .exceptions import status_exceptions
from .utils import ENDP... | 2.859375 | 3 |
api/services/usuarios_services.py | jhonnattan123/fastapi_crud_example | 1 | 9522 | import datetime
from uuid import UUID
from api.actions import storage
from fastapi import HTTPException
from api.models.usuario import Usuario
from starlette.requests import Request
from api.dependencies import validar_email, validar_formato_fecha,validar_edad
FORMATO_FECHA = "%Y-%m-%d"
EDAD_MINIMA = 18
EDAD_MAXIMA = ... | 2.609375 | 3 |
certau/util/taxii/client.py | thisismyrobot/cti-toolkit | 12 | 9523 | import os
import logging
import dateutil
import pickle
from six.moves.urllib.parse import urlparse
from libtaxii import get_message_from_http_response, VID_TAXII_XML_11
from libtaxii.messages_11 import PollRequest, PollFulfillmentRequest
from libtaxii.messages_11 import PollResponse, generate_message_id
from libtaxii... | 2.421875 | 2 |
tutorials/registration/data.py | YipengHu/MPHY0041 | 1 | 9524 | <gh_stars>1-10
import os
import zipfile
import requests
DATA_PATH = './data'
RESULT_PATH = './result'
if not os.path.exists(DATA_PATH):
os.makedirs(DATA_PATH)
print('Downloading and extracting data...')
url = 'https://weisslab.cs.ucl.ac.uk/WEISSTeaching/datasets/-/archive/hn2dct/datasets-hn2dct.zip'
r = reque... | 3.21875 | 3 |
insights/parsers/tests/test_freeipa_healthcheck_log.py | lhuett/insights-core | 0 | 9525 | <filename>insights/parsers/tests/test_freeipa_healthcheck_log.py
import doctest
from insights.parsers import freeipa_healthcheck_log
from insights.parsers.freeipa_healthcheck_log import FreeIPAHealthCheckLog
from insights.tests import context_wrap
LONG_FREEIPA_HEALTHCHECK_LOG_OK = """
[{"source": "ipahealthcheck.ipa.r... | 1.953125 | 2 |
recipes/recipes/windows_image_builder/winpe_customization.py | xswz8015/infra | 0 | 9526 | # Copyright 2021 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from recipe_engine import post_process
from PB.recipes.infra.windows_image_builder import windows_image_builder as wib
from PB.recipes.infra.windows_image_b... | 1.835938 | 2 |
back/lollangCompiler/main.py | wonjinYi/lollang-playground | 11 | 9527 | <reponame>wonjinYi/lollang-playground
from lollangCompiler.compiler import Compiler
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--file", required=True, help="컴파일할 파일을 선택해주세요.")
parser.add_argument("--out", default="out.py", help="목적 파이썬 파일경로를 선택해주세요")
... | 2.109375 | 2 |
src/add_2_zip_imports.py | goubertbrent/oca-backend | 0 | 9528 | # -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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... | 1.757813 | 2 |
lib/galaxy/model/migrate/versions/0026_cloud_tables.py | Galaxyinternship/Galaxy | 0 | 9529 | <filename>lib/galaxy/model/migrate/versions/0026_cloud_tables.py
"""
This script adds tables needed for Galaxy cloud functionality.
"""
from __future__ import print_function
import datetime
import logging
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer, MetaData, Table, TEXT
now = datetime.date... | 2.234375 | 2 |
apps/user/urls.py | mrf-foundation/ckios_v1 | 0 | 9530 | # -*- encoding: utf-8 -*-
"""
Copyright (c) 2021 <EMAIL>
"""
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
from apps.user import views as user_views
from.views import... | 1.960938 | 2 |
sra_django_api/user/migrations/0003_auto_20180914_1242.py | tflati/ncbi-search | 0 | 9531 | <gh_stars>0
# Generated by Django 2.0.3 on 2018-09-14 12:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('user', '0002_project'),
]
operations = [
migrations.RenameField(
model_name='project',
old_name='file_pa... | 1.71875 | 2 |
image_misc.py | frankgh/deep-visualization-toolbox | 0 | 9532 | #! /usr/bin/env python
import cv2
import matplotlib.pyplot as plt
import skimage
import skimage.io
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
from matplotlib.pyplot import cm
from mpl_toolkits.axes_grid1 import make_axes_locatable
from numpy import ... | 2.53125 | 3 |
text.py | Kedyn/PingPong | 0 | 9533 | import pygame.font
import copy
class Text:
"""Draws a text to the screen."""
def __init__(self, rect, size, color, screen, text):
self.screen = screen
self.rect = copy.deepcopy(rect)
self.text = text
self.color = color
self.font = pygame.font.SysFont(None, size)
... | 3.3125 | 3 |
py/test/selenium/webdriver/common/window_tests.py | ey-advisory-technology-testing/selenium | 1 | 9534 | # Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 2.0625 | 2 |
psydac/cad/geometry.py | mayuri-dhote/psydac | 5 | 9535 | <gh_stars>1-10
# coding: utf-8
#
# a Geometry class contains the list of patches and additional information about
# the topology i.e. connectivity, boundaries
# For the moment, it is used as a container, that can be loaded from a file
# (hdf5)
from itertools import product
from collections import abc
import numpy as np... | 2.421875 | 2 |
utils.py | ok1zjf/AMNet | 40 | 9536 | __author__ = '<NAME>'
__email__ = '<EMAIL>'
__version__= '2.2'
__status__ = "Research"
__date__ = "28/1/2018"
__license__= "MIT License"
import os
import numpy as np
import glob
import subprocess
import platform
import sys
import pkg_resources
import torch
import PIL as Image
try:
import cv2
except:
print("W... | 2.46875 | 2 |
python/aghast/aghast_generated/Slice.py | HDembinski/aghast | 18 | 9537 | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: aghast_generated
import flatbuffers
class Slice(object):
__slots__ = ["_tab"]
# Slice
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
# Slice
def Start(self):
return self._... | 2.109375 | 2 |
axelrod/tests/strategies/test_mystrategy.py | AleksaLuka/Axelrod | 0 | 9538 | <reponame>AleksaLuka/Axelrod
import axelrod as axl
from .test_player import TestPlayer
C, D = axl.Action.C, axl.Action.D
class TestMyStrategy(TestPlayer):
name = "MyStrategy"
player = axl.mystrategy
expected_classifier = {
"memory_depth": 1,
"stochastic": False,
"long_run_time": ... | 2.9375 | 3 |
analyzer/BannerTool.py | Gr1ph00n/staticwebanalyzer | 0 | 9539 | <reponame>Gr1ph00n/staticwebanalyzer
#FILE NAME: BannerTool.py
#created by: <NAME>
#purpose: banner localization
#last edited by: <NAME>
#INSTALL: BeautifulSoup
#TODO: this code is a blob, must be refactorized!!!!
import re
import mechanize
import socket
import urllib
from tools import BaseTool
from bs4 import Beau... | 2.5 | 2 |
rhea/build/toolflow/xilinx/__init__.py | meetps/rhea | 1 | 9540 |
from .ise import ISE
from .vivado import Vivado
| 0.996094 | 1 |
app/AccountManagment.py | fredpan/Prosopagnosia_Web_Server | 0 | 9541 | # Copyright 2020 EraO Prosopagnosia Helper Dev Team, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
#
# Supervised by Prof. <NAME> (http://www.eecg.toronto.edu/~mann/)
#
# 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 c... | 1.882813 | 2 |
scripts/slice.py | priyablue/lidar_navigation | 2 | 9542 | <reponame>priyablue/lidar_navigation
import math
from point2d import Point2D
def to_point(rads, dist):
x = math.cos(rads) * dist
y = math.sin(rads) * dist
return Point2D(x, y)
class Slice(object):
def __init__(self, begin, end):
self.__begin = begin
self.__end = end
self.__... | 2.90625 | 3 |
src/audio_korpora_pipeline/inputadapter/adapters.py | WernerDreier/audio-korpora-pipeline | 1 | 9543 | import concurrent
import os
import re
import shutil
import xml.etree.ElementTree as ET # TODO do we have this as requirement?
from concurrent.futures import as_completed
from concurrent.futures._base import as_completed
from pathlib import Path
import ffmpeg
import pandas as pd
import webrtcvad
from audio_korpora_pi... | 2.125 | 2 |
development/multiImage_pytorch/experiment.py | anaikawadi/svbrdf-estimation | 0 | 9544 | <reponame>anaikawadi/svbrdf-estimation
import matplotlib.pyplot as plt
import math
import shutil
import torch
from accelerate import Accelerator
from tensorboardX import SummaryWriter
from cli import parse_args
from dataset import SvbrdfDataset
from losses import MixedLoss, MixedLoss2, MixedLoss3
from models import Mul... | 2.109375 | 2 |
src/rekognition_online_action_detection/engines/__init__.py | amazon-research/long-short-term-transformer | 52 | 9545 | <reponame>amazon-research/long-short-term-transformer
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
from .engines import do_train, do_inference
from .lstr.lstr_trainer import *
from .lstr.lstr_inference import *
| 1.039063 | 1 |
nuage_tempest_plugin/tests/api/test_nuage_ports.py | nuagenetworks/nuage-tempest-plugin | 1 | 9546 | <reponame>nuagenetworks/nuage-tempest-plugin
# Copyright 2017 NOKIA
# All Rights Reserved.
from netaddr import IPNetwork
import testtools
from tempest.common import waiters
from tempest.lib import exceptions
from tempest.scenario import manager
from tempest.test import decorators
from nuage_tempest_plugin.lib.test.n... | 1.921875 | 2 |
advent_of_code/2019/11_space_police/aoc_2019_11.py | thanosa/coding-challenges | 0 | 9547 | ''' Advent of code 2019 Day 11 - Space police '''
from typing import NamedTuple
from enum import Enum
INPUT_FILE=__file__.replace('.py', '.dat')
def to_number(digits: list) -> int:
return int(''.join(map(str, digits)))
def to_list(number: int) -> list:
return [int(i) for i in str(number)]
... | 3.390625 | 3 |
nicos_mlz/mira/setups/mezeiflip.py | jkrueger1/nicos | 12 | 9548 | description = 'Mezei spin flipper using TTI power supply'
group = 'optional'
tango_base = 'tango://miractrl.mira.frm2:10000/mira/'
devices = dict(
dct1 = device('nicos.devices.entangle.PowerSupply',
description = 'current in first channel of supply (flipper current)',
tangodevice = tango_base + 't... | 2.046875 | 2 |
mars/learn/cluster/_k_means_init.py | hxri/mars | 2,413 | 9549 | <filename>mars/learn/cluster/_k_means_init.py<gh_stars>1000+
# Copyright 1999-2021 Alibaba Group Holding Ltd.
#
# 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/li... | 1.820313 | 2 |
wikipedia_parser/infobox/wikitext_parser.py | ojones/wikipedia_parser | 9 | 9550 | <gh_stars>1-10
import re
from wikipedia_parser.infobox import clean_text as clean_help
from wikipedia_parser.infobox import wikitext_helpers as wtext_help
from wikipedia_parser.third_party_adapters import parserfromhell_adapter as adapter
__author__ = 'oswaldjones'
def get_simple_text(wtext, key, clean=True):
... | 2.8125 | 3 |
sandbox/lib/jumpscale/JumpscaleLibs/clients/graphql/GraphQLFactory.py | threefoldtech/threebot_prebuilt | 0 | 9551 | from .GraphQLClient import GraphQLClient
from Jumpscale import j
JSConfigs = j.baseclasses.object_config_collection
class GraphQLFactory(JSConfigs):
__jslocation__ = "j.clients.graphql"
_CHILDCLASS = GraphQLClient
| 1.304688 | 1 |
src/video_transcoding/defaults.py | tumb1er/django-video-transcoding | 21 | 9552 | <reponame>tumb1er/django-video-transcoding<filename>src/video_transcoding/defaults.py
from os import getenv as e
from kombu import Queue
CELERY_APP_NAME = 'video_transcoding'
VIDEO_TRANSCODING_CELERY_CONF = {
'broker_url': e('VIDEO_TRANSCODING_CELERY_BROKER_URL',
'amqp://guest:guest@rabbitm... | 2.0625 | 2 |
wordSenseByContext.py | jmboettcher/fall2019_sentiment_in_alternative_words | 0 | 9553 | <reponame>jmboettcher/fall2019_sentiment_in_alternative_words
from collections import defaultdict
from nltk.tokenize import sent_tokenize
from nltk.corpus import wordnet as wn
from nltk.corpus import semcor as sc
from nltk.corpus import stopwords
import mywordtokenizer
class SenseContextWordDict:
def __init__(sel... | 2.609375 | 3 |
paymentmethods/stripejs/tests.py | tjwalch/django-restshop | 0 | 9554 | import decimal
from unittest import mock
from django.conf import settings
from django.test import modify_settings
from rest_framework import test
from rest_framework.reverse import reverse
import stripe
from restshop import serializers
from restshop.models import Order
from paymentmethods.stripejs.models import Strip... | 2.359375 | 2 |
tnnt/uniqdeaths.py | tnnt-devteam/python-backend | 0 | 9555 | from tnnt.settings import UNIQUE_DEATH_REJECTIONS, UNIQUE_DEATH_NORMALIZATIONS
import re
def normalize(death):
# Given a death string, apply normalizations from settings.
for regtuple in UNIQUE_DEATH_NORMALIZATIONS:
death = re.sub(regtuple[0], regtuple[1], death)
return death
def reject(death):
... | 2.78125 | 3 |
qutip/graph.py | anubhavvardhan/qutip | 0 | 9556 | # This file is part of QuTiP: Quantum Toolbox in Python.
#
# Copyright (c) 2011 and later, <NAME> and <NAME>.
# 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. Redistribut... | 1.429688 | 1 |
test/source_dir/comments_blank_lines_code.py | Pierre-Thibault/neo-insert-imports | 1 | 9557 | # comments------------------
def a(x):
print x
if True:
a(10) | 2.8125 | 3 |
locan/data/hulls/__init__.py | super-resolution/Locan | 8 | 9558 | <filename>locan/data/hulls/__init__.py
"""
Hull objects of localization data.
Submodules:
-----------
.. autosummary::
:toctree: ./
hull
alpha_shape
"""
from locan.data.hulls.alpha_shape import *
from locan.data.hulls.hull import *
__all__ = []
__all__.extend(hull.__all__)
__all__.extend(alpha_shape.__al... | 1.367188 | 1 |
tests/test_workflow_build_combinations.py | tschoonj/cgat-daisy | 1 | 9559 | import pytest
from daisy.workflow import build_combinations
def test_one_option():
assert build_combinations(
{"option1": ["value1", "value2"]}) == \
[{'option1': 'value1'},
{'option1': 'value2'}]
def test_two_options():
assert build_combinations(
{'option1': ["value1", "val... | 2.546875 | 3 |
src/train_vae.py | katnoria/world-models | 0 | 9560 | <reponame>katnoria/world-models<gh_stars>0
# class Encoder:
# pass
# class Decoder:
# pass
# class VariationAutoEncoder:
# pass
import os
os.environ['CUDA_VISIBLE_DEVICES'] = "0"
import pickle
import logging
from glob import glob
import numpy as np
from time import time
from datetime import datetime
from... | 2.0625 | 2 |
login.py | harryzcy/canvas-file-syncer | 0 | 9561 | import time
from config import get_password, get_username
from playwright.sync_api import Page
def login(page: Page, url: str, landing_url: str):
raise RuntimeError("default login not supported")
def login_kenan_flagler(page: Page, url: str, landing_url: str) -> None:
page.goto(url)
page.wait_for_load_... | 2.671875 | 3 |
multitidal/client_lib.py | xa4a/multitidal | 2 | 9562 | import asyncio
import json
import os
import pty
import shutil
import sys
import tty
import termios
import time
import threading
import tornado.iostream
from tornado.ioloop import IOLoop
from tornado.websocket import websocket_connect
ioloop = tornado.ioloop.IOLoop.instance()
SSH_LOGIN = "root"
SSH_PASSWORD = "<PASS... | 2.328125 | 2 |
custom_components/ge_home/entities/common/ge_water_heater.py | olds/ha_gehome | 41 | 9563 | import abc
import logging
from typing import Any, Dict, List, Optional
from homeassistant.components.water_heater import WaterHeaterEntity
from homeassistant.const import (
TEMP_FAHRENHEIT,
TEMP_CELSIUS
)
from gehomesdk import ErdCode, ErdMeasurementUnits
from ...const import DOMAIN
from .ge_erd_entity import ... | 2.46875 | 2 |
scrapy/contracts/default.py | zyuchuan/scrapy | 0 | 9564 | import json
from scrapy.item import BaseItem
from scrapy.http import Request
from scrapy.exceptions import ContractFail
from scrapy.contracts import Contract
# contracts
class UrlContract(Contract):
""" Contract to set the url of the request (mandatory)
@url http://scrapy.org
"""
name = 'url'
... | 2.6875 | 3 |
networks/metrics.py | pabloduque0/cnn_deconv_viz | 0 | 9565 | <filename>networks/metrics.py
from keras import backend as K
import tensorflow as tf
import numpy as np
def custom_dice_coefficient(y_true, y_pred, recall_weight=0.3):
recall_weight = tf.Variable(recall_weight, dtype=tf.float32)
regular_dice = dice_coefficient(y_true, y_pred)
recall = lession_recall(y_tru... | 2.296875 | 2 |
scrapy_template/scrapy_template/pipelines.py | kk0501/spider | 0 | 9566 | <gh_stars>0
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
from scrapy.exceptions import DropItem
from hashlib import md5
from scrapy import log
from twisted.enterprise impor... | 2.15625 | 2 |
run_training_size_bootstrap.py | willferreira/multilabel-stance-detection | 0 | 9567 | import click
import pickle
import numpy as np
from collections import defaultdict
from utils import reset_seeds, get_dataset, load_embeddings
from mlp_multilabel_wrapper import PowersetKerasWrapper, MultiOutputKerasWrapper
from mlp_utils import CrossLabelDependencyLoss
def get_random_sample(dataset_name='bbc', train_... | 2.28125 | 2 |
code/evaluate.py | Shuailong/CCGSupertagging | 3 | 9568 | #!/usr/bin/env python
# encoding: utf-8
"""
evaluate.py
Created by Shuailong on 2016-12-2.
Evaluate model accuracy on test set.
"""
from __future__ import print_function
from time import time
from keras.models import load_model
import os
from utils import true_accuracy
from dataset import get_data
from train imp... | 2.578125 | 3 |
setup.py | Cloudlock/bravado | 0 | 9569 | #!/usr/bin/env python
# Copyright (c) 2013, Digium, Inc.
# Copyright (c) 2014-2016, Yelp, Inc.
import os
from setuptools import setup
import bravado
setup(
name="bravado",
# cloudlock version, no twisted dependency
version=bravado.version + "cl",
license="BSD 3-Clause License",
description="Lib... | 1.25 | 1 |
solum/api/controllers/v1/assembly.py | devdattakulkarni/test-solum | 0 | 9570 | <gh_stars>0
# Copyright 2013 - Red Hat, 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 law or agree... | 1.921875 | 2 |
server/website/website/migrations/0003_background_task_optimization.py | mjain2/ottertune | 1 | 9571 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2018-08-02 07:58
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('website', '0002_enable_compression'),
]
operations... | 1.53125 | 2 |
src/agility/usc/settings.py | bobbyluig/6.A01 | 0 | 9572 | <gh_stars>0
from agility.usc.enumeration import uscSerialMode, ChannelMode, HomeMode
from agility.usc.reader import BytecodeReader
class UscSettings:
def __init__(self):
self.servosAvailable = 6
self.servoPeriod = 156
self.miniMaestroServoPeriod = 80000
self.servoMultiplier = 1
... | 2.5 | 2 |
invmonInfra/domain/__init__.py | jtom38/invmon-api | 0 | 9573 | <filename>invmonInfra/domain/__init__.py
from .dbApiInterface import DbApiTableInterface
from .dbApiTableInterface import DbApiTableInterface
from .cacheInterface import CacheInterface
from .loggerInterface import LoggerInterface
from .envReaderInterface import EnvReaderInterface
from .driverInterface import DriverInte... | 1.117188 | 1 |
app/app8_18mix/h_noSeqSearch.py | ameenetemady/DeepPep | 1 | 9574 | <filename>app/app8_18mix/h_noSeqSearch.py<gh_stars>1-10
import sys
import csv
import os
sys.path.append('../../')
import h_lib
import h_lib_noSeqSearch
in_strFastaFilename = '{!s}/data/protein/18mix/18mix_db_plus_contaminants_20081209.fasta'.format(os.environ.get('HOME'))
in_strPeptideFilename = '{!s}/data/protein/18... | 2.53125 | 3 |
normalizer.py | ashokn414/python_floating_conversions | 0 | 9575 | # for normalization we need to have the maxima of x and y values with the help of which
# we can normalise the given values
import csv
filename = "values.csv"
fields = []
rows = []
with open(filename,'r') as csvfile:
reader = csv.reader(csvfile)
fields = next(reader)
for row in reader:
... | 4.0625 | 4 |
pygdp/fwgs.py | jiwalker-usgs/pyGDP | 0 | 9576 | from pygdp import _execute_request
from pygdp import _get_geotype
from owslib.util import log
def submitFeatureWeightedGridStatistics(geoType, dataSetURI, varID, startTime, endTime, attribute, value, gmlIDs,
verbose, coverage, delim, stat, grpby, timeStep, summAttr, weighted, WF... | 2.671875 | 3 |
tests/pure-req.py | rbanffy/bjoern | 2,326 | 9577 | import sys
import socket
conn = socket.create_connection(('0.0.0.0', 8080))
msgs = [
# 0 Keep-Alive, Transfer-Encoding chunked
'GET / HTTP/1.1\r\nConnection: Keep-Alive\r\n\r\n',
# 1,2,3 Close, EOF "encoding"
'GET / HTTP/1.1\r\n\r\n',
'GET / HTTP/1.1\r\nConnection: close\r\n\r\n',
'GET / HTTP/... | 2.625 | 3 |
apps/odoo/lib/odoo-10.0.post20170615-py2.7.egg/odoo/addons/stock/models/web_planner.py | gtfarng/Odoo_migrade | 1 | 9578 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from odoo import models
class PlannerInventory(models.Model):
_inherit = 'web.planner'
def _get_planner_application(self):
planner = super(PlannerInventory, self)._get_planner_application()
planner.append(['planner_inventory', 'Inventory Planner'])
... | 1.921875 | 2 |
wizbot.py | Wizard-Of-Chaos/WizardBot | 0 | 9579 | <gh_stars>0
#WIZARD BOT IS LIVE
import calendar
import discord as dc
from discord.ext.commands import Bot
from discord.ext import commands
from functools import partial
import asyncio as aio
import time
from random import randint
from datetime import datetime
from discord.ext import commands
from guildconfig import G... | 2.765625 | 3 |
stack.py | henryoliver/data-structures | 0 | 9580 | <gh_stars>0
class Stack:
def __init__(self):
self.stack = []
self.minMaxStack = []
# O(1) time | O(1) space
def peek(self):
if (len(self.stack)):
return self.stack[-1]
return None
# O(1) time | O(1) space
def pop(self):
if (len(self.stack)):
... | 3.640625 | 4 |
ProyectoDAI/settings.py | javiergarridomellado/proyectodai | 1 | 9581 | """
Django settings for TusPachangas project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
import django
import dj_database_url
# Build paths inside the project li... | 1.992188 | 2 |
Plugins/UnrealEnginePython/Binaries/Win64/Lib/site-packages/tensorflow/python/eager/test.py | JustinACoder/H22-GR3-UnrealAI | 6 | 9582 | <reponame>JustinACoder/H22-GR3-UnrealAI
# Copyright 2017 The TensorFlow 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/licen... | 1.648438 | 2 |
util.py | monokim/CheesyBullets | 1 | 9583 | <reponame>monokim/CheesyBullets
import time
import pyautogui
import win32gui
def get_screen_rect(caption='CheesyBullets'):
hwnd = win32gui.FindWindow(None, caption)
rect = win32gui.GetWindowRect(hwnd)
screen_rect = (rect[0], rect[1], rect[2] - rect[0], rect[3] - rect[1])
return rect
class Timer():
... | 2.765625 | 3 |
graph-to-graph/elf_correlate.py | mbrcknl/graph-refine | 6 | 9584 | #
# Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
#
# SPDX-License-Identifier: BSD-2-Clause
#
import re
import graph_refine.syntax as syntax
import graph_refine.problem as problem
import graph_refine.stack_logic as stack_logic
from graph_refine.syntax import true_term, false_term, mk_not
from graph_refine.check i... | 2.140625 | 2 |
Gelatin/parser/Parser.py | Etherbay/Gelatin | 107 | 9585 | <gh_stars>100-1000
# Copyright (c) 2010-2017 <NAME>
#
# 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, merg... | 2.1875 | 2 |
C03-Unit-Testing/21-C03V15/utils.py | dirchev/Python-101-Forever-1 | 59 | 9586 | BIG_CONSTANT = "YES"
def group_by(xs, grouper):
groups = {}
for x in xs:
group = grouper(x)
if group not in groups:
groups[group] = []
groups[group].append(x)
return groups
print(group_by([1, 2, 3, 4, 5, 6], lambda x: "even" if x % 2 == 0 else "odd"))
| 3.75 | 4 |
pipeline/test_sftp_to_s3.py | streamsets/datacollector-tests-external | 1 | 9587 | <filename>pipeline/test_sftp_to_s3.py
# Copyright 2019 StreamSets 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 b... | 1.945313 | 2 |
terra/tests/__init__.py | NoahRJohnson/terra | 0 | 9588 | <reponame>NoahRJohnson/terra<gh_stars>0
import os
# Use this as a package level setup
def load_tests(loader, standard_tests, pattern):
if os.environ.get('TERRA_UNITTEST', None) != "1":
print('WARNING: Running terra tests without setting TERRA_UNITTEST will '
'result in side effects such as extraneouse... | 2.25 | 2 |
icons/svg2png.py | benburrill/formiko | 116 | 9589 | # -*- coding: utf-8 -*-
from gi.repository.GdkPixbuf import Pixbuf
from os import makedirs
def main():
for size in (16, 22, 24, 32, 48, 64, 128, 256, 512):
icon = Pixbuf.new_from_file_at_scale("formiko.svg", size, size, True)
makedirs("%dx%d" % (size, size))
icon.savev("%dx%d/formiko.png"... | 2.5 | 2 |
django/currencies/migrations/0003_auto_20211121_0701.py | AngelOnFira/megagame-controller | 0 | 9590 | <reponame>AngelOnFira/megagame-controller<filename>django/currencies/migrations/0003_auto_20211121_0701.py
# Generated by Django 3.2.8 on 2021-11-21 12:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("currencies", "0002_initial"),
]
operation... | 1.695313 | 2 |
etna/transforms/decomposition/trend.py | tinkoff-ai/etna-ts | 96 | 9591 | from typing import Optional
import pandas as pd
from ruptures import Binseg
from ruptures.base import BaseCost
from sklearn.linear_model import LinearRegression
from etna.transforms.base import PerSegmentWrapper
from etna.transforms.decomposition.change_points_trend import BaseEstimator
from etna.transforms.decomposi... | 2.34375 | 2 |
argopy/tests/test_fetchers_facade_index.py | schwehr/argopy | 0 | 9592 | import xarray as xr
import pytest
import warnings
import argopy
from argopy import IndexFetcher as ArgoIndexFetcher
from argopy.errors import InvalidFetcherAccessPoint, InvalidFetcher, ErddapServerError, DataNotFound
from . import (
AVAILABLE_INDEX_SOURCES,
requires_fetcher_index,
requires_connected_erddap... | 2.28125 | 2 |
custom_components/acthor/config_flow.py | jatty/hass-acthor | 0 | 9593 | import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.const import CONF_HOST, CONF_NAME
from .acthor import test_connection
from .const import DEVICE_NAME, DOMAIN
class ACThorConfigFlow(ConfigFlow, domain=DOMAIN):
async def async_step_user(self, user_input: dict = None) ... | 2.265625 | 2 |
doajtest/fixtures/common.py | glauberm/doaj | 0 | 9594 | <gh_stars>0
NOTES = {
'notes': [
{'date': '2014-05-22T00:00:00Z', 'note': 'Second Note'},
{'date': '2014-05-21T14:02:45Z', 'note': 'First Note'}
]
}
SUBJECT = {
"subject": ['HB1-3840', 'H']
}
OWNER = {
"owner": "Owner"
}
EDITORIAL = {
"editor_group": "editorgroup",
"editor": "... | 1.804688 | 2 |
docnado/docnado.py | HEInventions/docnado | 78 | 9595 | """ docnado.py
A rapid documentation tool that will blow you away.
"""
import os
import re
import sys
import csv
import glob
import time
import signal
import shutil
import urllib
import base64
import hashlib
import argparse
import tempfile
import datetime
import threading
import traceback
import subprocess
import pl... | 2.65625 | 3 |
modulo-3/aulas/modulos e pacotes/uteis.py | Luis-Felipe-N/curso-em-video-python | 0 | 9596 | <filename>modulo-3/aulas/modulos e pacotes/uteis.py
def fatorial(n):
f = 1
while n != 0:
f *= n
n -= 1
return f
def dobro(n):
n *= 2
return n
def triplo(n):
n *= 3
return n
| 3.25 | 3 |
server/src/oscarbluelight/tests/offer/test_benefit_percentage.py | MaximBrewer/sebe | 8 | 9597 | <reponame>MaximBrewer/sebe
from decimal import Decimal as D
from django.core import exceptions
from django.test import TestCase
from oscar.test import factories
from oscar.test.basket import add_product, add_products
from django_redis import get_redis_connection
from oscarbluelight.offer.models import (
Range,
... | 2.140625 | 2 |
CLCC/ex8.py | adstr123/LPTHW | 0 | 9598 | # Moving around directories with pushd & popd
# You can save directries to go back to later. These can be built up in a stack.
#pushd i/like/icecream
# current stack: ~temp/i/like/icecream
#pushd i/like
# current stack: ~temp/i/like ~temp/i/like/icecream
#popd
# PS ~temp/i/like
#popd
# PS ~temp/i/like/icecre... | 1.851563 | 2 |
mkt/search/tests/test_filters.py | clouserw/zamboni | 0 | 9599 | <gh_stars>0
# -*- coding: utf-8 -*-
import json
from nose.tools import eq_, ok_
from rest_framework.exceptions import ParseError
from django.contrib.auth.models import AnonymousUser
from django.test.client import RequestFactory
from django.test.utils import override_settings
import mkt
from mkt.constants.application... | 1.851563 | 2 |