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 |
|---|---|---|---|---|---|---|
video_processing/video_constants.py | UrosOgrizovic/CelebCaption | 2 | 12772051 | <filename>video_processing/video_constants.py
RECTANGLE_COLOR = (255, 200, 0) # (B, G, R)
LABEL_COLOR = (255, 0, 0) | 1.625 | 2 |
elephant/__init__.py | Qkley/elephant | 0 | 12772052 | <filename>elephant/__init__.py
# -*- coding: utf-8 -*-
"""
Elephant is a package for the analysis of neurophysiology data, based on Neo.
:copyright: Copyright 2014-2019 by the Elephant team, see `doc/authors.rst`.
:license: Modified BSD, see LICENSE.txt for details.
"""
from . import (statistics,
spike... | 1.734375 | 2 |
features/environment.py | dandeliondeathray/metamorph | 0 | 12772053 | <reponame>dandeliondeathray/metamorph<filename>features/environment.py
import pymetamorph.metamorph as morph
from confluent_kafka import Producer, Consumer
class Service:
def __init__(self):
self._producer = Producer({'bootstrap.servers': 'localhost:9092'})
self._consumer = Consumer({'bootstrap.se... | 2.5 | 2 |
llvm/utils/lit/tests/Inputs/shtest-not/fail.py | medismailben/llvm-project | 2,338 | 12772054 | #!/usr/bin/env python
import print_environment
import sys
print_environment.execute()
sys.exit(1)
| 1.367188 | 1 |
test/samplesheet/test_initialize.py | iosonofabio/singlet | 11 | 12772055 | <reponame>iosonofabio/singlet
#!/usr/bin/env python
# vim: fdm=indent
'''
author: <NAME>
date: 15/08/17
content: Test SampleSheet class.
'''
def test_initialize():
from singlet.samplesheet import SampleSheet
ss = SampleSheet.from_sheetname('example_sheet_tsv')
def test_initialize_fromdataset():
... | 1.6875 | 2 |
Swati Singh/volume_of_sphere_with_radius_6.py | asumit499/Python-BootCamp | 4 | 12772056 | # 18. Write a language program to get the volume of a sphere with radius 6
radius=6
volume=(4/3)*3.14*(radius**3)
print("Volume of sphere with radius 6= ",volume)
| 4.15625 | 4 |
caffe2/python/layers/sampling_train.py | KevinKecc/caffe2 | 585 | 12772057 | # Copyright (c) 2016-present, Facebook, 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 agreed... | 1.945313 | 2 |
SchoolApp/apps/classes/models.py | Ceres445/Team-10-Python-Project | 4 | 12772058 | from datetime import timedelta
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.db import models
from django.urls import reverse
from django.utils import timezone
from django.utils.crypto import get_random_string
from invitations.adapters import get_invitations_adapt... | 2.125 | 2 |
src/gym_checkers/envs/__init__.py | qorrect/boardgames | 0 | 12772059 | <reponame>qorrect/boardgames
from gym.envs.registration import register
from .checkers import CheckersEnv
print('NOW REGISTERING checkers-v0')
register(
id='checkers-v0',
entry_point='gym_checkers.envs:CheckersEnv',
)
| 1.429688 | 1 |
color_tools.py | SheffieldCao/BoYuanRodeLaneDetection | 0 | 12772060 | <reponame>SheffieldCao/BoYuanRodeLaneDetection<gh_stars>0
import cv2
import numpy as np
def select_yellow(image):
'''
Generate mask of specified color(yellow)
Attributes:
Input:
- image: RGB image
'''
hsv = cv2.cvtColor(image, cv2.COLOR_RGB2HSV)
lower = np.array([20,60,60])
... | 3.125 | 3 |
tools/testing/plugin.py | kkallday/envoy | 1 | 12772061 | <gh_stars>1-10
#
# This is pytest plugin providing fixtures for tests.
#
import importlib
from contextlib import contextmanager, ExitStack
from typing import ContextManager, Iterator
from unittest.mock import patch
import pytest
@contextmanager
def nested(*contexts) -> Iterator[list]:
with ExitStack() as stack:... | 2.546875 | 3 |
app/api/atleta/tests.py | gahhhenrikk/gerenciador-de-equipes | 1 | 12772062 | <filename>app/api/atleta/tests.py
from django.urls import reverse
from rest_framework.test import APITestCase, APIClient
from rest_framework.views import status
from .models import Atleta
from .serializers import AtletaSerializer
from django.utils import timezone
class BaseViewTest(APITestCase):
client = APIClient... | 2.375 | 2 |
mysql_service.py | DhirenSc/claimit-flask | 0 | 12772063 | # this is the mysql service used to communicate with the backend
import mysql.connector
from datetime import datetime
from flask import jsonify
import json
# connector method for the spothole db
def connect():
return mysql.connector.connect(
host="localhost",
user="",
passwd="",
database=""... | 2.71875 | 3 |
tests/ui/data.py | technolotrix/chat | 0 | 12772064 | <reponame>technolotrix/chat
# I usually do not hard-code urls here,
# but there is not much need for complex configuration
BASEURL = 'https://simple-chat-asapp.herokuapp.com/'
login_button_text = 'Login'
sign_in_message = 'Sign in to Chat'
who_are_you = 'Who are you?'
who_are_you_talking_to = 'Who are you talking to?'... | 1.960938 | 2 |
cpmpy/fancy.py | tias/hakank | 279 | 12772065 | <reponame>tias/hakank
"""
Mr Greenguest puzzle (a.k.a fancy dress problem) in cpmpy.
Problem (and LPL) code in
http://diuflx71.unifr.ch/lpl/GetModel?name=/demo/demo2
'''
Mr. Greenfan wants to give a dress party where the male guests
must wear green dresses. The following rules are given:
1 If someone wears a green ... | 3.296875 | 3 |
back-end/www/tests/vision_tests.py | TUD-KInD/COCTEAU | 0 | 12772066 | from basic_tests import BasicTest
from models.model_operations import scenario_operations
from models.model_operations import topic_operations
from models.model_operations import user_operations
from models.model_operations import vision_operations
from models.model import db
import unittest
class VisionTest(BasicTes... | 2.421875 | 2 |
src/deep_nlp/embed_cnn/embcnnmodel_gradcam.py | ENSAE-CKW/nlp_understanding | 3 | 12772067 | <reponame>ENSAE-CKW/nlp_understanding
import torch.nn as nn
import torch
import torch.nn.functional as F
from ..grad_cam.model import GradCamBaseModel
class classifier3F(GradCamBaseModel):
# define all the layers used in model
def __init__(self, wv, no_words, embedding_dim, nb_filter, height_filter, output_dim... | 2.359375 | 2 |
detect_blur.py | mansikataria/whatsyourstyle-gan | 0 | 12772068 | # import the necessary packages
from imutils import paths
import argparse
import cv2
import os
def variance_of_laplacian(image):
# compute the Laplacian of the image and then return the focus
# measure -- the variance of the Laplacian
return cv2.Laplacian(image, cv2.CV_64F).var()
# construct the argument parse and... | 3.265625 | 3 |
tests/test_api.py | marcidy/meetup-api | 52 | 12772069 | <reponame>marcidy/meetup-api<filename>tests/test_api.py
import pytest
from meetup.api import Client, MeetupObject, MeetupObjectList
@pytest.fixture
def api_client():
return Client()
def test_get_find_groups(api_client):
find_group_info = api_client.GetFindGroups()
assert isinstance(find_group_info, Mee... | 2.203125 | 2 |
utils/stitch_bigshot.py | mikedh/truss | 3 | 12772070 | <filename>utils/stitch_bigshot.py<gh_stars>1-10
import sys
import cv2
import numpy as np
# stitches together tiled screenshots into one large screenshot
def create_fn(base, x, y):
return "{}{}x{}.png".format(base, y, x)
def infer_size(fn):
print(fn)
img = cv2.imread(fn)
return img.shape
def insert_i... | 2.71875 | 3 |
concat_frames.py | dellacortelab/refinement | 2 | 12772071 | import pandas as pd
import argparse
import os
import mdtraj
import numpy as np
parser = argparse.ArgumentParser(description='Script to generate trajectories containing only top scoring frames as scored by RWPlus. These top scoring trajectories can then be averaged with Gromacs to produce an averaged structure.')
pars... | 2.671875 | 3 |
graphzoo/dataloader/__init__.py | AnoushkaVyas/GraphZoo | 2 | 12772072 | from .dataloader import *
from .download import * | 1.140625 | 1 |
authentication_service/migrations/0007_auto_20180502_0905.py | hedleyroos/core-authentication-service | 1 | 12772073 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.12 on 2018-05-02 09:05
from __future__ import unicode_literals
import authentication_service.models
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('authentication_service', '0006_auto_20180424_0848'),
]
... | 1.554688 | 2 |
examples/example_async_reduceable.py | tzoiker/async-reduce | 0 | 12772074 | import asyncio
import time
from async_reduce import async_reduceable
@async_reduceable()
async def fetch(url):
print('- fetch page: ', url)
await asyncio.sleep(1)
return time.time()
async def amain():
coros = [
fetch('/page') for _ in range(10)
]
print('-- Simultaneous run')
do... | 3.171875 | 3 |
homeassistant/util/ulid.py | eyager1/core | 1 | 12772075 | """Helpers to generate ulids."""
from random import getrandbits
import time
def ulid_hex() -> str:
"""Generate a ULID in lowercase hex that will work for a UUID.
This ulid should not be used for cryptographically secure
operations.
This string can be converted with https://github.com/ahawker/ulid
... | 3.390625 | 3 |
judge/supplementary_gt.py | zwangab91/ctw-baseline | 333 | 12772076 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import json
import matplotlib.pyplot as plt
import os
import plot_tools
import settings
from pythonapi import anno_tools
def plt_print_text(*a... | 2.4375 | 2 |
FeatureStacker.py | menikhilpandey/Supply-Chain-Risk-Management | 11 | 12772077 | # class FeatureStacker(BaseEstimator):
# """Stacks several transformer objects to yield concatenated features.
# Similar to pipeline, a list of tuples ``(name, estimator)`` is passed
# to the constructor.
# """
# def __init__(self, transformer_list):
# self.transformer_list = transform... | 2.734375 | 3 |
go.py | cwbooth5/f5go | 0 | 12772078 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This is the Go Redirector. It uses short mnemonics as redirects to otherwise
long URLs. Few remember how to write in cursive, most people don't remember
common phone numbers, and just about everyone needs a way around bookmarks.
"""
import os
import os.path
import pwd
... | 2.390625 | 2 |
setup.py | zathras777/rosti | 0 | 12772079 | <reponame>zathras777/rosti<gh_stars>0
from setuptools import setup
from os import path
import io
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
with io.open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='rosti',
... | 1.703125 | 2 |
tinysqlbuilder/builder.py | koichirock/tinysqlbuilder | 0 | 12772080 | from typing import Union
from .sql import Condition, Query, full_outer_join, inner_join, left_outer_join, right_outer_join
all = ["Query", "QueryBuilder"]
class QueryBuilder:
"""Query builder."""
def __init__(self, table: str) -> None:
self._query = Query(table)
def select(self, *columns: str)... | 2.921875 | 3 |
bench/dj/hello/views.py | edilio/PyWebPerf | 0 | 12772081 | import django
from django.http import HttpResponse
import random
def rand_string(min, max):
"""Returns a randomly-generated string, of a random length.
Args:
min (int): Minimum string length to return, inclusive
max (int): Maximum string length to return, inclusive
"""
int_gen = ra... | 2.71875 | 3 |
experiment/dow_jones.py | IbarakikenYukishi/two-stage-MDL | 2 | 12772082 | <reponame>IbarakikenYukishi/two-stage-MDL<filename>experiment/dow_jones.py
import sys
sys.path.append('./')
from utils.utils import calc_AUC
from copy import deepcopy
import matplotlib.pyplot as plt
import numpy as np
import utils.hsdmdl2_nml as hsdmdl2_nml
import utils.hsdmdl1_nml as hsdmdl1_nml
import utils.sdmdl_nml... | 2.328125 | 2 |
shard/src/ext/statistics_cog.py | architus/aut-bot | 27 | 12772083 | <reponame>architus/aut-bot
from datetime import timedelta, datetime
from collections import Counter, defaultdict
from concurrent.futures import ThreadPoolExecutor
from discord.ext import commands
from discord import Forbidden, HTTPException
import discord
import json
import pytz
from typing import Dict, List, Counter ... | 2.390625 | 2 |
counting.py | comicdipesh99/Python-basics | 3 | 12772084 | numbers=[56,87,6,17,45,21]
i=0
var=0
while i<len(numbers):
num=numbers[i]
if num>20 and num<60:
var=var+1
i+=1
else:
i+=1
else:
print var | 3.4375 | 3 |
users/forms.py | Daniel-Alba15/TodoApp | 0 | 12772085 | <gh_stars>0
from django.contrib.auth.forms import PasswordChangeForm
from django import forms
from django.core.exceptions import ValidationError
from .models import MyUser
class UserForm(forms.Form):
email = forms.EmailField(max_length=200)
name = forms.CharField(max_length=100)
lastname = forms.CharField... | 2.59375 | 3 |
constructor_io/modules/recommendations.py | Constructor-io/constructorio-python | 0 | 12772086 | '''Recommendations Module'''
from time import time
from urllib.parse import quote, urlencode
import requests as r
from constructor_io.helpers.exception import ConstructorException
from constructor_io.helpers.utils import (clean_params, create_auth_header,
create_request_head... | 2.6875 | 3 |
user/mixins.py | alizabetpoor/squadfinder_pubg | 2 | 12772087 | <gh_stars>1-10
from django.shortcuts import redirect
class CHECKUSERMIXIN:
def dispatch(self,request,*args,**kwargs):
if not request.user.is_authenticated:
return super().dispatch(request,*args,**kwargs)
else:
return redirect("user:user_setting") | 1.671875 | 2 |
src/mp_api/routes/_user_settings.py | rkingsbury/api | 0 | 12772088 | <gh_stars>0
from emmet.core._user_settings import UserSettingsDoc
from mp_api.core.client import BaseRester
class UserSettingsRester(BaseRester[UserSettingsDoc]): # pragma: no cover
suffix = "_user_settings"
document_model = UserSettingsDoc # type: ignore
primary_key = "consumer_id"
monty_decode = ... | 2 | 2 |
tests/jardin_conf_mysql.py | tommyh/jardin | 0 | 12772089 | import logging
DATABASES = {
'jardin_test': 'mysql://root:@localhost:3306/jardin_test',
# a db with multiple replica URLs. The 1st url refers to an active server. The 2nd url will fail to connect.
'multi_url_test': 'mysql://root:@localhost:3306/jardin_test mysql://root:@localhost:3333/jardin_test',
}
CAC... | 2.09375 | 2 |
smhi/smhi.py | Menturan/SMHIpy | 1 | 12772090 | import json
from builtins import NotImplemented
from pprint import pprint
import aiohttp
import asyncio
import async_timeout
from aiohttp.client import _RequestContextManager
from logging import getLogger
from exceptions.SmhiExceptions import SmhiConnectionException
BASE_URL = 'https://opendata-download-metfcst.smhi... | 2.765625 | 3 |
scripts/dataset_resize.py | duanzhiihao/mycv | 0 | 12772091 | <filename>scripts/dataset_resize.py<gh_stars>0
import argparse
from pathlib import Path
from tqdm import tqdm
from PIL import Image
import numpy as np
import cv2
import torch
import torchvision as tv
interp_dict = {
'nearest': tv.transforms.InterpolationMode.BICUBIC.NEAREST,
'bilinear': tv.transforms.Interpol... | 2.171875 | 2 |
tests/test_bishop_movement.py | wuhw234/chess_bot | 0 | 12772092 | import unittest
from pieces.bishop import Bishop
from board import Board
class TestSum(unittest.TestCase):
def test_no_movement(self):
board = Board()
bishop1 = Bishop("W", 7, 0, board)
bishop2 = Bishop("W", 6, 1, board)
board.add_piece(bishop1, 7, 0)
board.add_piece(bish... | 3.140625 | 3 |
bin/build.py | itay-moav/rahl_commander | 1 | 12772093 | #!/usr/local/bin/python3.4
# encoding: utf-8
'''
pyverse.bin.build -- builds DB objects into your database.
pyverse.bin.build Use this command to build the various code generate objects in your DB, like Stored Procedures, Functions, Views and Triggers
@author: <NAME>
@copyright: 2014 open source. All rights re... | 2.625 | 3 |
pins/__init__.py | sellorm/python-pins | 0 | 12772094 | <reponame>sellorm/python-pins<gh_stars>0
"""
A simple package to be able to "pin" data to an RStudio Connect instance
"""
import os
import json
import pickle
import tarfile
import tempfile
import requests as req
try:
from importlib import metadata
except ImportError:
# Running on pre-3.8 Python; use importlib... | 2.625 | 3 |
calls/migrations/0007_auto_20180906_2104.py | JoshZero87/site | 4 | 12772095 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-09-06 21:04
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('calls', '0006_auto_20180906_0430'),
]
operations = [
migrations.AlterField... | 1.609375 | 2 |
src/lib.py | xplanr/101 | 0 | 12772096 | # vim: filetype=python ts=2 sw=2 sts=2 et :
# (c) 2021, <NAME> (<EMAIL>) unlicense.org
"""Standard library functions."""
import re
import sys
import copy
class obj:
"Simple base class with pretty print"
def __init__(i, **d): i.__dict__.update(d)
def __repr__(i) : return i.__class__.__name__+"{" + ', '.join(
... | 2.765625 | 3 |
pioinstaller/core.py | StanleyEPark/platformio-core-installer | 1 | 12772097 | <gh_stars>1-10
# Copyright (c) 2014-present PlatformIO <<EMAIL>>
#
# 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 appli... | 1.84375 | 2 |
cgbeacon2/server/blueprints/api_v1/controllers.py | Clinical-Genomics/cgbeacon2 | 0 | 12772098 | <filename>cgbeacon2/server/blueprints/api_v1/controllers.py
# -*- coding: utf-8 -*-
import logging
from cgbeacon2.constants import (
BUILD_MISMATCH,
INVALID_COORDINATES,
NO_MANDATORY_PARAMS,
NO_POSITION_PARAMS,
NO_SECONDARY_PARAMS,
QUERY_PARAMS_API_V1,
)
from cgbeacon2.models import DatasetAlle... | 2.296875 | 2 |
tests/test_scheduler.py | orkiguazio/mlrun | 0 | 12772099 | <filename>tests/test_scheduler.py
from datetime import datetime
import pytest
from croniter import CroniterBadCronError
from mlrun import scheduler
class Runtime(list):
def run(self, *args, **kw):
self.append((datetime.now(), args, kw))
def test_scheduler():
sched = scheduler.Scheduler()
rt = ... | 2.578125 | 3 |
agant/models/keras/generator/cgan.py | Sinha-Raunak/gan-toolkit | 0 | 12772100 | <filename>agant/models/keras/generator/cgan.py
"""
Let us see what all is required to be installed
"""
from keras.models import Sequential, Model
from keras.layers import Input, Dense, Reshape, Flatten, Dropout,multiply
from keras.layers.advanced_activations import LeakyReLU
from keras.layers import BatchNormalization,... | 2.328125 | 2 |
create_item.py | EgleSer/GildedRose-Refactoring-Kata | 0 | 12772101 | <filename>create_item.py
from gilded_rose import Item
class RegularItem(Item):
"""I needed Item class to have update_quality function, but altering with Item class is against the rules"""
def update_quality(self):
"""The Quality of an item is never more than 50.
The Quality of an item is never... | 3.796875 | 4 |
root/mldl/RequirementTutorial/OpenCV/PracticalPythonOpenCV/canny.py | chyidl/chyidlTutorial | 5 | 12772102 | <filename>root/mldl/RequirementTutorial/OpenCV/PracticalPythonOpenCV/canny.py
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
"""
Canny Edge Detection is a popular edge detection algorithm. It was developed by <NAME> in 1986. It is a multi-stage algorithm algorithm and we will go through each stages.
1. Noise Reducti... | 3.75 | 4 |
nuplan/planning/training/preprocessing/test/test_collate_dataloader.py | motional/nuplan-devkit | 128 | 12772103 | import unittest
import torch.utils.data
from nuplan.planning.scenario_builder.nuplan_db.test.nuplan_scenario_test_utils import get_test_nuplan_scenario
from nuplan.planning.simulation.trajectory.trajectory_sampling import TrajectorySampling
from nuplan.planning.training.data_loader.scenario_dataset import ScenarioDat... | 2.28125 | 2 |
advanced_algs/knapsack/knapsack_test.py | angelusualle/algorithms | 0 | 12772104 | import unittest
from knapsack_with_repetition import knapsack_with_repetition
from knapsack_no_repetition import knapsack_no_repetition
class Test_Case_Knapsack(unittest.TestCase):
def test_knapsack_with_repetition(self):
self.assertEqual(knapsack_with_repetition([6, 3, 4, 2], [30,14,16,9], 10), 48)
de... | 3.328125 | 3 |
pypy/tool/pytest/app_rewrite.py | nanjekyejoannah/pypy | 333 | 12772105 | import re
ASCII_IS_DEFAULT_ENCODING = False
cookie_re = re.compile(r"^[ \t\f]*#.*coding[:=][ \t]*[-\w.]+")
BOM_UTF8 = '\xef\xbb\xbf'
def _prepare_source(fn):
"""Read the source code for re-writing."""
try:
stat = fn.stat()
source = fn.read("rb")
except EnvironmentError:
return Non... | 2.546875 | 3 |
Code/combined.py | Karan-Malik/Smart-Attendance-and-Engagement-Detection-System | 0 | 12772106 | <reponame>Karan-Malik/Smart-Attendance-and-Engagement-Detection-System
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 8 18:59:42 2021
@author: karan
"""
import datetime
import os
import time
import cv2
import pandas as pd
from scipy.spatial import distance as dist
from imutils.video import VideoStream
from imutils i... | 2.1875 | 2 |
tests/test_get_posters.py | aDrz/movie-posters-convnet | 42 | 12772107 | # -*- coding: utf-8 -*-
import sys
sys.path.append('src')
import unittest
from src.get_posters import (download_poster, get_title_display,
get_yearly_url_imgs)
from src.utils import create_folder
class UtilsGetPosters(unittest.TestCase):
def setUp(self):
self.year = 1913
... | 2.640625 | 3 |
src/mcmc/colour/burn_in_colour.py | MehnaazAsad/RESOLVE_Statistics | 1 | 12772108 | """
{This script reads in the raw chain and plots times series for all parameters
in order to identify the burn-in}
"""
# Libs
from cosmo_utils.utils import work_paths as cwpaths
import matplotlib.pyplot as plt
from matplotlib import rc
import matplotlib
import pandas as pd
import numpy as np
import math
import os
_... | 2.296875 | 2 |
api/app/controllers/api/__init__.py | riszkymf/RESTKnot | 0 | 12772109 | from flask import Blueprint
from flask_restful import Api
from .user import *
from .auth import *
from .zone import *
from .type import *
from .ttl import *
from .record import *
from .ttldata import *
from .content import *
from .content_serial import *
from .dns.create import *
from .command_rest import *
from .admin... | 1.960938 | 2 |
demo/check_cluster_data_structure_consistency.py | spyke/spyke | 22 | 12772110 | <reponame>spyke/spyke<gh_stars>10-100
# code to run in IPython shell to test whether clustering info in spikes struct array and in
# the neurons dict is consistent:
for nid in sorted(self.sort.neurons):
print(nid, (self.sort.neurons[nid].sids == np.where(self.sort.spikes['nid'] == nid)[0]).all())
| 2.25 | 2 |
twitch_online.py | lbatalha/twitch_online.py | 0 | 12772111 | #!/bin/env python3
import os, sys, argparse
import requests, yaml
default_temp_file = '/tmp/twitch_online.token'
default_auth_file = os.path.join(os.environ['XDG_CONFIG_HOME'], 'twitch_online.creds')
parser = argparse.ArgumentParser(description="CLI Utility to check if a twitch channel is streaming", \
epilo... | 2.71875 | 3 |
tprmp/envs/gym.py | anindex/tp-rmp | 7 | 12772112 | <gh_stars>1-10
from os.path import join, dirname, realpath
import tempfile
import logging
import gym
import numpy as np
import pybullet as p
import time
from tprmp.demonstrations.manifold import Manifold
from tprmp.demonstrations.quaternion import q_convert_wxyz, q_convert_xyzw
from tprmp.utils.threading import thread... | 2.09375 | 2 |
sol/sol_sum67.py | igamberdievhasan/codingbat-notebooks | 0 | 12772113 | def sum67(nums):
count = 0
blocked = False
for n in nums:
if n == 6:
blocked = True
continue
if n == 7 and blocked:
blocked = False
continue
if not blocked:
count += n
return count
| 3.515625 | 4 |
curator/validators/config_file.py | rprabhat/curator | 1 | 12772114 | from voluptuous import *
from ..defaults import client_defaults
def client():
return Schema(
{
Optional('client'): client_defaults.config_client(),
Optional('logging'): client_defaults.config_logging(),
}
)
| 1.625 | 2 |
app/model/authtoken.py | Stanford-PERTS/neptune | 0 | 12772115 | <filename>app/model/authtoken.py
"""AuthToken: Temporary code for a user to authenticate, confirm
email, or change their password from a link.
"""
from google.appengine.ext import ndb
import datetime
import logging
from gae_models import DatastoreModel
class AuthToken(DatastoreModel):
"""Acts as a one-time-pas... | 3.1875 | 3 |
1/DayOne.py | samhallam18/aoc-2019 | 1 | 12772116 | import math
total = 0
file = open("fuel.txt")
for line in file:
calc = math.floor(int(line) / 3) - 2
temp_total = calc
while calc > 0:
calc = math.floor(int(calc) / 3) - 2
if calc > 0:
temp_total += calc
total += temp_total
print(total)
file.close()
| 3.546875 | 4 |
receives/helper.py | felixsch/receives | 0 | 12772117 | <gh_stars>0
import inspect
def current_module():
frame = inspect.stack()[1]
return inspect.getmodule(frame[0])
| 1.3125 | 1 |
question/urls.py | RohanDukare/OnlineVoting | 7 | 12772118 | <filename>question/urls.py
from question.views import QA,review
from django.conf.urls import url
urlpatterns = [
url(r'^qa/$', QA),
url(r'^review/$', review),
]
| 1.765625 | 2 |
Server/django-utils-master/djutils/utils/http.py | TheInventorMan/IntelligentTrafficManagement | 3 | 12772119 | <reponame>TheInventorMan/IntelligentTrafficManagement
import httplib2
import re
import socket
from urllib import urlencode
from django.conf import settings
from django.http import HttpResponse, HttpResponseRedirect
from django.utils import simplejson
def fetch_url(url, parameters=None, http_method="GET", follow_redi... | 2.421875 | 2 |
evaluation.py | Djmon91/3D-Unet | 12 | 12772120 | #coding:utf-8
"""
@auther tk0103
@date 2018-07-04
"""
import os, time, sys, copy
import numpy as np
import chainer
import chainer.links as L
import chainer.functions as F
from chainer.dataset import concat_examples
class Unet3DEvaluator(chainer.training.extensions.Evaluator):
def __init__(self, iterator, unet, nu... | 2.40625 | 2 |
TCS/problem1.py | Akash671/coding | 0 | 12772121 | <reponame>Akash671/coding
# author : <NAME>
# problem link:
# https://prepinsta.com/tcs-coding-question-1/
x,y,d,t=0,0,10,1
for n in range(int(input())):
if t==1:
x+=d
t=2
d+=10
elif t==2:
y+=d
t=3
d+=10
elif t==3:
x-=d
t=4
d+=10
elif t==4:
... | 3.453125 | 3 |
Wisapp/app/migrations/0036_auto_20181104_0033.py | AliVillegas/Wisapp | 0 | 12772122 | # Generated by Django 2.1.2 on 2018-11-04 06:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0035_userwithprofile_followedcategories'),
]
operations = [
migrations.AddField(
model_name='story',
name='im... | 1.773438 | 2 |
openks/models/pytorch/kg_modules/metrics.py | OpenCKS/OpenKS | 0 | 12772123 | <reponame>OpenCKS/OpenKS<filename>openks/models/pytorch/kg_modules/metrics.py
import math
def getP(ranklist, gtItems):
p = 0
for item in ranklist:
if item in gtItems:
p += 1
return p * 1.0 / len(ranklist)
def getR(ranklist, gtItems):
r = 0
for item in ranklist:
if item ... | 2.109375 | 2 |
data/plot.py | ZiyangTian/tsp | 0 | 12772124 | import numpy as np
import matplotlib.pyplot as plt
def plot_tsp(parameters, rank):
rank = np.concatenate([rank, rank[0:1]], axis=0)
plt.figure()
plt.plot(parameters[:, 0], parameters[:, 1], 'ro', color='red')
plt.plot(parameters[:, 0][rank], parameters[:, 1][rank], 'r-', color='blue')
plt.show()
| 2.546875 | 3 |
challenges/8.3.Function_Documentation_Strings/lesson_tests.py | pradeepsaiu/python-coding-challenges | 141 | 12772125 | import unittest
from main import *
class FunctionDocumentationStringsTests(unittest.TestCase):
def test_main(self):
self.assertIsNone(docstring_function())
self.assertIsNotNone(docstring_function.__doc__)
self.assertIsInstance(docstring_function.__doc__, str)
| 2.796875 | 3 |
examples/pylab_examples/pie_demo2.py | SoftwareDev/mat-plot-lib | 16 | 12772126 | """
Make a pie charts of varying size - see
http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.pie for the docstring.
This example shows a basic pie charts with labels optional features,
like autolabeling the percentage, offsetting a slice with "explode"
and adding a shadow, in different sizes.
"""
import ma... | 3.8125 | 4 |
unity/build_test_dataset.py | rubind/host_unity | 0 | 12772127 | """build_test_dataset.py -- The functions to build simulated data sets.
"""
import pickle
import numpy as np
from scipy import stats
# import matplotlib.pyplot as plt
# import corner
DATA_NAME = 'simple' # default
DATA_NAME = '3_gaus'
MB_HOST = 'indirect' # default
MB_HOST = 'step' # todo implement this
M... | 3.0625 | 3 |
tests/generator/test_vode.py | yuanz271/PyDSTool | 2 | 12772128 | <reponame>yuanz271/PyDSTool
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
from numpy import (
all,
allclose,
array,
linspace,
sin,
sort,
)
from numpy.testing import assert_almost_equal
import pytest
from PyDSTool import (
Events,
... | 2.15625 | 2 |
tables/table-alter/parse-turk-info.py | yash-srivastava19/sempre | 812 | 12772129 | <filename>tables/table-alter/parse-turk-info.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os, shutil, re, argparse, json
from codecs import open
from itertools import izip
from collections import defaultdict
def main():
parser = argparse.ArgumentParser()
parser.add_argument('infile')
parse... | 2.640625 | 3 |
src/pudl/metadata/dfs.py | Wheelspawn/pudl | 0 | 12772130 | """Static database tables."""
import pandas as pd
FERC_ACCOUNTS: pd.DataFrame = pd.DataFrame(
columns=['row_number', 'ferc_account_id', 'ferc_account_description'],
data=[
# 1. Intangible Plant
(2, '301', 'Intangible: Organization'),
(3, '302', 'Intangible: Franchises and consents'),
... | 2.703125 | 3 |
simple/game_loop_global.py | loyalgarlic/snakepit-game | 124 | 12772131 | import asyncio
from aiohttp import web
async def handle(request):
index = open("index.html", 'rb')
content = index.read()
return web.Response(body=content, content_type='text/html')
async def wshandler(request):
app = request.app
ws = web.WebSocketResponse()
await ws.prepare(request)
if ... | 2.921875 | 3 |
merge_sorted_array_88/main.py | dhanraj-vedanth/Leetcode | 0 | 12772132 | from typing import List
class Solution:
def merge(
self, nums1: List[int], m: int, nums2: List[int], n: int
) -> None:
"""
Do not return anything, modify nums1 in-place instead.
"""
len1 = m-1
len2 = n-1
merged_len = m + n -1
while len1 >= 0 and ... | 3.9375 | 4 |
mkconfig/tests/test_cement_cli.py | mcfongtw/MkConfig | 1 | 12772133 | import os
from mkconfig.conf.utils import Utils
from mkconfig.env import setup_logging_with_details, Configurations
import logging
from cement.utils import test
setup_logging_with_details()
logger = logging.getLogger(__name__)
from mkconfig.core.cli import MkConfigApp
class TestMkConfigApp(test.CementTestCase):
... | 2.234375 | 2 |
opentargets/__init__.py | machbio/opentargets-py | 0 | 12772134 | """
This module communicate with the Open Targets REST API with a simple client, and requires not knowledge of the API.
"""
import logging
from opentargets.conn import Connection, IterableResult
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
class OpenTargetsClient(object):
'''
main cl... | 2.53125 | 3 |
build/lib.linux-x86_64-2.7/moca/mrs/admin.py | satvikdhandhania/vit-11 | 1 | 12772135 | <reponame>satvikdhandhania/vit-11
import logging
from django.contrib import admin
from moca.mrs.util import enable_logging
#from requestlog import util
from moca.mrs.models import Patient, Procedure, BinaryResource, SavedProcedure, Notification, QueueElement, Client
from moca.mrs import api
class ProcedureAdmin(adm... | 1.984375 | 2 |
examples/adspygoogle/dfa/v1_20/create_spotlight_activity.py | cherry-wb/googleads-python-lib | 0 | 12772136 | <gh_stars>0
#!/usr/bin/python
#
# Copyright 2013 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
#
# Unles... | 2.265625 | 2 |
appengine/src/greenday_core/models/event.py | meedan/montage | 6 | 12772137 | """
Defines the model to hold application events
"""
from django.conf import settings
from django.db import models
from django.forms.models import model_to_dict
from ..constants import EventKind, EventModel, EventCommonCodes, CODES_PER_MODEL
from .user import get_sentinel_user
class Event(models.Model):
"""... | 2.5 | 2 |
torchFI/modules/eltwise.py | bfgoldstein/torchfi | 6 | 12772138 | ###############################################################
# This file was created using part of Distiller project developed by:
# NervanaSystems https://github.com/NervanaSystems/distiller
#
# Changes were applied to satisfy torchFI project needs
###############################################################
#... | 1.9375 | 2 |
clio/dummy_module.py | nestauk/nesta-flask | 0 | 12772139 | class dummy_model:
def query(self, q):
return "Query had length {}".format(len(q))
| 2.703125 | 3 |
protonfixes/gamefixes/280200.py | Citiroller/protonfixes | 213 | 12772140 | <reponame>Citiroller/protonfixes<filename>protonfixes/gamefixes/280200.py
""" Game fix for Eterium
"""
#pylint: disable=C0103
from protonfixes import util
def main():
""" Install xna40
"""
util.protontricks('xna40')
| 1.242188 | 1 |
Chapter39.Decorators/3-calltracer_descr-for-method-1.py | mindnhand/Learning-Python-5th | 0 | 12772141 | #!/usr/bin/env python3
#encoding=utf-8
#--------------------------------------------
# Usage: python3 3-calltracer_descr-for-method.py
# Description: make descriptor class as decorator to decorate class method
#--------------------------------------------
class Tracer: # a decorator + descriptor
def __ini... | 3.421875 | 3 |
src/tests/datastructures/test_mergefindsets.py | DavidLlorens/algoritmia | 6 | 12772142 | <reponame>DavidLlorens/algoritmia
#coding: latin1
import unittest
from algoritmia.datastructures.mergefindsets import (NaiveMergeFindSet, RankUnionMFset,
PathCompressionMFset, MergeFindSet)
from algoritmia.datastructures.maps import IntKeyMap
class TestNaiv... | 2.828125 | 3 |
examples/get_screenshot.py | Alsan/pySphere | 0 | 12772143 | #!/usr/bin/env python
from pysphere import VIServer
server = VIServer()
server.connect("my.esx.host.example.org", "username", "secret")
vm = server.get_vm_by_path("[datastore] path/to/file.vmx")
vm.wait_for_tools()
vm.login_in_guest("Administrator", "secret")
vm.get_screenshot("vm_screenshot.png", overwrite=True)
se... | 2.203125 | 2 |
to_nwb/mworks/data.py | mpompolas/to_nwb | 1 | 12772144 | import os
import shutil
from ._mworks import ReservedEventCode, _MWKFile, _MWKStream
class IndexingException(IOError):
pass
class MWKFile(_MWKFile):
def __init__(self, file_name):
super(MWKFile, self).__init__(file_name)
self._codec = None
self._reverse_codec = None
def close... | 2.390625 | 2 |
modules/currency_token/mint.py | Arpan-206/Web3-CLI | 4 | 12772145 | # Importing modules
from decimal import Decimal
from PyInquirer import prompt
from termcolor import colored
from .get import get
# The function to mint tokens
def mint(currency_module) -> None:
mint_data = prompt([
{
'type': 'input',
'name': 'amount',
'message': 'Enter... | 3.328125 | 3 |
gSed/WordSplitter.py | elfgirl/gSed | 0 | 12772146 | import re
import wordMaps
class WordSplitter:
def __init__(self):
self.word_mapper = wordMaps.WordMaps()
self.word_breaker = re.compile(r"([^\W\d]*)", re.MULTILINE)
self.sentence_breaker = re.compile(r"((?!=|\!|\.|\?).)+.\b", re.MULTILINE)
self.swaps = {}
self.contexts =... | 2.828125 | 3 |
cloud_init_gen/part_type.py | sammck/cloud-init-gen | 1 | 12772147 | #
# Copyright (c) 2022 <NAME>
#
# MIT License - See LICENSE file accompanying this package.
#
"""Mapping between cloud-init mime types and '#' comment header conventions
"""
from typing import Optional, List, Dict
class CloudInitPartType:
"""
A descriptor that correlates a MIME type with it's associated cloud-in... | 2.46875 | 2 |
poptox/leslie_probit/leslie_probit_parameters.py | quanted/poptox | 1 | 12772148 | <filename>poptox/leslie_probit/leslie_probit_parameters.py
#*********************************************************#
# @@ScriptName: leslie_probit_parameters.py
# @@Author: <NAME>
# @@Create Date: 2013-09-23
# @@Modify Date: 2013-09-24
#*********************************************************#
import os
os.environ['... | 2.0625 | 2 |
python/problem-088.py | mbuhot/mbuhot-euler-solutions | 1 | 12772149 | #! /usr/bin/env python3
import prime
from memo import memoize
description = '''
Next
Product-sum numbers
Problem 88
A natural number, N, that can be written as the sum and product of a given set of at least two natural numbers, {a1, a2, ... , ak} is called a product-sum number: N = a1 + a2 + ... + ak = a1 × a2 × ... ... | 4.21875 | 4 |
napari_pyclesperanto_assistant/_statistics_of_labeled_pixels.py | jo-mueller/napari_pyclesperanto_assistant | 16 | 12772150 | import warnings
import numpy as np
from magicgui.widgets import Table
from napari_plugin_engine import napari_hook_implementation
from napari.types import ImageData, LabelsData, LayerDataTuple
from napari import Viewer
from pandas import DataFrame
from qtpy.QtCore import QTimer
from qtpy.QtWidgets import QTableWidget,... | 2.078125 | 2 |