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 |
|---|---|---|---|---|---|---|
models.py | unt-libraries/serial-set-inventory | 0 | 12779851 | <gh_stars>0
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table
... | 2.046875 | 2 |
VectorMessenger/MessengerCore/MessengerBase.py | VectorMessenger/VectorMessenger_Zero | 0 | 12779852 | import socket
class VMUDPBase:
def __init__(self):
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.sock.settimeout(2.0)
| 2.25 | 2 |
inventory/locations/migrations/0002_auto_20170610_1325.py | cnobile2012/inventory | 10 | 12779853 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-10 17:25
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('locations', '0001_initial'),
]
operations = [
migrations.AlterField(
... | 1.882813 | 2 |
library/pimoroni_physical_feather_pins/nRF52840.py | dglaude/physical_feather_pins | 2 | 12779854 | <reponame>dglaude/physical_feather_pins<filename>library/pimoroni_physical_feather_pins/nRF52840.py
from . import pin_error
import microcontroller
def pin3():
return microcontroller.pin.P0_31
def pin5():
return microcontroller.pin.P0_04
def pin6():
return microcontroller.pin.P0_05
def pin7():
return... | 2.21875 | 2 |
src/visualizations/images.py | MatanDanos/AttnGAN-v1.1 | 2 | 12779855 | # This file will implement images
import os
from skimage.io import imsave
def visualize_image(image, image_name):
"""Given an image, will save the image to the figures directory
Parameters:
image: a [N,M,3] tensor
filename (str): name of the image
"""
image_path = os.path.join("../fi... | 3.234375 | 3 |
point/make_npz_for_chainercv_upload.py | yuyu2172/coco-evaluation | 1 | 12779856 | import pickle
import numpy as np
with open('data/fake.pkl', 'rb') as f:
points, labels, scores, keys = pickle.load(f)
with open('data/fake_gt.pkl', 'rb') as f:
gt_points, gt_bboxes, gt_labels, gt_areas, gt_crowdeds = pickle.load(f)
gt_points_yx = []
gt_point_is_valids = []
for gt_point in gt_points:
gt_... | 2.328125 | 2 |
live-coding/L03/line_intersection.py | patricklam/stqam-2017 | 30 | 12779857 | <gh_stars>10-100
class LineSegment:
def __init__(self, x1, x2):
self.x1 = x1; self.x2 = x2;
# this code was found by <NAME> on stackoverflow:
# http://stackoverflow.com/questions/306316/determine-if-two-rectangles-overlap-each-other?rq=1
def intersect(a, b):
return (a.x1 < b.x2) & (a.x2 > b.x1);
| 2.8125 | 3 |
guillotina_client/tests/conftest.py | guillotinaweb/guillotina_client | 0 | 12779858 | # -*- coding: utf-8 -*-
pytest_plugins = [
'guillotina_client.tests.fixtures',
'guillotina.tests.fixtures',
]
| 0.992188 | 1 |
docs/examples/container/joyent/instantiate_driver.py | rgharris/libcloud | 0 | 12779859 | <gh_stars>0
from libcloud.container.types import Provider
from libcloud.container.providers import get_driver
cls = get_driver(Provider.JOYENT)
conn = cls(
host="us-east-1.docker.joyent.com",
port=2376,
key_file="key.pem",
cert_file="~/.sdc/docker/admin/ca.pem",
)
conn.list_images()
| 1.640625 | 2 |
modules/ravestate/testfixtures.py | Roboy/diact | 28 | 12779860 | import pytest
from reggol import strip_prefix
from testfixtures import LogCapture
from ravestate import *
DEFAULT_MODULE_NAME = 'module'
DEFAULT_PROPERTY_NAME = 'property'
DEFAULT_PROPERTY_ID = f"{DEFAULT_MODULE_NAME}:{DEFAULT_PROPERTY_NAME}"
DEFAULT_PROPERTY_VALUE = 'Kruder'
DEFAULT_PROPERTY_CHANGED = f"{DEFAULT_PR... | 2.015625 | 2 |
py_local_maxima/cpu.py | benhollar/py-local-maxima | 0 | 12779861 | from scipy.ndimage.filters import maximum_filter as _max_filter
from scipy.ndimage.morphology import binary_erosion as _binary_erosion
from skimage.feature import peak_local_max
def detect_skimage(image, neighborhood, threshold=1e-12):
"""Detect peaks using a local maximum filter (via skimage)
Parameters
... | 3.359375 | 3 |
eval_synthesis_quality.py | CJWBW/image2video-synthesis-using-cINNs | 85 | 12779862 | <gh_stars>10-100
import argparse, os, torch, random
from tqdm import tqdm
import lpips, numpy as np
from data.get_dataloder import get_eval_loader
from get_model import Model
from metrics.FVD.evaluate_FVD import compute_fvd
from metrics.FID.FID_Score import calculate_FID
from metrics.FID.inception import InceptionV3
f... | 1.9375 | 2 |
uptick/markets.py | chainsquad/uptick | 35 | 12779863 | <gh_stars>10-100
import click
from click_datetime import Datetime
from datetime import datetime, timedelta
from bitshares.market import Market
from bitshares.amount import Amount
from bitshares.account import Account
from bitshares.price import Price, Order
from .decorators import onlineChain, unlockWallet, online, unl... | 2.46875 | 2 |
python/merge_files.py | caleberi/LeetCode | 1 | 12779864 | <reponame>caleberi/LeetCode
# Objective
# Merge a set of sorted files of different length into a single sorted file.
# We need to find an optimal solution, where the resultant file will be generated in minimum time.
# Approach
# If the number of sorted files are given, there are many ways to merge them into a single s... | 3.921875 | 4 |
test/automation/automate.py | agupta54/ulca | 3 | 12779865 | <filename>test/automation/automate.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 4 17:35:27 2021.
@author: dhiru579 @ Tarento
"""
import os
from argparse import ArgumentParser
import config
import driver_script
from core import core_all as core
from test import test_all as test
from datase... | 2.125 | 2 |
model.py | RSMagneto/MSIT | 1 | 12779866 | <filename>model.py
import torch
import torch.nn as nn
import torch.nn.functional as F
from einops import rearrange
from CT import CT
class BasicConv2d(nn.Module):
def __init__(self, in_planes, out_planes, kernel_size=3, stride=1, padding=0, dilation=1, isrelu=True):
super(BasicConv2d, self).__ini... | 2.5625 | 3 |
tasks/snli/third_party/datasets/__init__.py | etri-edgeai/nn-comp-discblock | 10 | 12779867 | <filename>tasks/snli/third_party/datasets/__init__.py
from .snli import *
from .multinli import * | 1.039063 | 1 |
source/campo/op_fieldagents/__init__.py | computationalgeography/campo | 2 | 12779868 | <reponame>computationalgeography/campo<gh_stars>1-10
from .operators import *
from .operations import *
| 1.0625 | 1 |
make_encode_sets.py | akiss77/rust-url | 0 | 12779869 | # Copyright 2013-2014 <NAME>.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those ... | 1.992188 | 2 |
src/test/latency/hosts/broker.py | acatalfano/distributed-systems-assignment-1 | 0 | 12779870 | <reponame>acatalfano/distributed-systems-assignment-1<filename>src/test/latency/hosts/broker.py
from app import BrokerFactory
def __main__() -> None:
factory = BrokerFactory()
factory.build_broker()
if __name__ == '__main__':
__main__()
| 1.578125 | 2 |
binary_insertion_sort.py | Vassago55/normal_sort | 0 | 12779871 | # -*- coding: utf-8 -*-
import random
"""
折半插入排序 O(n) = n^2
"""
class BinaryInsertion(object):
def __init__(self, original_list):
self.original_list = original_list
def sort(self):
length = len(self.original_list)
for i in range(1, length):
self.binary(start=0, end=i-1, cu... | 3.921875 | 4 |
statsmodels/datasets/sunspots/data.py | yarikoptic/statsmodels | 34 | 12779872 | <reponame>yarikoptic/statsmodels<filename>statsmodels/datasets/sunspots/data.py
"""Yearly sunspots data 1700-2008"""
__docformat__ = 'restructuredtext'
COPYRIGHT = """This data is public domain."""
TITLE = __doc__
SOURCE = """
http://www.ngdc.noaa.gov/stp/solar/solarda3.html
The original dataset contain... | 2.78125 | 3 |
loggerBot/common/utils.py | mcpiroman/jarchiwum-server | 0 | 12779873 | <reponame>mcpiroman/jarchiwum-server<filename>loggerBot/common/utils.py
import base64
import datetime
import re
import os
def print_with_time(*args):
print('[' + datetime.datetime.now().strftime("%H:%M:%S") + ']', *args)
def str_2_base64(data, encoding="utf-8"):
return str(base64.b64encode(data.encode(encodin... | 2.5625 | 3 |
snippets/myfft_plot.py | rhishi/python-snippets | 0 | 12779874 | <reponame>rhishi/python-snippets
import myfft
import matplotlib.pyplot as plt
import matplotlib.pylab as pl
N = 1024
nseries = range(0, 1024)
x = range(0, 1024)
X = myfft.fft(x)
absX = [ abs(v) for v in X ]
#plt.plot(nseries, x, nseries, absX)
#plt.savefig('myfftplot01.png', format='png')
x = [ 1 if... | 2.71875 | 3 |
ikdisplay/test/__init__.py | ralphm/ikdisplay | 2 | 12779875 | """
Tests for L{ikdisplay}.
"""
| 0.933594 | 1 |
models.py | AbigailMathews/concentration | 0 | 12779876 | """models.py - Contains class definitions for Datastore entities
used by the Concentration Game API. Definitions for User, Game, and
Score classes, with associated methods. Additionally, contains
definitions for Forms used in transmitting messages to users."""
### Imports
import random
import pickle
from datetime im... | 3.171875 | 3 |
examples/apps/kinesis-analytics-process-kpl-record/aws_kinesis_agg/__init__.py | eugeniosu/serverless-application-model | 326 | 12779877 | #Kinesis Aggregation/Deaggregation Libraries for Python
#
#Copyright 2014, Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
#Licensed under the Amazon Software License (the "License").
#You may not use this file except in compliance with the License.
#A copy of the License is located at
#
# http://aws.amazon... | 1.359375 | 1 |
py_neo4j_migrations/main.py | matt-l-w/py_neo4j_migrations | 0 | 12779878 | <gh_stars>0
import typer
app = typer.Typer()
from . import database as db
@app.command()
def migrate():
def get_migrations(tx):
return tx.run("""
MATCH (m:MIGRATION) RETURN m ORDER BY m.created_at ASC;
""")
results = db.read(get_migrations)
typer.echo(f"{[result for result in results]}")
if __... | 2.390625 | 2 |
Scripts/codewars8.py | mateusvarelo/Codewars | 0 | 12779879 | def to_weird_case(string='This is a test'):
nova_string = [let.upper() if i % 2 == 0 else let.lower()
for i,let in enumerate(string)
]
print(nova_string)
return ''.join(nova_string)
print(to_weird_case()) | 3.890625 | 4 |
up.py | Chupachu/LocMaker | 0 | 12779880 | import os
import sys
import shutil
from io import BytesIO
from functools import wraps
from textwrap import dedent
from random import choice, shuffle
from collections import defaultdict
import urllib.request
required = ["locmaker.py","locmaker_README.txt","Run.cmd"]
for item in required:
print('Downloading '+ite... | 2.703125 | 3 |
voxel/VoxelLogic.py | vincentlooi/alpha_zero | 0 | 12779881 | <gh_stars>0
import numpy as np
import random
class BoxListGenerator(object):
def __init__(self, min_x=1, max_x=1, min_y=1, max_y=1, min_z=1, max_z=1):
assert max_x >= min_x > 0 and max_y >= min_y > 0 and max_z >= min_z > 0
self.min_x = min_x
self.min_y = min_y
self.min_z = min_z
... | 3.140625 | 3 |
RcTorch/old_backprop_code.py | blindedjoy/RcTorch | 3 | 12779882 | else:
#+++++++++++++++++++++++++++++++ backprop +++++++++++++++++++++++++++++++
trainable_parameters = []
trainable_parameters = []
for p in self.parameters():
if p.requires_grad:
trainable_parameters.append(p)
... | 2.109375 | 2 |
tests/test_run.py | SOFIE-project/Provisioning-and-Discovery | 1 | 12779883 | <reponame>SOFIE-project/Provisioning-and-Discovery
"""
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed
# with this work for additional information regarding copyright
# ownership. The ASF licenses this file to you under the Apache
... | 1.984375 | 2 |
Crawler/src/parser/test_parser.py | cam626/RPEye-Link-Analysis | 2 | 12779884 | '''
This contains tests for the parse and get_bad_paths methods.
'''
import unittest
import parser
class TestParser(unittest.TestCase):
'''
This contains tests for the parse and get_bad_paths methods.
'''
def test_empty(self):
''' Parse an empty string.'''
self.assertEqual(par... | 3.4375 | 3 |
project/timenow.py | tarabuk1n/Debian-Miniconda-Installation | 1 | 12779885 | from datetime import datetime
time_now = datetime.now()
print(time_now.strftime('%B/%d/%Y:%H/%M')) | 3.328125 | 3 |
PyCTBN/PyCTBN/utility/json_importer.py | pietroepis/PyCTBN | 1 | 12779886 | <reponame>pietroepis/PyCTBN
# License: MIT License
import json
import typing
import pandas as pd
from .abstract_importer import AbstractImporter
class JsonImporter(AbstractImporter):
"""Implements the abstracts methods of AbstractImporter and adds all the necessary methods to process and prepare
the data... | 2.921875 | 3 |
tests/test_tools.py | gothill/python-fedex | 100 | 12779887 | """
Test module for the Fedex Tools.
"""
import unittest
import logging
import sys
sys.path.insert(0, '..')
import fedex.config
import fedex.services.ship_service as service # Any request object will do.
import fedex.tools.conversion
logging.getLogger('suds').setLevel(logging.ERROR)
logging.getLogger('fedex').setL... | 2.828125 | 3 |
binner/algo_single.py | Zbooni/binner | 29 | 12779888 | from .algo import Algo
from .algo_code import AlgoCode
from .entity_slot import Slot
from .entity_space import Space
from . import log, show_adding_box_log
from .exception import DistributionException
import time
class AlgoSingle(Algo):
"""
pack items into a single
bin
for single bin packing we merely
need ... | 2.8125 | 3 |
demos.py | tacticsiege/Banana-DQN | 0 | 12779889 | import numpy as np
import time
from unityagents import UnityEnvironment
from agent_utils import env_initialize, env_reset, state_reward_done_unpack
from dqn_agent import DQN_Agent
from agent_utils import load_dqn
from agent_utils import load_params, load_weights
def demo_agent(env, agent, n_episodes, epsilon=0.05, ... | 2.21875 | 2 |
BlenderMalt/MaltPipeline.py | BlenderAddonsArchive/Malt | 0 | 12779890 | # Copyright (c) 2020 BlenderNPR and contributors. MIT license.
import os, time
import bpy
from BlenderMalt import MaltMaterial, MaltMeshes, MaltTextures
__BRIDGE = None
__PIPELINE_PARAMETERS = None
__INITIALIZED = False
TIMESTAMP = time.time()
def get_bridge(world=None):
global __BRIDGE
bridge = __BRIDGE
... | 2.140625 | 2 |
portal/migrations/0007_project_access_personnel.py | eugenechia95/Project-Document-Submission-Portal | 1 | 12779891 | <reponame>eugenechia95/Project-Document-Submission-Portal<filename>portal/migrations/0007_project_access_personnel.py
# Generated by Django 2.0.7 on 2018-08-08 03:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('auth', '0009_alter_user_last_name_max_l... | 1.609375 | 2 |
loggen.py | rockb1017/log-generator | 2 | 12779892 | import os
from time import sleep
from datetime import datetime
MESSAGE_COUNT = int(os.getenv("MESSAGE_COUNT", 10000))
SIZE = int(os.getenv("SIZE", 128))
FREQ = float(os.getenv("FREQ", "1"))
MESSAGE_COUNT = max(MESSAGE_COUNT, 5)
MY_HOST = os.getenv("MY_HOST", os.uname()[1])
def print_beginning():
print("---begin... | 2.921875 | 3 |
tests/test_discretize.py | Arzik1987/wittgenstein | 64 | 12779893 | <filename>tests/test_discretize.py
import pandas as pd
import pytest
from wittgenstein.discretize import BinTransformer
def test_bin_ranges_are_flush():
df = pd.read_csv("credit.csv")
bin_transformer_ = BinTransformer()
bin_transformer_.fit(df)
for feat, bins in bin_transformer_.bins_.items():
... | 2.65625 | 3 |
geocoder/geolytica.py | termim/geocoder | 1,506 | 12779894 | #!/usr/bin/python
# coding: utf8
from __future__ import absolute_import
import logging
from geocoder.base import OneResult, MultipleResultsQuery
class GeolyticaResult(OneResult):
def __init__(self, json_content):
# create safe shortcuts
self._standard = json_content.get('standard', {})
... | 2.40625 | 2 |
src/main/python/test_support/testconfig.py | shuangshuangwang/SMV | 0 | 12779895 | <gh_stars>0
#
# This file is licensed under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | 1.96875 | 2 |
pydgn/data/util.py | terragord7/PyDGN | 1 | 12779896 | <reponame>terragord7/PyDGN<gh_stars>1-10
import inspect
import os
import os.path as osp
import warnings
from typing import Optional, Callable
import torch
from torch_geometric.transforms import Compose
from pydgn.data.dataset import DatasetInterface
from pydgn.experiment.util import s2c
def get_or_create_dir(path: ... | 2.515625 | 3 |
scripts/create_model_structure.py | christophstach/htw-icw1-implementation | 0 | 12779897 | <reponame>christophstach/htw-icw1-implementation
from discrimnator import Discriminator
from generator import Generator
latent_dimension = 128
image_size = 64
image_channels = 3
generator = Generator(1, image_channels, latent_dimension)
discriminator = Discriminator(1, image_channels)
print(generator)
print(discrimi... | 2.15625 | 2 |
src/QTableWidget/tablewidget.py | Subdue0/pyqt5-demo | 0 | 12779898 | <filename>src/QTableWidget/tablewidget.py
import sys
from PyQt5 import QtCore, QtGui
from PyQt5.QtWidgets import *
from FormPageBar.form_page_bar import FormPageBar
from FormPageBar.ui_form_page_bar import Ui_FormPageBar
class TableWidget(QTableWidget):
def __init__(self, parent=None):
super(TableWidget, self)._... | 2.109375 | 2 |
streamlit_app.py | CMU-IDS-2022/assignment-2-the-entertainers | 0 | 12779899 | <filename>streamlit_app.py
# important libraries
import streamlit as st
import pandas as pd
import altair as alt
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import matplotlib
# Use the full page instead of a narrow central column
st.set_page_config(layout="wide")
# title of application
st... | 4.03125 | 4 |
instructors/course-2015/errors_and_introspection/examples/exception0.py | mgadagin/PythonClass | 46 | 12779900 | <filename>instructors/course-2015/errors_and_introspection/examples/exception0.py
"""
Course: Exceptions
Topic: View an exception
Summary: What happens if there is an exception? What do we see?
Takeaways: raising an exception -> happens automatically if not handled.
"""
if __name__ == '__main__':
""" Catch an I... | 4.09375 | 4 |
libs/qncloud.py | sh-Joshua-python/swiper | 0 | 12779901 | from urllib.parse import urljoin
from qiniu import Auth,put_file
from swiper import config
def qn_upload(filename,filepath):
'''将文件上传至七牛云'''
#构建鉴权对象
qn = Auth(config.QN_ACCESS_KEY,config.QN_SECRET_KEY)
#生产上传 Token,有效期为1小时
token = qn.upload_token(config.QN_BUCKET,filename,3600)
#上传文件
ret,i... | 2.328125 | 2 |
src/ks33requests/schemas/s3_sub.py | tanbro/ks33requests | 1 | 12779902 | #!/usr/bin/env python
#
# Generated Mon Jun 10 11:49:52 2019 by generateDS.py version 2.32.0.
# Python 3.6.7 (default, Oct 22 2018, 11:32:17) [GCC 8.2.0]
#
# Command line options:
# ('-f', '')
# ('-o', 's3_api.py')
# ('-s', 's3_sub.py')
# ('--super', 's3_api')
#
# Command line arguments:
# schemas/AmazonS3.... | 2.09375 | 2 |
aiakos/__main__.py | aiakos/aiakos | 4 | 12779903 | <reponame>aiakos/aiakos
#!/usr/bin/env python
import os
import sys
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "aiakos.settings")
from django.core.management import execute_from_command_line # isort:skip
execute_from_command_line(sys.argv)
| 1.289063 | 1 |
lib/googlecloudsdk/core/cli.py | IsaacHuang/google-cloud-sdk | 0 | 12779904 | # Copyright 2013 Google Inc. All Rights Reserved.
"""A module to make it easy to set up and run CLIs in the Cloud SDK."""
import os.path
import subprocess
import sys
import httplib2
from oauth2client import client
from googlecloudsdk.calliope import cli as calliope
from googlecloudsdk.core import config
from googl... | 2.46875 | 2 |
aicsimage/processing/flip.py | HelmholtzAI-Consultants-Munich/pytorch_fnet | 16 | 12779905 | <filename>aicsimage/processing/flip.py
# Author: <NAME> <<EMAIL>>
import numpy as np
from scipy.ndimage.measurements import center_of_mass
def get_flips(img, sec, axes=(-3, -2, -1)):
"""
Calculates which axes to flip in order to have the center of mass of the image
be located in the desired sector. Meant ... | 3.65625 | 4 |
tests/test_global_torque_driven_with_contact_ocp.py | Steakkk/bioptim-1 | 0 | 12779906 | <reponame>Steakkk/bioptim-1
"""
Test for file IO.
It tests the results of an optimal control problem with torque_driven_with_contact problem type regarding the proper functioning of :
- the maximize/minimize_predicted_height_CoM objective
- the contact_forces_inequality constraint
- the non_slipping constraint
"""
impo... | 2.453125 | 2 |
rostran/core/outputs.py | aliyun/alibabacloud-ros-tool-transformer | 9 | 12779907 | from .exceptions import InvalidTemplateOutput
class Output:
TYPES = (STRING, NUMBER, LIST, MAP, BOOLEAN) = (
"String",
"Number",
"CommaDelimitedList",
"Json",
"Boolean",
)
def __init__(self, name, value, description=None, condition=None):
self.name = name
... | 2.890625 | 3 |
gccaps/config/prediction.py | turab95/gccaps | 15 | 12779908 | prediction_epochs = 'val_f1_score'
"""Specification for which models (epochs) to select for prediction.
Either a list of epoch numbers or a string specifying how to select the
epochs. The valid string values are ``'val_acc'`` and ``'val_eer'``.
"""
at_threshold = 0.35
"""number: Number for thresholding audio tagging ... | 1.71875 | 2 |
Day 55 - Higher Lower Flask Game/server.py | atulmkamble/100DaysOfCode | 2 | 12779909 | <reponame>atulmkamble/100DaysOfCode<gh_stars>1-10
from flask import Flask
from random import randint
app = Flask(__name__)
guess = randint(0, 9)
@app.route('/')
def guess_number():
return '<h1>Guess a number between 0 and 9</h1>' \
'<img src="https://media.giphy.com/media/3o7aCSPqXE5C6T8tBC/giphy.gif... | 3.21875 | 3 |
mlutils/pt/modules.py | linshaoxin-maker/taas | 4 | 12779910 | from os import path
import numpy as np
from torch import nn
import torch
def get_embedding(embedding_path=None,
embedding_np=None,
num_embeddings=0, embedding_dim=0, freeze=True, **kargs):
"""Create embedding from:
1. saved numpy vocab array, embedding_path, freeze
2. n... | 2.5 | 2 |
usaspending_api/search/v2/urls_search.py | animatecitizen/usaspending-api | 0 | 12779911 | <reponame>animatecitizen/usaspending-api<filename>usaspending_api/search/v2/urls_search.py
from django.conf.urls import url
from usaspending_api.search.v2.views import search
from usaspending_api.search.v2.views.spending_by_category import SpendingByCategoryVisualizationViewSet
urlpatterns = [
url(r'^spending_over... | 1.648438 | 2 |
Amiga/loadseg.py | thanasisk/binja-amiga | 5 | 12779912 | # coding=utf-8
"""
Copyright (c) 2021 <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, merge, publish, dist... | 2.234375 | 2 |
pddm/envs/fetch/__init__.py | Ray006/PDDM_FetchEnv | 0 | 12779913 | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 1.71875 | 2 |
inconsistent_system_solver.py | AntonBazdyrev/SystemAnalysis_Lab2 | 0 | 12779914 | <reponame>AntonBazdyrev/SystemAnalysis_Lab2
from numpy import linalg
import numpy as np
class InconsistentSystemSolver:
def __init__(self, method='conjugate'):
self.method = method if method in ['lstsq', 'conjugate'] else 'conjugate'
def conjugate_grad(self, A, b, x=None, eps=1e-5):
"""
... | 3.078125 | 3 |
JSONtemplate.py | JacobParrott/OccultationProfiler | 4 | 12779915 | #FORM A TEMPLATE JSON FILE
# Profile begining
JSONstart = '''
{
"version": "1.0",
"name": "Occultation Profile",
"items": [
'''
# empty string required to grow from
JSONiterated = ''
# this one has the comma on it. lenght of profile adjust the iteration count of this
JSONiterable = '''
{
"name": "Profile Iter... | 2.28125 | 2 |
modules/lastline.py | nidsche/viper | 0 | 12779916 |
lastlineKEY = ""
lastlineTOKEN = ""
lastlinePORTALACCOUNT = ""
import json
try:
import requests
HAVE_REQUESTS = True
except ImportError:
HAVE_REQUESTS = False
from viper.common.abstracts import Module
from viper.core.session import __sessions__
BASE_URL = 'https://analysis.lastline.com'
SUBMIT_URL ... | 2.4375 | 2 |
modality/sysml14/modelelements/__init__.py | bmjjr/modality | 1 | 12779917 | # -*- coding: utf-8 -*-
from .modelelements import getEClassifier, eClassifiers
from .modelelements import name, nsURI, nsPrefix, eClass
from .modelelements import (
Conform,
ElementGroup,
Expose,
Problem,
Rationale,
Stakeholder,
View,
Viewpoint,
)
from modality.pyuml2.uml import (
... | 2.09375 | 2 |
primes.py | chapman-phys220-2018f/cw04-ben-jessica | 0 | 12779918 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import primes
# <NAME>
# <EMAIL>
# 2300326
# Phys 220
# Cw04
###
# Name: <NAME>
# Student ID: 2262810
# Email: <EMAIL>
# Course: PHYS220/MATH220/CPSC220 Fall 2018
# Assignment: CW03
###
"""primes.py Test Module
Verifies that the implementations for prime nu... | 4.34375 | 4 |
src/spoofbot/util/__init__.py | raember/spoofbot | 0 | 12779919 | """Utility module for handy features to be used in conjunction with the core modules"""
from .archive import load_flows
from .common import TimelessRequestsCookieJar
from .common import dict_to_dict_list, url_to_query_dict_list
from .common import dict_to_tuple_list, dict_list_to_dict, dict_list_to_tuple_list, \
... | 1.757813 | 2 |
online_judge/helpers/session.py | ashimaathri/online-judge | 0 | 12779920 | from functools import wraps
from flask import session, url_for, request, redirect
def is_authenticated():
return 'username' in session
def login_required(f):
@wraps(f)
def wrapper(*args, **kwargs):
if is_authenticated():
return f(*args, **kwargs)
else:
return redire... | 2.828125 | 3 |
src/rotary_table_api/rotary_table_messages.py | CebulowyNinja/rotary-table-antenna-measurement | 1 | 12779921 | <filename>src/rotary_table_api/rotary_table_messages.py<gh_stars>1-10
from abc import ABC, abstractmethod
from typing import Type
import crc8
def round_to(val: float, precision: float):
if val % precision < precision/2:
val -= val % precision
else:
val += precision - val % precision
return... | 2.9375 | 3 |
data/data_split/label_split_utils.py | z1021190674/GMAUResNeXt_RS | 1 | 12779922 | <filename>data/data_split/label_split_utils.py
import numpy as np
import cv2
import os
# from osgeo import gdal_array
def color2label(img, color2label_dict):
"""
Description:
transform an colored label image to label image
Params:
img -- image of shape (height, width, channel)
colo... | 3.359375 | 3 |
PyPoll/Script_election.py | Egallego77/python-challenge | 0 | 12779923 | # #This will allow us to create file paths accross operating systems
import pathlib
# #Path to collect data from Recources folder
election_csvpath =pathlib.Path('PyPoll/Resources/election_data.csv')
#Module for reading CSV files
import csv
with open(election_csvpath, mode='r') as csvfile:
#CSV reader specifies d... | 3.421875 | 3 |
bingo_board/tastypie/__init__.py | colinsullivan/bingo-board | 2 | 12779924 | __author__ = '<NAME>, <NAME>, <NAME>'
__version__ = (0, 9, 5)
| 1.148438 | 1 |
packages/SwingSet/misc-tools/count-mint-exports.py | danwt/agoric-sdk | 4 | 12779925 | #!/usr/bin/env python3
# goal: of the 6230 objects exported by v5 (vat-mints), how many are Purses vs Payments vs other?
import sys, json, time, hashlib, base64
from collections import defaultdict
exports = {} # kref -> type
double_spent = set()
unspent = set() # kref
died_unspent = {}
def find_interfaces(body):
... | 2.234375 | 2 |
deeppavlov/tasks/coreference_scorer_model/agents.py | deepmipt/kpi2017 | 3 | 12779926 | # Copyright 2017 Neural Networks and Deep Learning lab, MIPT
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | 2.03125 | 2 |
5_distance_analysis/nbconverted/0_process_park.py | jjc2718/mutation-fn | 0 | 12779927 | #!/usr/bin/env python
# coding: utf-8
# ## Load and process Park et al. data
#
# For each sample, we want to compute:
#
# * (non-silent) binary mutation status in the gene of interest
# * binary copy gain/loss status in the gene of interest
# * what "class" the gene of interest is in (more detail on what this means ... | 2.390625 | 2 |
pystyx/parser.py | styx-dev/pystyx | 0 | 12779928 | """
Parse, don't validate. - <NAME>
"""
from munch import Munch
from .functions import TomlFunction
from .shared import OnThrowValue
def parse_on_throw(from_obj, to_obj):
"""
Expects "or_else" to already have been processed on "to_obj"
"""
throw_action = {
"or_else": OnThrowValue.OrElse,
... | 2.734375 | 3 |
scrapy_news/scrapy_news/spiders/news_spider.py | DreamCloudWalker/MySimpleServers | 0 | 12779929 | <filename>scrapy_news/scrapy_news/spiders/news_spider.py<gh_stars>0
import scrapy
import re
from scrapy_news.items import ScrapyNewsItem
class NewsSpiderSpider(scrapy.Spider):
name = 'news_spider'
start_urls = ['https://www.douban.com/gallery/', # 豆瓣
'https://s.weibo.com/top/summary', ... | 2.84375 | 3 |
plugins/clench.py | wffirilat/Neurohacking | 2 | 12779930 | # -*- coding: utf-8 -*-
"""
Project: neurohacking
File: clench.py.py
Author: wffirilat
"""
import numpy as np
import time
import sys
import plugin_interface as plugintypes
from open_bci_v3 import OpenBCISample
class PluginClench(plugintypes.IPluginExtended):
def __init__(self):
self.release = True
... | 2.234375 | 2 |
Discord Bots/Meme6-BOT/cogs/money.py | LUNA761/Code-Archive | 1 | 12779931 | import discord, time, os, praw, random, json
from discord.ext import commands, tasks
from discord.ext.commands import has_permissions, MissingPermissions
from discord.utils import get
from itertools import cycle
import datetime as dt
from datetime import datetime
done3 = []
beg_lim_users = []
timers = {}
done = []
s... | 2.328125 | 2 |
forager_server/scripts/load_val.py | jeremyephron/forager | 1 | 12779932 | <reponame>jeremyephron/forager
from google.cloud import storage
from forager_server_api.models import Dataset, DatasetItem
import os
DATASET_NAME = "waymo"
VAL_IMAGE_DIR = "gs://foragerml/waymo/val"
if not VAL_IMAGE_DIR.startswith("gs://"):
raise RuntimeError(
"Directory only supports Google Storage bucke... | 2.9375 | 3 |
tests/test_cli.py | mossblaser/bulk_photo_print | 0 | 12779933 | <filename>tests/test_cli.py
import pytest
import os
import sys
from typing import Set, Any
from bulk_photo_print.cli import (
parse_dimension,
ARGUMENTS,
parse_arguments,
ArgumentParserError,
main,
)
TEST_DIR = os.path.dirname(__file__)
TEST_JPEG_PORTRAIT = os.path.join(TEST_DIR, "portrait.jpg... | 2.375 | 2 |
get_mismatch.py | TuanjieNew/SeqDesignTool | 0 | 12779934 | #!/usr/bin/env python
#fn; get_mismatch.py
#ACTGCAGCGTCATAGTTTTTGAG
import os
import copy
def getMismatch(start,seq,name,end):
#name = seq
quality = 'IIIIIIIIIIIIIIIIIIIIII'
OUTFILE = open('./mis_test.fastq','a')
ls = list(seq)
ls_1 = copy.deepcopy(ls)
ii = start+1
for i in ls_1[ii:end]:... | 2.65625 | 3 |
cride/circles/migrations/0004_auto_20200525_1916.py | mariogonzcardona/platzi-cride | 0 | 12779935 | # Generated by Django 2.0.10 on 2020-05-25 19:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('circles', '0003_auto_20200525_1531'),
]
operations = [
migrations.RemoveField(
model_name='membership',
name='is_Ac... | 1.75 | 2 |
saveauth.py | jimfenton/notif-notifier | 0 | 12779936 | <filename>saveauth.py<gh_stars>0
#!/usr/bin/python
# saveauth.py - Save notif address for use by clockwatcherd
#
# Copyright (c) 2015 <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... | 2.046875 | 2 |
Module2/Day15/module2_day_15_dictionaries.py | sydneybeal/100DaysPython | 2 | 12779937 | <gh_stars>1-10
"""
Author: <REPLACE>
Project: 100DaysPython
File: module1_day15_dictionaries.py
Creation Date: <REPLACE>
Description: <REPLACE>
"""
conversion = {"a": 1, "b": 2, "c": 3, "d": 4, "e": 5}
print(conversion)
print(conversion["a"])
menu = {"item1": ["egg", "... | 2.734375 | 3 |
src/ci_systems/travis.py | nifadyev/build-status-notifier | 6 | 12779938 | <reponame>nifadyev/build-status-notifier
"""Module for dealing with Travis CI API."""
import time
from typing import Dict, Any, List, Tuple, Optional
import requests
from requests import Response
from ..notifiers.slack import Slack
from ..custom_types import BUILD
class Travis():
"""Class for sending requests ... | 2.515625 | 3 |
quantum_compiler/drawing.py | Debskij/QuantumCompiler | 2 | 12779939 | <reponame>Debskij/QuantumCompiler<filename>quantum_compiler/drawing.py<gh_stars>1-10
import matplotlib.pyplot
import typing
def draw_axes() -> None:
"""Draw axes on the plane."""
points = [[1.2, 0], [0, 1.2], [-1.2, 0], [0, -1.2]] # dummy points for zooming out
arrows = [[1.1, 0], [0, 1.1], [-1.1, 0], [0... | 3.03125 | 3 |
tests/pyspark_testing/integration/test_driver.py | msukmanowsky/pyspark-testing | 24 | 12779940 | <reponame>msukmanowsky/pyspark-testing
from ... import relative_file
from . import PySparkIntegrationTest
from pyspark_testing import driver
from pyspark_testing.models import BroadbandCoverageInfo
class TestDriver(PySparkIntegrationTest):
def setUp(self):
self.data = (self.sc.textFile(driver.data_path(... | 2.546875 | 3 |
cpu_bound.py | nagibinau/Multi-Group-26 | 0 | 12779941 | <gh_stars>0
import concurrent.futures
import timeit
from hashlib import md5
from random import choice
def mining_money(worker_id):
start_time = timeit.default_timer()
search_time = 0
while True:
s = "".join([choice("0123456789") for _ in range(50)])
h = md5(s.encode('utf8')).hexdigest()
... | 2.875 | 3 |
0004-Median-of-Two-Sorted-Arrays.py | Sax-Ted/Practicing-with-Leetcode | 0 | 12779942 | <reponame>Sax-Ted/Practicing-with-Leetcode
import math
class Solution:
def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:
data = nums1 + nums2
data = sorted(data)
if len(data) % 2 != 0:
return data[math.ceil(len(data)/2) - 1]
else:
... | 3.359375 | 3 |
test/example_3nu_vacuum_coeffs.py | mbustama/NuOscProbExact | 14 | 12779943 | # -*- coding: utf-8 -*-
r"""Run the vacuum coefficients 3nu example shown in README.md.
Runs the three-neutrino example of coefficients for oscillations in
vacuum shown in README.md
References
----------
.. [1] <NAME>, "Exact neutrino oscillation probabilities:
a fast general-purpose computation method for two an... | 2.4375 | 2 |
answers/AkshajV1309/Day14/D14Q1.py | arc03/30-DaysOfCode-March-2021 | 22 | 12779944 | <reponame>arc03/30-DaysOfCode-March-2021
def remdupli(S):
if len(S)==1:
return S
if S[0]==S[1]:
return remdupli(S[1:])
return S[0]+remdupli(S[1:])
S=input('Enter string: ')
print('Output:',remdupli(S))
| 3.609375 | 4 |
atom/nucleus/python/test/test_roundup_api.py | sumit4-ttn/SDK | 0 | 12779945 | # coding: utf-8
"""
Hydrogen Atom API
The Hydrogen Atom API # noqa: E501
OpenAPI spec version: 1.7.0
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import nucleus_api
from nucleus_api.api.roundup_ap... | 1.703125 | 2 |
outingbox/views.py | kartikanand/outing-box | 0 | 12779946 | from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse, JsonResponse, HttpResponseRedirect, Http404
from django.views.decorators.csrf import csrf_protect
from django.views.decorators.http import require_POST
from django.contrib.auth.decorators import login_required
from django.core.... | 1.953125 | 2 |
examples/example.py | jsphon/flumine | 0 | 12779947 | import time
import logging
import betfairlightweight
from betfairlightweight.filters import streaming_market_filter
from pythonjsonlogger import jsonlogger
from flumine import Flumine, clients, BaseStrategy
from flumine.order.trade import Trade
from flumine.order.ordertype import LimitOrder
from flumine.order.order im... | 2.140625 | 2 |
exercise/Exercism/python/largest-series-product/largest_series_product.py | orca-j35/python-notes | 1 | 12779948 | from operator import mul
from functools import reduce
def largest_product(series, size):
if size == 0:
return 1
if any((size > len(series), not series.isdecimal(), size < 0)):
raise ValueError('size is wrong value')
max_v = 0
for i in range(0, len(series) - size + 1):
max_v = ... | 3.1875 | 3 |
tests/unit_test/chat/chat_test.py | rit1200/kairon | 9 | 12779949 | from unittest.mock import patch
from urllib.parse import urlencode, quote_plus
from kairon.shared.utils import Utility
import pytest
import os
from mongoengine import connect, ValidationError
from kairon.shared.chat.processor import ChatDataProcessor
from re import escape
import responses
class TestChat:
@pytes... | 1.835938 | 2 |
detector/attributes/const_functions_state.py | caomingpei/smart-contract-vulnerability-detector | 2 | 12779950 | <reponame>caomingpei/smart-contract-vulnerability-detector
"""
Module detecting constant functions
Recursively check the called functions
"""
from slither.detectors.abstract_detector import AbstractDetector, DetectorClassification
from slither.formatters.attributes.const_functions import custom_format
class ConstantF... | 2.421875 | 2 |