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 |
|---|---|---|---|---|---|---|
FLAME.py | commanderchewbacca/Newsfilter | 0 | 12775451 | """
FLAME - Fuzzy clustering by Local Approximation of MEmbership
"""
from __future__ import print_function
import numpy as np
from scipy import sparse
from scipy.sparse import csr_matrix, lil_matrix
from sklearn.base import BaseEstimator, ClusterMixin
from sklearn.utils import check_array
from sklearn.metrics.pairw... | 2.75 | 3 |
Leetcode/27#_Remove Element_06170601.py | yanjiyue/sac | 0 | 12775452 | #Given an array nums and a value val, remove all instances of that value in-place and return the new length.
#Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.
#The order of elements can be changed. It doesn't matter what you leave beyond the... | 4.125 | 4 |
python_examples/__init__.py | gdahlm/python_examples | 0 | 12775453 | <reponame>gdahlm/python_examples<filename>python_examples/__init__.py
"""
python_examples
===============
Provides coding examples covering the following topics:
1. Array Sequences
2. Stacks, Queues, Deques
3. Linked Lists
4. Recursion
5. Trees
6. Searching and Sorting
7. Graph Algorithms
... | 3 | 3 |
stanford_battery/protocol/run_session.py | thomasbazeille/public_protocols | 3 | 12775454 | import json
import os
import subprocess
import time
subid = raw_input('Enter subject id (i.e. s999): ')
training = raw_input('Enter 0 for training, 1 for main tasks: ')
if training == '1':
run_file = 'scanner_tasks_order1'
else:
run_file = 'practice_tasks'
taskset = raw_input('Enter task group (1, 2 or 3): '... | 2.3125 | 2 |
api/views.py | rbs2rbs/simalirade_spotify | 0 | 12775455 | <gh_stars>0
from django.shortcuts import render
from django.http import HttpResponseNotFound
from rest_framework.response import Response
import json
from api.funcoes import Funcoes,Comp
from rest_framework.views import APIView
from django.core import serializers
class MusicaView(APIView):
def post(self, req... | 2.1875 | 2 |
lackey/KeyCodes.py | Inobitec/lackey | 599 | 12775456 | <reponame>Inobitec/lackey
class Button():
LEFT = 0
CENTER = 1
RIGHT = 2
class Key():
""" Key codes for InputEmulation.Keyboard object.
Can be entered directly or concatenated with an existing string, e.g. ``type(Key.TAB)`` """
ENTER = "{ENTER}"
ESC = "{ESC}"
BACKSPACE = "{BACKSPAC... | 3.09375 | 3 |
PyOpenGL-3.0.2/OpenGL/GL/ARB/sync.py | frederica07/Dragon_Programming_Process | 0 | 12775457 | '''OpenGL extension ARB.sync
This module customises the behaviour of the
OpenGL.raw.GL.ARB.sync to provide a more
Python-friendly API
Overview (from the spec)
This extension introduces the concept of "sync objects". Sync
objects are a synchronization primitive - a representation of events
whose completion stat... | 1.734375 | 2 |
osf/files/addons-figshare-local.py | sifulan-access-federation/helm-charts | 0 | 12775458 | import os
CLIENT_ID = os.environ['FIGSHARE_CLIENT_ID']
CLIENT_SECRET = os.environ['FIGSHARE_CLIENT_SECRET']
| 1.21875 | 1 |
nunchuk_tester.py | mlegere1323/WiiNunchukMouse | 1 | 12775459 | <filename>nunchuk_tester.py
import nunchuk
from pymouse import PyMouse
delta = 1
pressed = 1
no_press = 0
m = PyMouse()
x_dim, y_dim = m.screen_size()
while True:
#[joy_x, joy_y, accel_x, accel_y, accel_z, c_button, z_button]...TODO {shaken}
reading = nunchuk.get_input()
curr_joy_x = reading[0]
curr... | 2.625 | 3 |
ooobuild/csslo/security/__init__.py | Amourspirit/ooo_uno_tmpl | 0 | 12775460 | # coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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... | 1.367188 | 1 |
cottonformation/res/ram.py | gitter-badger/cottonformation-project | 5 | 12775461 | # -*- coding: utf-8 -*-
"""
This module
"""
import attr
import typing
from ..core.model import (
Property, Resource, Tag, GetAtt, TypeHint, TypeCheck,
)
from ..core.constant import AttrMeta
#--- Property declaration ---
#--- Resource declaration ---
@attr.s
class ResourceShare(Resource):
"""
AWS Obje... | 2.1875 | 2 |
bin/system/logging_setup.py | fdkz/sensed | 1 | 12775462 | <filename>bin/system/logging_setup.py
import os
import sys
import time
import math
import logging
import logging.handlers
_console_logger = None
def start_logging_system(log_folder, log_filename="log.txt"):
"""
"""
# patch Handler.handleError to reraise exceptions. don't know what magic
# happens in... | 2.40625 | 2 |
Blender Export/objc-export-2.5/objc_blend_2.5.6/export_objc.py | JavaZava/iOS-OpenGLES-Stuff | 199 | 12775463 | # ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | 2.265625 | 2 |
pgist.py | plship/pgist | 0 | 12775464 | <gh_stars>0
#!/usr/bin/env python
"""A Python command-line wrapper with github3.py library to access GitHub Gist.
"""
import os
import sys
if sys.version_info.major < 2:
reload(sys)
sys.setdefaultencoding('utf-8')
import uuid
from functools import wraps, update_wrapper
from getpass import getpass, getuser
... | 2.84375 | 3 |
TFTutorialStanford1.py | AdityaPrasadMishra/TensorflowPractice | 0 | 12775465 | <filename>TFTutorialStanford1.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 9 18:49:49 2017
@author: aditya
"""
import tensorflow as tf
a = tf.constant(2)
b = tf.constant(3)
x = tf.add(a, b)
# This is to activate tensorboard.
with tf.Session() as sess:
writer = tf.summary.FileWriter... | 3.03125 | 3 |
apps/equipment/migrations/0002_checkout_user.py | Ralst0n/inspection-manager | 1 | 12775466 | <filename>apps/equipment/migrations/0002_checkout_user.py
# Generated by Django 2.0.2 on 2018-08-22 15:38
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('inspectors', '0001_initial'),
('equipm... | 1.296875 | 1 |
ammf/utils/demo_utils.py | bangquanxie/ASM3D | 1 | 12775467 | import copy
import numpy as np
import tensorflow as tf
from ammf.utils.wavedata.tools.obj_detection import obj_utils
from ammf.utils.wavedata.tools.obj_detection import evaluation
from ammf.core import anchor_projector
from ammf.core import box_3d_encoder
COLOUR_SCHEME_PREDICTIONS = {
"Easy GT": (255, 255, 0), ... | 2.171875 | 2 |
classroom_tools/student_repositories/create_protected_branch_from_master.py | TestOrgJustAymeric/ClassroomTools | 0 | 12775468 | import argparse
import pprint
from colorama import Fore
from classroom_tools import github_utils
parser = argparse.ArgumentParser(
'Create a protected branch to freeze assignment submissions using the latest commit on master')
parser.add_argument(
'--token',
required=True,
help='GitHub personal acces... | 2.703125 | 3 |
note/meiduo34/mall/apps/areas/views.py | gaosong666/taobao | 0 | 12775469 | from django.shortcuts import render
# Create your views here.
# from django.shortcuts import render
# from rest_framework import mixins
# from rest_framework import status
# from rest_framework.decorators import action
# from rest_framework.permissions import IsAuthenticated
# from rest_framework.response import Respo... | 2.03125 | 2 |
maddpg/common/env_utils_test.py | iminders/maddpg | 1 | 12775470 | <reponame>iminders/maddpg
# -*- coding:utf-8 -*-
import sys
import pytest
from maddpg.arguments import parse_experiment_args
from maddpg.common.env_utils import get_shapes, make_env, uniform_action
from maddpg.common.tf_utils import set_global_seeds
class TestEnvUtils:
def setup(self):
args = parse_exp... | 2.25 | 2 |
elastalert_modules/tst_ist_tz_enhancement.py | nareshbalajia/elastalert | 0 | 12775471 | from datetime import datetime
from pytz import timezone
from elastalert.enhancements import BaseEnhancement
from elastalert.util import ts_to_dt, pretty_ts, elastalert_logger
"""
This Class will convert the incoming Timezone object of UTC offset to Taiwan/India Standard Timezone
"""
class ConvertTzInfo(BaseEnhancemen... | 2.875 | 3 |
ovspy/client.py | kamaboko123/ovspy | 2 | 12775472 | import ipaddress
import socket
import json
from . import ovsdb_query
from .bridge import OvsBridge
from .port import OvsPort
from datetime import datetime, timedelta
from . import ovspy_error
import sys
import time
class OvsClient:
SEND_DEBUG = False
RECV_DEBUG = False
def __init__(self, ovsdb_port, o... | 2.515625 | 3 |
gaphor/diagram/tests/test_group.py | MartinIIOT/gaphor | 0 | 12775473 | <filename>gaphor/diagram/tests/test_group.py
from gaphor.core.modeling import Diagram, Element
from gaphor.diagram.group import can_group, group, ungroup
def test_group_diagram(element_factory):
diagram = element_factory.create(Diagram)
parent = element_factory.create(Element)
assert group(parent, diagra... | 2.3125 | 2 |
apps/projects/views.py | Ralst0n/inspection-manager | 1 | 12775474 | <gh_stars>1-10
from django.contrib.auth.models import User, Group
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.db.models import Max, Sum
from django.http import JsonResponse
from django.shortcuts import render
from django.views import ge... | 2.046875 | 2 |
navbar.py | jchudb93/website | 0 | 12775475 | <filename>navbar.py<gh_stars>0
import dash_bootstrap_components as dbc
import dash_html_components as html
def Navbar():
links = dbc.Row(
[
dbc.DropdownMenu(
className = "nav-links-dd",
color="link",
label="Dataset",
... | 2.375 | 2 |
epochbot/constants.py | jaloo555/solana-easy-py | 4 | 12775476 | REFRESH_TIME = 15
LOAD_TIME = 10 | 1.015625 | 1 |
src/ydata_quality/utils/modelling.py | poga/ydata-quality | 242 | 12775477 | """
Utilities based on building baseline machine learning models.
"""
from typing import Union, Optional
from pandas import DataFrame, Series
from numpy import mean, tile, empty, std, square, sqrt, log as nplog, reciprocal
from scipy.stats import boxcox, normaltest, mode
from sklearn.compose import ColumnTransformer
f... | 2.703125 | 3 |
project_generator/exporters/gccarm.py | sg-/project_generator | 0 | 12775478 | <gh_stars>0
# Copyright 2014-2015 0xc0170
#
# 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... | 2.015625 | 2 |
openmdao.lib/src/openmdao/lib/optproblems/api.py | swryan/OpenMDAO-Framework | 0 | 12775479 | from sellar import SellarProblem, SellarProblemWithDeriv
from branin import BraninProblem
from scalable import UnitScalableProblem
| 1.195313 | 1 |
iutest/core/gotocode.py | mgland/iutest | 10 | 12775480 | # Copyright 2019-2020 by <NAME>, MGLAND animation studio. All rights reserved.
# This file is part of IUTest, and is released under the "MIT License Agreement".
# Please see the LICENSE file that should have been included as part of this package.
import logging
import os
from iutest.core import appsettings
from iutest... | 1.601563 | 2 |
visualization/TextArt/generate_text.py | Leterax/Visualization | 28 | 12775481 | from pathlib import Path
import numpy as np
from PIL import ImageFont
from scipy.ndimage import convolve
from scipy.spatial import cKDTree
resource_dir = (Path(__file__) / "../resources").absolute()
class Particle:
def __init__(self, x, y, color, ball_size=1):
self.pos = np.array([x, y]).astype(float)
... | 2.625 | 3 |
aggregables/sequences/suffix_trees/suffix_trees/test/test_simple.py | nevesnunes/aggregables | 106 | 12775482 | <filename>aggregables/sequences/suffix_trees/suffix_trees/test/test_simple.py
from suffix_trees import STree
def test_lcs():
a = ["abeceda", "abecednik", "abeabecedabeabeced",
"abecedaaaa", "aaabbbeeecceeeddaaaaabeceda"]
st = STree.STree(a)
assert st.lcs() == "abeced", "LCS test"
def test_missi... | 2.953125 | 3 |
polkadot_prometheus_exporter/_blockchain.py | w3f-community/polkadot-prometheus-exporter | 8 | 12775483 | <reponame>w3f-community/polkadot-prometheus-exporter
# Copyright (C) 2019 MixBytes, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the ... | 2.5625 | 3 |
mysite/blog/models.py | janusnic/dj-blog | 0 | 12775484 | <filename>mysite/blog/models.py<gh_stars>0
from django.db import models
from django.contrib.auth.models import User
from django.utils import timezone
class Category( models.Model ):
name = models.CharField( max_length= 50, unique= True )
slug = models.SlugField( max_length= 50, unique= True )
def __str__... | 2.359375 | 2 |
Traidoo/settings/third_party/jwt.py | stanwood/traidoo-api | 3 | 12775485 | <filename>Traidoo/settings/third_party/jwt.py
import datetime
SIMPLE_JWT = {
"ACCESS_TOKEN_LIFETIME": datetime.timedelta(minutes=15),
"REFRESH_TOKEN_LIFETIME": datetime.timedelta(days=1),
"ROTATE_REFRESH_TOKENS": False,
}
| 1.5625 | 2 |
chrome/common/extensions/docs/server2/object_store_creator_test.py | codenote/chromium-test | 0 | 12775486 | <gh_stars>0
#!/usr/bin/env python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
from test_object_store import TestObjectStore
from object_store_creator import ObjectStoreCreator
class _... | 2.375 | 2 |
examples/location.py | timgates42/glass.py | 0 | 12775487 | # Import glass library
import glass
# Import app configs
import configs
app = glass.Application(
name="Hello",
client_id=configs.CLIENT_ID,
client_secret=configs.CLIENT_SECRET
)
@app.subscriptions.login
def login(user):
profile = user.profile()
print "user : %s" % profile.get("given_name")
us... | 2.71875 | 3 |
pywhale/app/server.py | stefan2200/pywhale | 1 | 12775488 | import os.path
from flask import Flask, render_template, jsonify, request
from pywhale.whale import PyWhale
curr_file = os.path.abspath(os.path.dirname(__file__))
app_path = os.path.join(curr_file)
static_path = os.path.join(curr_file, 'static')
template_path = os.path.join(curr_file, 'templates')
app = Flask("PyWh... | 2.34375 | 2 |
examples/Inverse design of Splitter/splitter_opt_2D_TE_topology_minfeaturesize.py | tshwang0928/Lumopt | 0 | 12775489 | <reponame>tshwang0928/Lumopt<filename>examples/Inverse design of Splitter/splitter_opt_2D_TE_topology_minfeaturesize.py
######## IMPORTS ########
# General purpose imports
import numpy as np
import os
import sys
import scipy as sp
# Optimization specific imports
from lumopt import CONFIG
from lumopt.geometries.topolog... | 2.796875 | 3 |
programs/OLD/cluster3.py | CORDEA/analysis_of_1000genomes-data | 0 | 12775490 | #!/bin/env/python
infileList = []
keyList = []
cList = (
"GBR",
"FIN",
"CHS",
"PUR",
"CLM",
"IBS",
"CEU",
"YRI",
"CHB",
"JPT",
"LWK",
"ASW",
"MXL",
"TSI",
)
for i in range(17,23):
infileList.app... | 2.078125 | 2 |
Tests/image_tests/renderpasses/graphs/ForwardRendering.py | wsqjny/Falcor | 1,615 | 12775491 | from falcor import *
def render_graph_ForwardRendering():
loadRenderPassLibrary("DepthPass.dll")
loadRenderPassLibrary("ForwardLightingPass.dll")
loadRenderPassLibrary("BlitPass.dll")
testForwardRendering = RenderGraph("ForwardRenderer")
DepthPass = createPass("DepthPass", {'depthFormat': ResourceF... | 2.140625 | 2 |
natch/decorators/eq.py | ertgl/natch | 2 | 12775492 | from natch.core import Decoration
from natch.rules import Eq
eq = Decoration.make_rule_decorator(Eq)
| 1.25 | 1 |
my_app.py | RaMantik2/test | 0 | 12775493 | from PyQt5.QtWidgets import QApplication, QWidget,QLabel,QPushButton,QVBoxLayout,QHBoxLayout
from PyQt5.QtCore import Qt | 1.414063 | 1 |
train/loader.py | dhesin/team_sf_lidar | 0 | 12775494 | <filename>train/loader.py
import sys
sys.path.append('../')
import os
import numpy as np
import glob
import argparse
import csv
import sys
import pickle
import pandas as pd
import globals
from common.csv_utils import foreach_dirset
from random import randrange
from collections import defaultdict
from encoder import gen... | 2.75 | 3 |
liquid/filters/shopify.py | victorbnl/liquidpy | 0 | 12775495 | """Provides shopify filters"""
from .manager import FilterManager
# pylint: disable=invalid-name
shopify_filter_manager = FilterManager()
# TODO: color filters
# https://shopify.dev/api/liquid/filters/color-filters
# TODO: font filters
# https://shopify.dev/api/liquid/filters/font-filters
# TODO: html filters
# h... | 1.554688 | 2 |
app/__init__.py | MRichardN/Questioner-api | 0 | 12775496 | <reponame>MRichardN/Questioner-api
"""
Main file.
"""
import datetime
#Third party import
from flask import Flask
from flask_jwt_extended import JWTManager
#Local import
from instance.config import app_config
from app.api.v1.views.user_views import version1 as usersBlueprint
from app.api.v1.views.meetup_views import ... | 2.09375 | 2 |
examples/games/pong/pong.py | zormit/miniworldmaker | 9 | 12775497 | from miniworldmaker import *
class PongBoard(PixelBoard):
def on_setup(self):
self.add_background((100, 0, 0, 255))
self.player1 = Paddle((10, 130), width=10, height=80, thickness=0)
self.player2 = Paddle((780, 280), width=10, height=80, thickness=0)
self.ball = Ball((395, 295))
... | 3.265625 | 3 |
network/attention.py | Coldog2333/DGMN-pytorch | 0 | 12775498 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
from config_file import *
class Identity_TransformerBlock(nn.Module):
def __init__(self):
super(Identity_TransformerBlock, self).__init__()
def forward(self, Q, K, V, episilon=1e-8):
# assert (Q ==... | 2.75 | 3 |
apps/member/pipeline.py | TransparentHealth/smh-organization | 3 | 12775499 | from django.shortcuts import reverse
from apps.notifications.models import Notification
def connection_notifications(backend, user, response, *args, **kwargs):
if backend.name in ['sharemyhealth']:
# Dismiss the notification prompting the user to connect
notifications = Notification.objects.filte... | 2.296875 | 2 |
evaluation/eval_shapenet_seg.py | vistart/PointCNN | 1 | 12775500 | #!/usr/bin/python3
"""Calculate IoU of part segmentation task."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
import argparse
import data_utils
import numpy as np
def main():
parser = argparse.ArgumentParser()
... | 2.265625 | 2 |
generateDataSet.py | zclyne/2048Game | 1 | 12775501 | GAME_SIZE = 4
SCORE_TO_WIN = 2048
from game2048.game import Game
from game2048.agents import ExpectiMaxAgent
# save the dataset
f_256 = open("dataset_256.txt", "w")
f_512 = open("dataset_512.txt", "w")
f_1024 = open("dataset_1024.txt", "w")
for i in range(30000):
print("i = ", i)
game = Game(size=GAME_SIZE)
... | 3.421875 | 3 |
scripts/py/bsg_ast_wire_reg_decl_opt_inplace.py | developandplay/bsg_sv2v | 16 | 12775502 | '''
bsg_ast_wire_reg_decl_opt_inplace.py
This optimization pass takes all the wires and regs defined in a module and
consolodates them into a WireList or RegList respectfully. WireList and RegList
is a new pyverilog AST that represent a comma separated collection of wire
and reg declarations.
'''
import logging
from... | 2.765625 | 3 |
InventorySystem/wood/apps.py | guyueming/PythonWeb | 0 | 12775503 | from django.apps import AppConfig
class WoodConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'wood'
| 1.390625 | 1 |
rules_approval.py | benjaminkrenn/abcvoting | 0 | 12775504 | # Implementations of approval-based multi-winner voting rules
from __future__ import print_function
import math
import sys
from itertools import combinations
try:
from gmpy2 import mpq as Fraction
except ImportError:
from fractions import Fraction
from rules_approval_ilp import compute_monroe_ilp, compute_th... | 2.484375 | 2 |
classes/slave_class.py | HubertKSK/map_reduce | 0 | 12775505 | <filename>classes/slave_class.py<gh_stars>0
#!/usr/bin/python
import logging.handlers
import os
import socket
import uuid
import json
from nltk.tokenize import word_tokenize
if not os.path.exists("log"):
os.makedirs("log")
LOGGER = logging.getLogger(__name__)
LOGGER.setLevel(logging.DEBUG)
FORMATTER = logging.Fo... | 2.375 | 2 |
Index.py | ImdWf/Catalog_Crawler | 0 | 12775506 | <filename>Index.py
# -*- coding: utf-8 -*-
import urllib
from Seite import Seiten
class Indexseiten(Seiten):
def add(self, data):
Exclude = ['erstes_Datum','letztes_Datum']
return super(Indexseiten, self).add(data,Exclude)
def sort(self, Kriterium = 'Indexnummer'):
super(Indexseiten, self).sort(Kri... | 2.84375 | 3 |
src/conclusions/experiment_rendering_speed.py | BLannoo/LocationAnalysis | 1 | 12775507 | <gh_stars>1-10
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.3.4
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %%
# auto format code at cell execut... | 2.5 | 2 |
setup.py | janharlass/xorca | 12 | 12775508 | """Setup xorca."""
from setuptools import setup
setup(name='xorca',
description='Work on the ORCA grid with XGCM and Xarray',
packages=['xorca'],
package_dir={'xorca': 'xorca'},
install_requires=['setuptools', ],
zip_safe=False)
| 1.1875 | 1 |
tasks/snf.py | blanchpk/supernovae | 25 | 12775509 | """Import tasks for the Nearby Supernova Factory.
"""
import csv
import os
from glob import glob
from astrocats.catalog.utils import jd_to_mjd, pbar, pretty_num, uniq_cdl
from astropy.time import Time as astrotime
from decimal import Decimal
from ..supernova import SUPERNOVA
def do_snf_aliases(catalog):
file_p... | 2.28125 | 2 |
src/datasets_util.py | ZHAOZHIHAO/ClusterRouting | 0 | 12775510 | from __future__ import print_function
import os
import numpy as np
import torch
from torchvision import datasets, transforms
from .smallnorb_dataset_helper import smallnorb, smallnorb_equivariance
from .utils import random_split, CustomDataset
def get_dataset(args):
if args.dataset == "cifar10":
... | 2.546875 | 3 |
main/admin.py | codeg8/HRMS | 5 | 12775511 | <reponame>codeg8/HRMS
from django.apps import apps
from django.conf import settings
from django.contrib import admin, messages
from django.contrib.admin import AdminSite
from django.contrib.admin.options import IS_POPUP_VAR
from django.contrib.admin.utils import unquote
from django.contrib.auth import update_session_au... | 1.742188 | 2 |
Competitve/Python/New Students.py | EdwaRen/Competitve-Programming | 1 | 12775512 | <filename>Competitve/Python/New Students.py<gh_stars>1-10
n = int(input())
sumI = 0
for i in range(n):
sumI = sumI + int(input())
o = int(input())
for i in range(o):
sumI = sumI + int(input())
print('{:.3f}'.format((round(sumI*1000/(n+i+1)))/1000))
| 3.25 | 3 |
training.py | ali77sina/Adaptive_Filters | 0 | 12775513 | from Creating_Synthetic_Dataset import x_train, y_train
import tensorflow as tf
from scipy.fft import fft, fftfreq
#global variables
l = 50000
low_lim = 100
high_lim = 150
fs = 512
sep_ind = int(0.8*l)
length_of_input = 60
# Size of FFT analysis
N = 60
def fir_freqz(b):
# Get the frequency response
X = np.ff... | 2.84375 | 3 |
plugins/graphite/icon_graphite/connection/connection.py | lukaszlaszuk/insightconnect-plugins | 46 | 12775514 | import komand
from .schema import ConnectionSchema
# Custom imports below
import requests
class Connection(komand.Connection):
def __init__(self):
super(self.__class__, self).__init__(input=ConnectionSchema())
self.request = None
def connect(self, params):
url = params.get("graphite_... | 2.59375 | 3 |
desafios/d018.py | moises-moreira/PYTHON | 0 | 12775515 | nome = str(input('Digite seu nome: ')).strip()
print('Seu nome em letras maiúsculas: {}'.format(nome.upper()))
print('Seu nome em letras minúsculas: {}'.format(nome.lower()))
print('Seu nome sem espaços: {}'.format(len(nome.replace(' ', ''))))
print('Seu primeiro nome tem: {} caracteres'.format(len(nome.split()[0])))
| 4.03125 | 4 |
ChessRender/RenderFsmCommon/RenderFsmStates/registration_render_state.py | PavelLebed20/chess_classic | 1 | 12775516 | from ChessRender.RenderFsmCommon.button_fsm import ButtonFsm
from ChessRender.RenderFsmCommon.screen_states import ScreenState
from ChessRender.RenderFsmCommon.screen_text_fsm import ScreenTextFsm
from ChessRender.RenderFsmCommon.text_field_fsm import TextFieldFsm
class FsmStateRegistration(ScreenState):
def __in... | 2.265625 | 2 |
load_QTs.py | tgandor/urban_oculus | 0 | 12775517 | import argparse
import os
from tqdm import tqdm
from couch import db
from jpeg import get_QTs, identify_quality
parser = argparse.ArgumentParser()
parser.add_argument('filenames', nargs='+')
parser.add_argument('--type', default='JpgImg')
parser.add_argument('--dataset')
args = parser.parse_args()
for filename in t... | 2.796875 | 3 |
Catch.py | haithamaouati/Catch | 2 | 12775518 | #!/usr/bin/env python3
# Author: @haithamaouati
# Version:1.0
import argparse
import colorama
import os
import requests
import time
from colorama import Fore, Back, Style
colorama.init()
os.system('cls' if os.name == 'nt' else 'clear')
print('''\
_._ _,-'""`-._
(,-.`._,'( |\`-/|
... | 2.8125 | 3 |
homework/第 5 课/Yulia python第五课作业一、二/�������ҵ��.py | xrandx/-Dating-with-python-this-winter | 3 | 12775519 | <gh_stars>1-10
#-*- codeing = utf-8 -*-
#@Time : 2021-01-14 19:41
#@Author : 苏苏
#@File : 第五课作业二.py
#@Software : PyCharm
#用递归实现阶乘函数factorial(n),对于任意的整数n都能返回其对应的阶乘。
def factorial(n):
if n == 0:
return 1
else:
return n*factorial(n-1)
| 2.796875 | 3 |
unsigned_bot/cogs/collection/cog.py | marsmanXmachina/unsigned-bot | 0 | 12775520 | """
Module for collection cog
"""
import math
import discord
from discord.ext import commands
from discord_slash import cog_ext, SlashContext
from discord_slash.utils.manage_commands import create_choice, create_option
from unsigned_bot import IMAGE_PATH
from unsigned_bot.constants import MAX_AMOUNT
from unsigned_bot... | 2.4375 | 2 |
ts/simulation_change.py | firefly-uics/tensor_flow_demo | 0 | 12775521 | import datetime
import logging
import tushare as ts
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from tensorflow import keras
import tensorflow as tf
from ts.build_model import BuildModel
from ts.db_utils import get_daily_by_trade_date
from ts.simulation_history import SimulationHistory
fro... | 2.359375 | 2 |
transcrypt/development/automated_tests/relimport/rimport.py | kochelmonster/Transcrypt | 0 | 12775522 | import tpackage
def run(test):
test.check(type(tpackage.peer2.func).__name__)
test.check(type(tpackage.func1).__name__)
| 1.476563 | 1 |
idiokit/heap.py | AbuseSA/idiokit | 18 | 12775523 | class HeapError(Exception):
pass
class Heap(object):
def __init__(self, iterable=()):
self._heap = []
for value in iterable:
self.push(value)
def _get(self, node):
if not self._heap:
raise HeapError("empty heap")
if node is None:
retur... | 3.8125 | 4 |
agent.py | grayvalley/DQNAMM | 6 | 12775524 | import numpy as np
from tensorflow.keras.models import load_model
from buffer import (
ReplayBuffer,
build
)
class DQNAgent:
def __init__(self, alpha, gamma, n_actions, epsilon,
batch_size, input_dims, fc1_dims, fc2_dims, epsilon_dec=0.996,
epsilon_end=0.01,... | 2.734375 | 3 |
database.py | sstive/DBHelper | 0 | 12775525 | import pymysql
import json
from os import environ as env
# TODO: Write scripts for managing
class Database:
def __init__(self, database, **input_options):
"""
:param database: File/string/dict/json with database structure
:param input_options: Options and login data for database
... | 3.09375 | 3 |
emannotationschemas/schemas/nucleus_detection.py | seung-lab/EMAnnotationSchemas | 0 | 12775526 | <gh_stars>0
import marshmallow as mm
from emannotationschemas.schemas.base import (
FlatSegmentationReferenceSinglePoint,
SpatialPoint,
)
class NucleusDetection(FlatSegmentationReferenceSinglePoint):
volume = mm.fields.Float(description="the volume of the nucleus detected in um^3")
bb_start = mm.field... | 2.1875 | 2 |
srmcollidermetabo.py | premyshan/DIAColliderMetabo | 1 | 12775527 | <filename>srmcollidermetabo.py
#SRMColliderMetabo
"""
Evaluating complex backgrounds that may cause ambiguities in the measurement
of metabolites. This tool first filters a list of identified metabolites to
remove steroisomers (using the Inchikey) and the given experimental conditions.
This filtered list is then used ... | 2.28125 | 2 |
annogesiclib/stat_sublocal.py | Sung-Huan/ANNOgesic | 26 | 12775528 | <reponame>Sung-Huan/ANNOgesic
import csv
import numpy as np
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
plt.style.use('ggplot')
def plot(subs, total, unknown, strain, prefix_name):
nums = []
nums_no_unknown = []
classes = []
classes_no_unknown = []
width = 0.4
tmp_u... | 2.09375 | 2 |
Codewars/Beginner_series_sum_of_numbers -(7 kyu).py | maxcohen31/A-bored-math-student | 0 | 12775529 | # Sum of numbers 3
def get_sum(x, y):
s = 0
if x > y:
for index in range(y, x + 1):
s = s + index
return s
elif x < y:
for index in range(x, y + 1):
s = s + index
return s
else:
return x
print(get_sum(2, 1))
print(get_sum(0, -1))
| 3.90625 | 4 |
PiSnapND/s2a_fm/Snap!Files/Snap!Mobile/arduino/PyMata/pymata_serial.py | rasplay/PiSnap- | 0 | 12775530 | <filename>PiSnapND/s2a_fm/Snap!Files/Snap!Mobile/arduino/PyMata/pymata_serial.py<gh_stars>0
__author__ = 'Copyright (c) 2013 <NAME> All rights reserved.'
"""
Created on Tue Sep 3 07:12:01 2013
@author: <NAME>
Copyright (c) 2013-14 <NAME> All rights reserved.
This program is free software; you can redistribute it and... | 2.625 | 3 |
sympy/concrete/products.py | lidavidm/sympy | 1 | 12775531 | from __future__ import print_function, division
from sympy.core.containers import Tuple
from sympy.core.core import C
from sympy.core.expr import Expr
from sympy.core.mul import Mul
from sympy.core.singleton import S
from sympy.core.sympify import sympify
from sympy.functions.elementary.piecewise import piecewise_fold... | 2.8125 | 3 |
setup.py | 1grasse/conflowgen | 0 | 12775532 | <filename>setup.py
import os.path
from setuptools import setup, find_packages
this_directory = os.path.abspath(os.path.dirname(__file__))
# Load metadata that is also available for the code
metadata = {}
with open(os.path.join(this_directory, "conflowgen", "metadata.py"), encoding="utf-8") as fp:
exec(fp.read(), ... | 1.804688 | 2 |
app/src/services/__init__.py | avillia/weatheRESTua | 0 | 12775533 | <reponame>avillia/weatheRESTua
from .weather_fetcher import obtain_weather_for_5_cities
| 1.234375 | 1 |
binaryspaghettisort_package/build/lib/binaryspaghettisort.py | Sinnefa/Binary-Spaghetti-Sort-Binary-Spaghetti-Heads-Index | 0 | 12775534 | <reponame>Sinnefa/Binary-Spaghetti-Sort-Binary-Spaghetti-Heads-Index<gh_stars>0
import random
import math
import time
class SparseList(list):
def __setitem__(self, index, value):
missing = index - len(self) + 1
if missing > 0:
self.extend([None] * missing)
list.__setitem__(self, index, value)
def... | 3.25 | 3 |
tests/lib/collectors/bigquery.py | dfjxs/dftimewolf | 191 | 12775535 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests the BigQuery collector."""
import unittest
import mock
from dftimewolf.lib import state
from dftimewolf.lib.collectors import bigquery
from dftimewolf import config
class BigQueryCollectorTest(unittest.TestCase):
"""Tests for the BigQuery collector."""
d... | 2.609375 | 3 |
day11.py | mrpolyonymous/adventofcode2020 | 0 | 12775536 | # EMPTY = "L"
# OCCUPIED = "#"
# FIXED = "."
EMPTY = 0
OCCUPIED = 1
FIXED = -1
def read_input(file_name):
seats = []
with open(file_name) as input_file:
for line in input_file:
line = line.strip()
seats.append( list(map(map_input, line) ))
return seats
# Failed attempt to... | 3.65625 | 4 |
tasks/medium-150/nyan-cat/exploit.py | C4T-BuT-S4D/nordctf-2019-finals | 5 | 12775537 | #!/usr/bin/env python3
import re
import sys
import jwt
import requests
from Crypto.PublicKey import RSA
from Crypto.Util.number import inverse
def recover_d(n, e, p):
q = n // p
phi = (p - 1) * (q - 1)
return inverse(e, phi)
def main(url):
n = 161585030356555036503574383443349759802220513348577420... | 2.734375 | 3 |
FSISAC_STIX_Parser.py | ch4meleon/FSISAC_Stix_Downloader | 3 | 12775538 | #!/usr/bin/env python
"""
FSISAC STIX Parser (FSISAC_STIX_Parser.py)
Written by <NAME> (<EMAIL>)
"""
import os
import sys
import socket
import types
import collections
import json
import re
import io
import urllib2
import dateutil
import datetime
import time
import pytz
import pprint
import getpass
import csv
import... | 2.375 | 2 |
loops/test_break_stmt.py | Rhoynar/pysel | 1 | 12775539 | <gh_stars>1-10
# When user enters 'exit', exit program
while (True):
inp = raw_input('> ')
if inp.lower() == 'exit':
break
else:
print(inp)
| 3.53125 | 4 |
tests/__init__.py | Mgancita/data-preprocessor | 8 | 12775540 | """tests namespace."""
| 1.132813 | 1 |
src/mclatte/mclatte/dataset.py | Jason-Y-Z/McLatte | 0 | 12775541 | <gh_stars>0
"""
Dataset and DataLoader designed for representing
Multi-cause ITE problem setting.
"""
# Author: <NAME> (<EMAIL>)
# License: BSD 3 clause
from typing import Optional
import numpy as np
import pytorch_lightning as pl
import torch
from torch.utils.data import Dataset, DataLoader, random_split
class McL... | 2.59375 | 3 |
tests/test_tests.py | mehrdad-shokri/retdec-regression-tests-framework | 21 | 12775542 | <reponame>mehrdad-shokri/retdec-regression-tests-framework
"""
Tests for the :mod:`regression_tests.test` module.
"""
import unittest
from regression_tests.test import Test
from regression_tests.test_settings import TestSettings
class TestTests(unittest.TestCase):
"""Tests for `Test`."""
def test_setti... | 2.53125 | 3 |
code/data_prep/mcd_to_adata.py | TheJacksonLaboratory/endometriosis-scrnaseq | 0 | 12775543 | <filename>code/data_prep/mcd_to_adata.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pathlib import Path
from typing import Union
from io import BytesIO
import scanpy as sc
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from skimage.io import imread
from skimage.morphology import white_... | 2.03125 | 2 |
weibo/serve.py | CooperLuan/collector | 0 | 12775544 | <filename>weibo/serve.py
from flask import Flask, request, Response, json
from pymongo import MongoClient
client = MongoClient('192.168.1.202')
db = client['weibo-search']
app = Flask(__name__)
@app.route("/", methods=["GET", "POST"])
def hello():
result = db.webpages.insert({
'collected': dict(request.... | 2.828125 | 3 |
pigit/common/table.py | zlj-zz/pygittools | 0 | 12775545 | <gh_stars>0
# -*- coding:utf-8 -*-
from abc import ABC, abstractmethod
from shutil import get_terminal_size
from copy import deepcopy
from typing import Generator
from .style import BoxSymbol, Fx
from .str_utils import get_width
class TableTooWideError(Exception):
pass
class _baseTable(ABC):
"""Docstring... | 2.71875 | 3 |
day9.1/main.py | lfscheidegger/adventofcode2018 | 1 | 12775546 | <filename>day9.1/main.py
#!/usr/bin/python
"""
--- Day 9: Marble Mania ---
You talk to the Elves while you wait for your navigation system to initialize. To pass the time, they introduce you to their favorite marble game.
The Elves play this game by taking turns arranging the marbles in a circle according to very par... | 4.46875 | 4 |
june/social/twitter.py | mrmuxl/june | 1 | 12775547 | from tornado import escape
from tornado.web import asynchronous
from tornado.options import options
from tornado.auth import TwitterMixin
from june.lib.decorators import require_user, require_system
from june.lib.handler import BaseHandler
from june.models import Social
class TwitterHandler(BaseHandler, TwitterMixin)... | 2.1875 | 2 |
setup.py | california-civic-data-coalition/django-calaccess-scraped-data | 1 | 12775548 | <reponame>california-civic-data-coalition/django-calaccess-scraped-data
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from distutils.core import Command
from setuptools import setup, find_packages
def read(fname):
with open(os.path.join(os.path.dirname(__file__), fname)) as f:
return f.read()
... | 1.96875 | 2 |
{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/constants.py | yankeexe/cookiecutter-python-cli | 4 | 12775549 | <filename>{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/constants.py
"""
Constants for the CLI.
"""
WELCOME_MESSAGE = "Welcome to [bold green]{{cookiecutter.project_slug}}!![/bold green] Your CLI is working!"
| 1.257813 | 1 |
python-crons/check-online-offers.py | dantunescost/antunedo | 0 | 12775550 | #!/usr/bin python3.7
# -*- coding: utf-8 -*-
from pymongo.errors import DuplicateKeyError
from lib.mongoConnector import connect_to_mongodb, pop_offers_already_saved
from lib.queryBuilder import query_immo_offers, get_amount_of_pages
def get_offers_ids(immotype, total_pages, sort="asc"):
ids = []
if total_pa... | 2.6875 | 3 |