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 |
|---|---|---|---|---|---|---|
src/sima/simo/blueprints/timedependentvolumemass.py | SINTEF/simapy | 0 | 12776251 | <reponame>SINTEF/simapy
#
# Generated with TimeDependentVolumeMassBlueprint
from dmt.blueprint import Blueprint
from dmt.dimension import Dimension
from dmt.attribute import Attribute
from dmt.enum_attribute import EnumAttribute
from dmt.blueprint_attribute import BlueprintAttribute
from sima.sima.blueprints.namedobje... | 1.921875 | 2 |
misago/misago/users/tests/test_profilefields.py | vascoalramos/misago-deployment | 2 | 12776252 | <reponame>vascoalramos/misago-deployment<filename>misago/misago/users/tests/test_profilefields.py
from django.contrib.auth import get_user_model
from django.test import TestCase
from ..profilefields import ProfileFields
User = get_user_model()
class ProfileFieldsLoadTests(TestCase):
def test_no_groups(self):
... | 2.4375 | 2 |
inherit.py | Prashant269/python | 0 | 12776253 | class baseclass(object):
def printhim(self):
print "prasanth"
class inhertingclass(baseclass):
pass
x=inhertingclass()
x.printhim()
| 3.21875 | 3 |
cospar/help_functions/_additional_analysis.py | rbonhamcarter/cospar | 1 | 12776254 | <gh_stars>1-10
import numpy as np
from scipy import stats
import scipy.sparse as ssp
import pandas as pd
from .. import settings
from .. import logging as logg
import time
import ot.bregman as otb
from ._help_functions_CoSpar import *
from matplotlib import pyplot as plt
import seaborn as sns
from .. import plotting as... | 2.25 | 2 |
testsite/main/views.py | navdhakar/django-project | 0 | 12776255 | <filename>testsite/main/views.py
from django.shortcuts import render, redirect
from django.http import HttpResponse
from .models import Tutorial, TutorialCategory, TutorialSeries
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth import login, logout, authenticate
from django.contrib import... | 2.421875 | 2 |
client/wmdriver.py | imrehg/lambdam | 1 | 12776256 | <gh_stars>1-10
"""
Driver module for HighFinesse WS7
"""
import ctypes
import numpy
wlm = ctypes.windll.wlmData # load the DLL
int32 = ctypes.c_long
uInt32 = ctypes.c_ulong
uInt64 = ctypes.c_ulonglong
float64 = ctypes.c_double
double = ctypes.c_double
long = ctypes.c_long
dword = ctypes.c_ulong
LZERO = long(0)
DZERO ... | 1.757813 | 2 |
redplane-store/apps/pktgen/parse_pcap.py | daehyeok-kim/redplane-public | 11 | 12776257 | <reponame>daehyeok-kim/redplane-public
from scapy.all import *
import sys
print(sys.argv[1])
packets = rdpcap(sys.argv[1], count = 100)
out_file = open('m57_summary.txt',"w")
ip_list = []
tcp_flows = []
udp_flows = []
total = 0
for packet in packets:
print (packet.time)
if packet.haslayer(IP) and packet.haslay... | 2.5 | 2 |
fancy/trainer/configs/model_config.py | susautw/fancy-trainer | 0 | 12776258 | <filename>fancy/trainer/configs/model_config.py
from cached_property import cached_property
from torch.nn import Module
from fancy import config as cfg
from . import ImporterConfig
class ModelConfig(ImporterConfig):
param: dict = cfg.Option(default={}, type=cfg.process.flag_container)
@cached_property
d... | 2.375 | 2 |
experiments/coil100.py | Guanzhou-Ke/conan | 5 | 12776259 | from .default import Experiment
coil100 = Experiment(
arch='alexnet',
hidden_dim=1024,
verbose=True,
log_dir='./logs/mytest',
device='cuda',
extra_record=True,
opt='adam',
epochs=100,
lr=1e-3,
batch_size=24,
cluster_hidden_dim=512,
ds_name='coil-100',
img_size=128,
... | 1.78125 | 2 |
data/migrations/0024_job_vm_volume_name.py | Duke-GCB/bespin-api | 0 | 12776260 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2017-08-04 19:25
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('data', '0023_auto_20170801_1925'),
]
operations = [
migrations.AddField(
... | 1.71875 | 2 |
python-code/ml/ml.py | Edward-Son/yhack2017 | 0 | 12776261 | <filename>python-code/ml/ml.py
import xml.etree.ElementTree as ET
import numpy as np
from sklearn.externals import joblib
from sklearn import svm
#get the number code for the people / get the samples
indices = []
i = 0
with open("./found-bad-people/1-common-people") as f:
for line in f:
indices.append(int(line.s... | 2.6875 | 3 |
inbm-vision/vision-agent/vision/tests/unit/test_registry.py | ahameedx/intel-inb-manageability | 5 | 12776262 | <reponame>ahameedx/intel-inb-manageability
import datetime
from unittest import TestCase
from vision.registry_manager import Registry, Firmware, Hardware, Status, Security, OperatingSystem
from mock import Mock
class TestRegistry(TestCase):
def setUp(self):
self.mock_datetime = Mock()
def test_creat... | 2.34375 | 2 |
python/arachne/driver/pipeline.py | fixstars/arachne | 3 | 12776263 | from dataclasses import dataclass, field
from logging import getLogger
from typing import Any, Dict, List
import hydra
from hydra.core.config_store import ConfigStore
from hydra.utils import to_absolute_path
from kedro.io import DataCatalog, MemoryDataSet
from kedro.pipeline import Pipeline, node
from kedro.runner imp... | 2.203125 | 2 |
button_mapping.py | ash3rz/flexx_gamepad | 1 | 12776264 | import sys
darwin = {
0: "button square",
1: "button cross",
2: "button circle",
3: "button triangle",
4: "bumper left",
5: "bumper right",
6: "trigger left",
7: "trigger right",
8: "select",
9: "start",
10: "left stick",
11: "right stick",
12: "meta",
13: "touch... | 2.046875 | 2 |
py_test/voice/voice_python.py | GotoRen/notify-me | 0 | 12776265 | import urllib.request as req
import subprocess
s = '侵入者あり'
print(s)
# 読み上げ
subprocess.check_output('./jtalk.sh "' +s + '"', shell=True)
| 2.34375 | 2 |
figures/Plotter_fisher_fock.py | sqvarfort/Coherent-states-Fisher-information | 1 | 12776266 | import matplotlib.pyplot as plt
from numpy import *
import os
"""
filename1 = "data_processing/" + "GeneralQuantumFisher1photons"
filename2 = "data_processing/" + "GeneralQuantumFisher2photons"
filename3 = "data_processing/" + "GeneralQuantumFisher3photons"
with open(filename1) as f:
fisher1 = f.readline... | 2.59375 | 3 |
project/database2.py | nikodrum/evaluationua | 0 | 12776267 | # -*- coding: UTF-8 -*-
from flask import g
import sqlite3
import math
database = "project/appart.db"
categ_coef = 17960
coef = 360/6378137
def connect_db():
return sqlite3.connect(database)
def insert_db(street,lat,lon,year,room,all_area,all_floors):
# validating wether coordinates in Kyiv
#calculating distanc... | 3.109375 | 3 |
setup.py | philbarker/ocxmd | 8 | 12776268 | <reponame>philbarker/ocxmd
from setuptools import setup
setup(
name="ocxmd",
version="0.2",
py_modules=["ocxmd"],
install_requires=["markdown>=3.0", "PyYAML>=3.13"],
author="<NAME>",
author_email="<EMAIL>",
url="https://github.com/philbarker/ocxmd",
description="A python markdown extens... | 1.320313 | 1 |
myapp/forms.py | quinchoponcho/helloworld | 0 | 12776269 | from django import forms
from django.forms import ModelForm
from .models import Customer, Order
from myapp.models import Name
class NameForm(forms.ModelForm):
name_value = forms.CharField(max_length=100, help_text = "Enter a name")
class Meta:
model = Name
fields = ('name_value',)
clas... | 2.34375 | 2 |
elementary/best-stock.py | vargad/exercises | 1 | 12776270 | <gh_stars>1-10
#!/usr/bin/env python3
def best_stock(data):
return sorted(data.items(), key=lambda x: x[1])[-1][0]
if __name__ == '__main__':
print(best_stock({ "CAL": 42.0, "GOG": 190.5, "DAG": 32.2 }))
assert best_stock({ "CAL": 42.0, "GOG": 190.5, "DAG": 32.2 }) == "GOG"
assert best_stock({ "CAL":... | 3.109375 | 3 |
18. Exam Prep/checkmate.py | elenaborisova/Python-Advanced | 2 | 12776271 | <gh_stars>1-10
def find_position(matrix, size, symbol):
positions = []
for row in range(size):
for col in range(size):
if matrix[row][col] == symbol:
positions.append([row, col])
return positions
def is_position_valid(row, col, size):
return 0 <= row < size and 0 <=... | 3.859375 | 4 |
Code/Client/ui_face.py | jhuboo/sparky | 3 | 12776272 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'C:\Users\Freenove\Desktop\树莓派六足机器人\界面UI\face.ui'
#
# Created by: PyQt5 UI code generator 5.15.0
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are do... | 2.09375 | 2 |
lib/coginvasion/hood/SafeZoneLoader.py | theclashingfritz/Cog-Invasion-Online-Dump | 1 | 12776273 | <filename>lib/coginvasion/hood/SafeZoneLoader.py<gh_stars>1-10
# uncompyle6 version 3.2.4
# Python bytecode 2.7 (62211)
# Decompiled from: Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)]
# Embedded file name: lib.coginvasion.hood.SafeZoneLoader
from direct.directnotify.DirectNotify... | 1.882813 | 2 |
Drawing Book/Drawing Book.py | saurav0001kumar/HackerRank | 1 | 12776274 | <filename>Drawing Book/Drawing Book.py
#!/bin/python3
import os
import sys
#
# Complete the pageCount function below.
#
def pageCount(n, p):
t1=0
t2=0
if p==1 or p==n:
return(0)
else:
i=2
while i<=p:
if i%2==0:
t1+=1
i+=1
... | 3.890625 | 4 |
hawkweed/monads/either.py | hellerve/hawkweed | 20 | 12776275 | <filename>hawkweed/monads/either.py
"""The Either monad"""
from hawkweed.monads.monad import Monad
class Either(Monad):
"""The Either abstract base class"""
def __init__(self, value):
raise NotImplementedError("please use the type instances Left or Right")
class Left(Either):
"""The Left instance ... | 3.671875 | 4 |
ex0021.py | GantzLorran/Python | 1 | 12776276 | <filename>ex0021.py
import pygame
pygame.mixer.init()
pygame.mixer.music.load('FH3.mp3')
pygame.mixer.music.play()
input()
pygame.event.wait() | 2.0625 | 2 |
webapp01.py | sgriffith3/2022-02-28-SDE | 2 | 12776277 | <reponame>sgriffith3/2022-02-28-SDE
import random
import string
from flask import Flask
app = Flask(__name__)
@app.route("/")
def main_page():
return "Howdy neighbor!"
@app.route("/rando")
def rando_str():
s = ""
for i in range(10):
s += random.choice(string.ascii_letters)
return s
if __n... | 2.734375 | 3 |
luracoin/helpers.py | maguayo/luracoin-python | 12 | 12776278 | import os
import ecdsa
import binascii
import hashlib
from typing import Union
from luracoin.config import Config
def bits_to_target(bits: bytes) -> hex:
"""
The first byte is the exponent and the other three bytes are the
coefficient.
Example:
0x1d00ffff => 00000000ffff00000000000000000000000... | 3.328125 | 3 |
moveit_ros/benchmarks/benchmarks/scripts/moveit_benchmark_statistics.py | KenmeiFusamae/moveit | 0 | 12776279 | #!/usr/bin/env python
######################################################################
# Software License Agreement (BSD License)
#
# Copyright (c) 2010, Rice University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that t... | 1.125 | 1 |
composer/models/__init__.py | jacobfulano/composer | 2 | 12776280 | # Copyright 2021 MosaicML. All Rights Reserved.
from composer.models.base import BaseMosaicModel as BaseMosaicModel
from composer.models.base import MosaicClassifier as MosaicClassifier
from composer.models.classify_mnist import MNIST_Classifier as MNIST_Classifier
from composer.models.classify_mnist import MnistClass... | 1.125 | 1 |
mpi4jax/_src/flush.py | Thenerdstation/mpi4jax | 122 | 12776281 | <reponame>Thenerdstation/mpi4jax
import jax
def flush(platform):
"""Wait for all pending XLA operations"""
devices = jax.devices(platform)
for device in devices:
# as suggested in jax#4335
noop = jax.device_put(0, device=device) + 0
noop.block_until_ready()
| 2.1875 | 2 |
Assignments/Comprehensions/Exercise/09. Bunker.py | KaloyankerR/python-advanced-repository | 0 | 12776282 | items = {key: {} for key in input().split(", ")}
n = int(input())
for _ in range(n):
line = input().split(" - ")
category, item = line[0], line[1]
items_count = line[2].split(";")
quantity = int(items_count[0].split(":")[1])
quality = int(items_count[1].split(":")[1])
items[category][item] = (... | 3.4375 | 3 |
scripts/move.py | xdze2/pyrobot | 0 | 12776283 | <gh_stars>0
import time
from threading import Thread
from pyrobot.drive import Mobility
# from pyrobot.imu import Imu
# import numpy as np
# import matplotlib.pyplot as plt
import zmq
# Prepare our context and publisher
context = zmq.Context()
subscriber = context.socket(zmq.PAIR)
subscriber.bind("tcp://*:55... | 2.46875 | 2 |
dask/dataframe/io/orc/__init__.py | Juanlu001/dask | 9,684 | 12776284 | <filename>dask/dataframe/io/orc/__init__.py
from .core import read_orc, to_orc
| 1.140625 | 1 |
xml2ES.py | Fadavvi/XML2Elastic | 4 | 12776285 | import xmltodict
import json
from elasticsearch import Elasticsearch
from elasticsearch.connection import create_ssl_context
import sys
##By: <NAME>
def Connect2ES(ip='127.0.0.1',port='9200',user="",password="",https=False,CertPath="",ES_Index='reports',Data=""):
## Connection to Elastic Search (http/https... | 2.859375 | 3 |
mala/datahandling/__init__.py | DanielKotik/mala | 11 | 12776286 | """All functions for handling data."""
from .data_handler import DataHandler
from .data_scaler import DataScaler
from .data_converter import DataConverter
| 1.046875 | 1 |
neat/activations.py | greenmachine1902/NEAT | 0 | 12776287 | from __future__ import annotations
import random
from mattslib import math_util
__version__ = '1.4.1'
__date__ = '19/03/2022'
def getActivation(activation: str = '') -> activation_function:
"""
Returns the requested or a random activation function.
:param activation: str
:return:
... | 2.96875 | 3 |
venv/Lib/site-packages/psychopy/demos/coder/stimuli/aperture.py | mintzer/pupillometry-rf-back | 0 | 12776288 | <filename>venv/Lib/site-packages/psychopy/demos/coder/stimuli/aperture.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Demo for the class psychopy.visual.Aperture().
Draw two gabor circles, one with an irregular aperture and one with no aperture.
"""
from __future__ import division
from psychopy import visual,... | 3.21875 | 3 |
stackoverflow/question/models.py | vivekdhinoja/stackoverflow | 0 | 12776289 | <reponame>vivekdhinoja/stackoverflow<filename>stackoverflow/question/models.py
from ckeditor_uploader.fields import RichTextUploadingField
from django.conf import settings
from django.db import models
from django.urls import reverse_lazy
from django_extensions.db.models import TimeStampedModel
from taggit.managers impo... | 2.25 | 2 |
python/MarkovChain.py | alessandrobondielli/alessandrobondielli.github.com | 0 | 12776290 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy.random as random
class MarkovChain:
"""Simple Markov Chain Model.
Parameters
----------
n : int
Number of states.
p : list, len (n)
Base probabilities.
T : list of list, shape (n, n)
... | 3.21875 | 3 |
BOJ/04000~04999/4400~4499/4447.py | shinkeonkim/today-ps | 2 | 12776291 | cnt = int(input())
for i in range(cnt):
s=input()
a=s.lower()
g=a.count('g')
b=a.count('b')
print(s,"is",end=" ")
if g == b:
print("NEUTRAL")
elif g>b:
print("GOOD")
else:
print("A BADDY") | 3.59375 | 4 |
sandbox/scripts/doc_embeddings.py | GOALCLEOPATRA/MLM | 0 | 12776292 | <reponame>GOALCLEOPATRA/MLM
import torch
import flair
from flair.data import Sentence
from flair.embeddings import FlairEmbeddings, BertEmbeddings, DocumentPoolEmbeddings
# set device
torch.cuda.set_device(2)
DEVICE = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
flair.device = DEVICE
class DocEmbeddin... | 2.421875 | 2 |
helper_functions/test.py | cleveranjos/Rapid-ML-Gateway | 3 | 12776293 | <gh_stars>1-10
import python_finance as pf
def main():
tickers = ['AAPL', 'MSFT', 'NFLX', 'AMZN', 'GOOG']
tickers_b = ['DOCU', 'SHOP', 'WMT']
start = '20200101'
end = '20201007'
attrib = 'Adj Close'
#print(pf.get_tickers(tickers, start, end, attrib))
#print(pf.get_Percent_change(ticke... | 2.5625 | 3 |
game/state.py | MeinAccount/ea-snake | 0 | 12776294 | import random
from collections import deque
from typing import Tuple
from game.direction import Directions, GRID_WIDTH, GRID_HEIGHT
class GameState:
apple_pos = (0, 0)
positions = None
direction = 0
def __init__(self, start_pos: Tuple[int, int], length: int = 3) -> None:
self.length = length... | 3.546875 | 4 |
sqlite/funcs/db_creation.py | vrcunha/db_sql_and_nosql | 1 | 12776295 | import os
from dotenv import load_dotenv, find_dotenv
from sqlalchemy.sql.sqltypes import Integer, REAL, TEXT
from sqlalchemy import (create_engine, MetaData, Column, Table)
from sqlalchemy_utils import database_exists, create_database
load_dotenv(find_dotenv())
engine = create_engine(f"sqlite:///{os.getenv('SQLITE_D... | 2.515625 | 3 |
tryalgo/fenwick.py | siebenbrunner/tryalgo | 0 | 12776296 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""\
Fenwick tree
<NAME> et <NAME> - 2014-2018
"""
# snip{
class Fenwick:
"""maintains a tree to allow quick updates and queries
"""
def __init__(self, t):
"""stores a table t and allows updates and queries
of prefix sums in logarithmic time.
... | 3.515625 | 4 |
aliyun_exporter/info_provider.py | harvey-zang/aliyun-exporter | 1 | 12776297 | import json
import time
import datetime
from aliyunsdkcore.client import AcsClient
from cachetools import cached, TTLCache
from prometheus_client.metrics_core import GaugeMetricFamily
import aliyunsdkecs.request.v20140526.DescribeInstancesRequest as DescribeECS
import aliyunsdkrds.request.v20140815.DescribeDBInstance... | 1.804688 | 2 |
karmabot/settings.py | meganlkm/karmabot | 15 | 12776298 | <filename>karmabot/settings.py
# Copyright (c) 2019 Target Brands, 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 a... | 1.710938 | 2 |
ASCII_value.py | RAVURISREESAIHARIKRISHNA/Python-2.7.12-3.5.2- | 0 | 12776299 | <reponame>RAVURISREESAIHARIKRISHNA/Python-2.7.12-3.5.2-<filename>ASCII_value.py
print("Enter a character:\n")
ch=input()
while(len(ch)!=1):
print("\nShould Enter single Character...RETRY!")
ch=input()
print(ord(ch))
| 3.3125 | 3 |
nlde/query/triple_pattern.py | Lars-H/federated_crop | 3 | 12776300 | from urlparse import urlparse
from . import Argument
class TriplePattern(object):
def __init__(self, s, p, o, **kwargs):
if isinstance(s, Argument):
self.subject = s
else:
self.subject = Argument(s)
if isinstance(p, Argument):
self.predicate = p
... | 2.640625 | 3 |
src/frange.py | ttheikki2/Usadel-for-nanowires | 0 | 12776301 | import sys
def frange(start, end=None, inc=None):
"A range function, that does accept floats"
if end == None:
end = start + 0.0
start = 0.0
else: start += 0.0 # force it to be a float
if inc == None:
inc = 1.0
count = int((end - start) / inc)
if start + count * inc !=... | 3.96875 | 4 |
OpenGLCffi/GL/EXT/ARB/transform_feedback_instanced.py | cydenix/OpenGLCffi | 0 | 12776302 | <filename>OpenGLCffi/GL/EXT/ARB/transform_feedback_instanced.py
from OpenGLCffi.GL import params
@params(api='gl', prms=['mode', 'id', 'instancecount'])
def glDrawTransformFeedbackInstanced(mode, id, instancecount):
pass
@params(api='gl', prms=['mode', 'id', 'stream', 'instancecount'])
def glDrawTransformFeedbackStr... | 1.726563 | 2 |
gym-duckietown/learning/imitation/iil_dagger/algorithms/__init__.py | lyf44/CS4278-5478-Project-Materials | 4 | 12776303 | from .dagger import DAgger | 1.03125 | 1 |
starfish/pipeline/registration/fourier_shift.py | Xiaojieqiu/starfish | 1 | 12776304 | <filename>starfish/pipeline/registration/fourier_shift.py
from typing import Union
from starfish.constants import Indices
from starfish.image import ImageStack
from starfish.util.argparse import FsExistsType
from ._base import RegistrationAlgorithmBase
class FourierShiftRegistration(RegistrationAlgorithmBase):
"... | 2.546875 | 3 |
samples/models/pu_power/rx580_power_model/__init__.py | greenlsi/mercury_mso_framework | 1 | 12776305 | from .rx580_power_model import Rx580PowerModel
| 1.148438 | 1 |
green/__init__.py | TurgayPamuklu/GreenRAN | 0 | 12776306 | <reponame>TurgayPamuklu/GreenRAN
"""Deployment of Solar Panels on a Urban Area.
<NAME> <<EMAIL>>
Initial Operations for Journal 1
"""
from collections import OrderedDict
from datetime import datetime
from city import CityAfterDeployment
from city import CityBeforeDeployment
from heuristic import E
from monitor impor... | 2.375 | 2 |
setup.py | zaanposni/vvs | 13 | 12776307 | from setuptools import setup, find_packages
with open("readme.md", "r") as fh:
long_description = fh.read()
setup(
name='vvspy',
py_modules=["vvspy"],
version='1.1.3',
license='MIT',
description='API Wrapper for VVS (Verkehrsverbund Stuttgart)',
author='zaanposni',
author_email='<EMAIL>',
url='htt... | 1.367188 | 1 |
ioflo/base/__init__.py | BradyHammond/ioflo | 128 | 12776308 | <filename>ioflo/base/__init__.py
""" base package
"""
#print("Package at {0}".format(__path__[0]))
import importlib
_modules = ['globaling', 'excepting', 'interfacing',
'registering', 'storing', 'skedding',
'tasking', 'framing', 'logging', 'serving', 'monitoring',
'acting', 'poking',... | 2.34375 | 2 |
Visualizer/PureSorts/MergeSorts.py | jupiterbjy/Sorting_in_visual | 1 | 12776309 | <filename>Visualizer/PureSorts/MergeSorts.py<gh_stars>1-10
from typing import MutableSequence
import array
# TODO: check stability on this: failed stability test. on Baekjoon.
def Merge(arr: MutableSequence):
def join_parts(array_, left, right, mid):
sorted_ = array.array('i')
l_, r, m = left, rig... | 3.25 | 3 |
app.py | deutranium/wordclouds | 0 | 12776310 | <gh_stars>0
from flask import Flask, render_template, request
import pandas as pd
from PySripts.pandas_implementation import *
from PySripts.df_text import *
from PySripts.wordcloud_generator import *
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/', methods = ... | 2.78125 | 3 |
solutions/439_ternary_expression_parser.py | YiqunPeng/leetcode_pro | 0 | 12776311 | <gh_stars>0
class Solution:
def parseTernary(self, expression: str) -> str:
c, values = expression.split('?', 1)
cnt = 0
p = 0
for i in range(len(values)):
if values[i] == ':':
if cnt > 0:
cnt -= 1
else:
... | 2.84375 | 3 |
tests/run_command_test.py | m3brown/plz | 9 | 12776312 | import os
import subprocess
from unittest import skip
from unittest.mock import patch
from plz.runner import run_command
starting_dir = os.getcwd()
def test_run_command_returns_int():
# Arrange
# Act
result = run_command("echo test")
# Assert
assert type(result) == int
@patch("subprocess.che... | 2.46875 | 2 |
scripts/tutorials/generate_database.py | cfontanive/SIMPLE-db | 6 | 12776313 | <reponame>cfontanive/SIMPLE-db
# Script to generate database from JSON contents
# This gets run automatically with Github Actions
import argparse
import sys
import os
from astrodbkit2.astrodb import create_database, Database
sys.path.append(os.getcwd()) # hack to be able to discover simple
from simple.schema import *... | 3.078125 | 3 |
model/__init__.py | kaniblu/pytorch-vrae | 10 | 12776314 | import utils
from . import rnn
from . import vae
from . import common
from . import pooling
from . import manager
from . import encoder
from . import decoder
from . import nonlinear
from . import embedding
def add_arguments(parser):
ModelArgumentConstructor(parser).add_all_arguments()
class ModelArgumentConstru... | 2.265625 | 2 |
Course-Work/week_5/Money Change Again.py | TSG405/Algorithmic-Toolbox-UC-San-Diego | 1 | 12776315 | <reponame>TSG405/Algorithmic-Toolbox-UC-San-Diego
>>
import math
money = int(input())
denominations = [1, 3, 4]
minCoins = [0] + [math.inf]*money
for i in range(1, money+1):
for j in denominations:
if i>=j:
coins = minCoins[i-j]+1
if coins < minCoins[i]:
minCoins[i]... | 3.15625 | 3 |
test.py | AniruddhaGawali/Hand_Cricket | 1 | 12776316 | <filename>test.py
# Importing Tkinter module
from tkinter import *
from tkinter.ttk import *
# Creating master Tkinter window
master = Tk()
# Creating object of photoimage class
# Image should be in the same folder
# in which script is saved
p1 = PhotoImage(file = 'data/img/img1.png')
# Setting icon of master win... | 3.109375 | 3 |
inkml/references.py | Coderik/pinkml | 0 | 12776317 | <reponame>Coderik/pinkml
from typing import Mapping, Set
from . import ink, reading_types as rt
from .ids import is_local_id, to_local_id
def resolve_references(definitions: rt.Definitions, assume_local_refs):
# Resolve Brush.parentRef
ignored_ids = resolve_brush_parent_references(definitions.brushes)
if len(igno... | 2.03125 | 2 |
aws_interface/settings/base.py | hubaimaster/aws-interface | 53 | 12776318 | import json
import os
from django.utils.translation import ugettext_lazy as _
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRETS_DIR = os.path.join(BASE_DIR, 'secret')
SECRETS_BASE = os.path.join(SECRETS_DIR, 'base.json')
try:
secrets_base = json.load(open(SECRETS_BASE, 'rt'))
except ... | 1.929688 | 2 |
01_captions/utils.py | saikrishnarallabandi/compositionality-expts | 2 | 12776319 | <reponame>saikrishnarallabandi/compositionality-expts
from datetime import datetime # to get the current date and time
def log(log_message):
"""
- DOES: adds a log message "log_message" and its time stamp to a log file.
"""
# open the log file and make sure that it's closed properly at the end of the... | 3.546875 | 4 |
tests/platform_tests/test_killed_pid.py | noahspurrier/pexpect | 8 | 12776320 | <filename>tests/platform_tests/test_killed_pid.py
#!/usr/bin/env python
import os, time, signal
import expyct
e = expyct.expyct ('/bin/sh', '-i')
print 'pid,fd:', e.pid, e.fd
print 'isAlive:', e.isAlive()
# Treat it brusquely.
print 'sending SIGKILL...'
os.kill (e.pid, signal.SIGKILL)
time.sleep (1)
print os.read(e.fd... | 1.992188 | 2 |
ADContentViewer.py | Ping-P0ng/ADContentViewer | 0 | 12776321 | import tornado.ioloop
import tornado.web
import os
import sqlite3
import json
import re
import argparse
import sys
MainPageStart = """<html><head>
<title>ADContentViewer</title>
</head>
<body>
<div style="display: flex;height: 100%;width: 100%;">
<div style="float: left;
width: 60px;
background-color: mediumb... | 2.40625 | 2 |
app/urls.py | B-ROY/TESTGIT | 2 | 12776322 | # -*- coding: utf-8 -*-
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
from django.conf.urls.static import static
from django.conf import settings
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', ... | 1.882813 | 2 |
mmseg/utils/inverted_residual_module.py | HusterRC/mmsegmentation | 2 | 12776323 | from mmcv.cnn import ConvModule, build_norm_layer
from torch import nn
class InvertedResidual(nn.Module):
"""Inverted residual module.
Args:
in_channels (int): The input channels of the InvertedResidual block.
out_channels (int): The output channels of the InvertedResidual block.
stri... | 2.9375 | 3 |
nltk_download.py | anasayubi/implement_timmonsr-kylee84_research_paper | 0 | 12776324 | from nltk import download
download() | 1.039063 | 1 |
051 - 100/ex078.py | SocrammBR/Desafios-Python-CursoEmVideo | 0 | 12776325 | <reponame>SocrammBR/Desafios-Python-CursoEmVideo
lista = []
for c in range(0, 5):
lista.append(int(input(f'Digite um valor para a posição {c}: ')))
print('=-=' * 10)
print(f'Você digitou os valores {lista}')
print(f'O maior valor digitado é o {max(lista)} e ele está na posição {lista.index(max(lista))}')
print(f'O... | 3.609375 | 4 |
evaluation/plot_mr-qr.py | cragkhit/elasticsearch | 23 | 12776326 | import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
df = pd.DataFrame({'Group': ['A', 'A', 'A', 'B', 'C', 'B', 'B', 'C', 'A', 'C'],
'Apple': np.random.rand(10),'Orange': np.random.rand(10)})
# df = df[['Group','Apple','Orange']]
dd = pd.melt(df, id_vars=['Gr... | 3.515625 | 4 |
pisces/util.py | omarmarcillo/piscesWIN | 0 | 12776327 | <filename>pisces/util.py<gh_stars>0
import logging
import math
from getpass import getpass
import numpy as np
import sqlalchemy as sa
from sqlalchemy.orm import Session
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.exc import NoSuchTableError, IntegrityError, OperationalError
from sqlalchemy.... | 2.65625 | 3 |
removeKthNodeFromEnd.py | rramnani/LeetCode | 0 | 12776328 | def removeKthNodeFromEnd(head, k):
# Write your code here.
#length = len(head)
counter = 1
first = head
second = head
while counter <= k:
second = second.next
counter+=1
if second is None: # second is pointing to None => First is at the head of linked list
head.value = head.next.value
head.next = h... | 3.859375 | 4 |
src/hjerter/algorithms/hafm.py | chingyulin/ml_numpy | 0 | 12776329 | <filename>src/hjerter/algorithms/hafm.py
import numpy as np
p0 = np.array([1, 8])
p1 = np.array([7, 3])
line_a = np.stack([p0, p1])
q = np.array([3, 2])
v = p1 - p0
u = q - p0
def find_angle(v1, v2):
return np.arccos(np.sum(v1 * v2) / np.sqrt(np.sum(v1 ** 2) * np.sum(v2 ** 2)))
theta_0 = find_angle(u, v)
the... | 3.203125 | 3 |
tests/test_tricks.py | phipleg/trafaret-config | 26 | 12776330 | <reponame>phipleg/trafaret-config<filename>tests/test_tricks.py
import unittest
from collections import OrderedDict
from textwrap import dedent
import trafaret as T
from .util import get_err
class TestCall(unittest.TestCase):
TRAFARET = T.Dict({
T.Key("call_dict", optional=True):
# The foll... | 2.75 | 3 |
archives/02/tootle/utils.py | asmodehn/caerbannog | 1 | 12776331 |
import enum
# Directly, naively, modeled in python 3.6
# from the code shown in : https://www.youtube.com/watch?v=AG3KuqDbmhM
# Side Note: Yes, Python has enums !
class PenState(enum.Enum):
UP = -1
DOWN = 1
| 3.15625 | 3 |
main.py | adamd1985/random-streamers | 0 | 12776332 | from flask import (
Flask,
render_template,
Response,
stream_with_context,
send_from_directory,
)
from flask_cors import CORS
import os
import random
import json
import string
from time import sleep
from datetime import datetime, date, timedelta
def random_date(year_start=2000, year_end=2005):
... | 2.9375 | 3 |
{{cookiecutter.github_repository_name}}/{{cookiecutter.app_name}}/apps/common/views.py | powerdefy/cookiecutter-django-rest | 0 | 12776333 | <gh_stars>0
import asyncio
from django.db import transaction
from django.utils.decorators import classonlymethod, method_decorator
from django.views import View
@method_decorator(transaction.non_atomic_requests, name='dispatch')
class AsyncView(View):
@classonlymethod
def as_view(cls, **initkwargs):
... | 2.1875 | 2 |
gelada_tests.py | marcysweber/lifetime-repro-success | 0 | 12776334 | import unittest
from agent import *
from completesimulation import HamadryasSim, HamaPopulation, GeladaSim, GelPopulation
from dispersal import HamadryasDispersal, GeladaDispersal
from group import HamadryasGroup, GeladaGroup
from seedgroups import HamadryasSeed, GeladaSeed
class DispersalTests(unittest.TestCase):
... | 2.5 | 2 |
Ch9/fillTheGaps.py | AdamPellot/AutomateTheBoringStuffProjects | 0 | 12776335 | #! python3
# fillTheGaps.py - Finds all files with a given prefix, such as
# spam001.txt, spam002.txt, and so on, in a single
# folder and locates any gaps in the numbering. Have
# the program rename all the later files to close this
# gap.
# <NAME>
i... | 4.15625 | 4 |
HayStack_Client/Inbox_Module.py | ConsensusGroup/Haystack | 1 | 12776336 | <reponame>ConsensusGroup/Haystack
####################################################################################
############## This module is used to handle the inbox of the client ###############
####################################################################################
from User_Modules import Initi... | 1.929688 | 2 |
rcmd/__init__.py | sysr-q/rcmd.py | 1 | 12776337 | # -*- coding: utf-8 -*-
from __future__ import print_function
import collections
import functools
import inspect
import string
import sys
import re
import rcmd.parser
__all__ = ("Rcmd",)
__version__ = "1.1.1"
PROMPT = "(Rcmd) "
PY2 = sys.version_info[0] == 2
DEFAULT_PARSER = rcmd.parser.Regex
class OrderedDefaultDi... | 2.3125 | 2 |
src/438-find_all_anagram_substring.py | dennislblog/coding | 0 | 12776338 | class Solution:
def findAnagrams(self, s: str, p: str) -> List[int]:
# just use a sliding window
np, ns = len(p), len(s)
res = []
if np > ns: return []
map_ = [0] * 26
for i,x in enumerate(p):
map_[ord(x) - 97] -= 1
map_[ord(s[i])-97]... | 2.671875 | 3 |
tools/writeBurlyWeights.py | fsanges/glTools | 165 | 12776339 | import maya.mel as mm
import maya.cmds as mc
import maya.OpenMaya as OpenMaya
import glTools.utils.base
import glTools.utils.mesh
import glTools.utils.skinCluster
import os.path
def writeBurlyWeights(mesh,skinCluster,influence,filePath):
'''
'''
# Get basic procedure information
burly = 'dnBurlyDeformer1'
vtxCo... | 1.898438 | 2 |
awslogs_watch/lib/execute.py | deresmos/awslogs-watch | 3 | 12776340 | import shlex
import sys
from subprocess import PIPE, Popen
from typing import List
class Executer:
SUCCESS = 0
ERROR = 1
@staticmethod
def run(command: str) -> None:
p = Popen(shlex.split(command))
print(f"-> {command}")
p.communicate()
if p.returncode == Executer.ERRO... | 2.890625 | 3 |
daily-problems/Day3/problem3.py | jeffreycshelton/ghp-challenges | 0 | 12776341 | <filename>daily-problems/Day3/problem3.py<gh_stars>0
'''
An N x N board contains only 0s and 1s. In each move, you can swap any 2 rows with each other, or any 2 columns with each other.
What is the minimum number of moves to transform the board into a "chessboard" - a board where no 0s and no 1s are 4-directionally
a... | 4.0625 | 4 |
lemon_markets/account.py | Fadope1/lemon-markets-python-sdk | 16 | 12776342 | <gh_stars>10-100
from typing import Union
from lemon_markets.common.helpers import UUIDObjectMixin
from lemon_markets.common.objects import AbstractApiObjectMixin, ListMixin, ListIterator
from lemon_markets.common.requests import ApiRequest
class AccountState:
uuid: str
_token: str
_cash_to_invest: float... | 2.71875 | 3 |
analysis/explainshell/manager.py | lizhi16/dockerfile_analysis_framework | 3 | 12776343 | import sys, os, argparse, logging, glob
from explainshell import options, store, fixer, manpage, errors, util, config
from explainshell.algo import classifier
logger = logging.getLogger('explainshell.manager')
class managerctx(object):
def __init__(self, classifier, store, manpage):
self.classifier = cla... | 2.640625 | 3 |
models/tests/test_utils.py | WangYuNeng/EvolutionaryGAN-pytorch | 0 | 12776344 | from unittest import TestCase
import torch
from models.utils import combine_mapping_networks, categorize_mappings
from models.networks.fc import FCGenerator
class UtilTests(TestCase):
def setUp(self) -> None:
self.state_dicts = [FCGenerator().state_dict() for _ in range(5)]
self.mappings = [tor... | 2.453125 | 2 |
cpu/test_center.py | xavierboud/tictactoe | 0 | 12776345 | from django.test import SimpleTestCase
from cpu.center import Center
from game.transforms import Board
class CenterAiTest(SimpleTestCase):
def test_picks_center(self):
data = [' '] * 9
cpu = Center()
move = cpu.play(Board(data), 'x', 'o')
self.assertEquals(move, 4)
def test_... | 2.546875 | 3 |
13_baseline_interface.py | saikrishnar/TTS_Interface | 0 | 12776346 | <reponame>saikrishnar/TTS_Interface<filename>13_baseline_interface.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
ZetCode PyQt4 tutorial
In this example, we receive data from
a QtGui.QInputDialog dialog.
author: <NAME>
website: zetcode.com
last edited: October 2011
"""
import sys, os
from PyQt4 import QtGui
fr... | 2.671875 | 3 |
test/test_dummy.py | darnir/firefly-cli | 13 | 12776347 | import unittest
class TestCase(unittest.TestCase):
def test_dummy(self):
self.assertEqual('tests to be added', 'tests to be added')
if __name__ == '__main__':
unittest.main()
| 2.53125 | 3 |
academics/models.py | judeakinwale/SMS-backup | 0 | 12776348 | from django.db import models
from django.conf import settings
from django.utils.translation import gettext_lazy as _
from datetime import datetime
# Create your models here.
class Faculty(models.Model):
"""Model definition for Faculty."""
name = models.CharField(max_length=250, unique=True)
code = model... | 2.59375 | 3 |
src/python/fibonacci.py | allenjzhang/playground | 1 | 12776349 | memMap = {}
def fibonacci (n):
if (n not in memMap):
if n <= 0:
print("Invalid input")
elif n == 1:
memMap[n] = 0
elif n == 2:
memMap[n] = 1
else:
memMap[n] = fibonacci (n-1) + fibonacci (n-2)
return memMap[n]
def fibonacciSlow (n):
if n <= 0:
print("Invalid inpu... | 4.03125 | 4 |
yogadl/_core.py | aaron276h/YogaDL | 74 | 12776350 | <reponame>aaron276h/YogaDL
# Copyright 2020 Determined AI. 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 r... | 1.929688 | 2 |