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 |
|---|---|---|---|---|---|---|
scripts/slave/recipe_modules/chromium_android/examples/full.py | mithro/chromium-build | 0 | 12770551 | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from recipe_engine.types import freeze
DEPS = [
'adb',
'build',
'chromium',
'chromium_android',
'recipe_engine/json',
'recipe_engine... | 1.71875 | 2 |
benchmarks/PCA_multiprocessing_transform.py | tirkarthi/odin-ai | 7 | 12770552 | # ===========================================================================
# Single process:
# 0.0003s
# Multiprocessing:
# ncpu = 1: ~0.16s
# ncpu = 2: ~0.07s
# ===========================================================================
from __future__ import print_function, division, absolute_import
import os
imp... | 2.359375 | 2 |
app/__init__.py | azhou5211/recipeat | 3 | 12770553 | # import the flask library
from flask import Flask
from config import Config
# configure an object of class Flask with __name__
app = Flask(__name__)
app.config.from_object(Config)
# here app is a package not to be confused with directory app
from app import routes
| 2.15625 | 2 |
nemo_nowcast/workers/clear_checklist.py | douglatornell/nemo_nowcast | 1 | 12770554 | <reponame>douglatornell/nemo_nowcast<gh_stars>1-10
# Copyright 2016-2021 <NAME>, 43ravens
# 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
# Un... | 2.15625 | 2 |
ForLoop/VowelsSum.py | Rohitm619/Softuni-Python-Basic | 1 | 12770555 | <filename>ForLoop/VowelsSum.py
text = input()
sum = 0
for symbol in text:
if symbol == "a":
sum += 1
elif symbol == "e":
sum += 2
elif symbol == "i":
sum += 3
elif symbol == "o":
sum += 4
elif symbol == "u":
sum += 5
print(sum) | 3.875 | 4 |
main.py | wwwins/BrainWavePy | 0 | 12770556 | <filename>main.py
# -*- coding: utf-8 -*-
# main.py
# 分析 EEG 轉換成聲音
import os
from subprocess import Popen, PIPE
from time import sleep
from random import randrange
from random import random
from player import MPG123Player
ENABLE_MPG123 = False
ENABLE_MPLAYER = False
ENABLE_MPG123PLAYER = True
files = []
p = None
dor... | 2.515625 | 3 |
SMPyBandits/Policies/Posterior/DiscountedBeta.py | balbok0/SMPyBandits | 309 | 12770557 | # -*- coding: utf-8 -*-
r""" Manipulate posteriors of Bernoulli/Beta experiments., for discounted Bayesian policies (:class:`Policies.DiscountedBayesianIndexPolicy`).
"""
from __future__ import division, print_function # Python 2 compatibility
__author__ = "<NAME>"
__version__ = "0.9"
# Local imports
try:
from .... | 2.75 | 3 |
src/weblayer/route.py | thruflo/weblayer | 3 | 12770558 | <reponame>thruflo/weblayer<filename>src/weblayer/route.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" :py:mod:`weblayer.route` provides :py:class:`RegExpPathRouter`, an
implementation of :py:class:`~weblayer.interfaces.IPathRouter` that uses
`regular expression`_ patterns. Say, for example, you have some r... | 2.671875 | 3 |
Intro to pygame/Animation/thelonghardtruth.py | badateverything/python-projects-for-school | 0 | 12770559 | import turtle as player
wn = player.Screen()
wn.title("disney level animation")
wn.bgcolor("Black")
#create new shapes
wn.register_shape("invader.gif")
wn.register_shape("invader2.gif")
player.shape("invader.gif")
player.frame = 0
#copying the video
player.frames = ["invader.gif", "invader2.gif"]
def playe... | 3.46875 | 3 |
src/utils.py | samsungnlp/semeval2022-task9 | 0 | 12770560 | <filename>src/utils.py
import errno
import json
import os
from typing import Dict
def _create_directory_if_not_exist(file_path: str) -> None:
if not os.path.exists(os.path.dirname(file_path)):
try:
os.makedirs(os.path.dirname(file_path))
except OSError as exc: # Guard against race con... | 3.1875 | 3 |
dec16.py | bloy/adventofcode-2015 | 0 | 12770561 | #!/usr/bin/env python
import re
import pprint
def parse_sue_input(lines):
sues = []
for line in lines:
line = line.strip()
(sue_number, facts) = line.split(': ', 1)
(_, sue_number) = sue_number.split(' ')
facts = dict([fact.split(': ') for fact in facts.split(', ')])
fa... | 3.8125 | 4 |
src/main.py | w1png/finance-tracker-telegram-bot | 1 | 12770562 | # Mockup of a plan:
#
# Keyboard buttons:
# get my id
# if in family -> leave family
# if in family and is_family_creator -> invite a person by id | kick a person
# if not in family -> create a family | join a family
#
# Database
# user -> user_id | family_id
# family -> family_id | user_list | creator_id
# bills ->... | 2.53125 | 3 |
codes/course1/hw02.py | BigShuang/big-shuang-python-introductory-course | 0 | 12770563 | <reponame>BigShuang/big-shuang-python-introductory-course
for i in range(5):
n = 2 * i + 1
print(' ' * (5 - i) + 'A' * n)
| 3.21875 | 3 |
tests/communication/utils.py | yangboz/maro | 598 | 12770564 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import socket
from maro.communication import Proxy
def get_random_port():
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as temp_socket:
temp_socket.bind(("", 0))
random_port = temp_socket.getsockname()[1]
retu... | 2.578125 | 3 |
utils/simulation/endUser_sim.py | jeffmacinnes/pyneal | 24 | 12770565 | <filename>utils/simulation/endUser_sim.py
""" Tool to simulate and demo how an end-user may request results from Pyneal
during a real-time scan.
In a neurofeedback context, for example, the end-user may be the software that
is controlling the experimental task. In this case, anytime the task wants to
present feedback ... | 2.890625 | 3 |
PyTorch/ImageNet/validate-VGG16BN.py | csyhhu/L-OBS | 73 | 12770566 | """
This code validates the performance of VGG16 after L-OBS prunning
"""
import torch
import torch.backends.cudnn as cudnn
import torchvision.datasets as datasets
import torchvision.transforms as transforms
from models.vgg import vgg16_bn
from utils import validate, adjust_mean_var
import numpy as np
import os
f... | 2.3125 | 2 |
chapter5_operations/prediction_monitoring_pattern/src/ml/data.py | sudabon/ml-system-in-actions | 133 | 12770567 | <reponame>sudabon/ml-system-in-actions
from typing import List
from pydantic import BaseModel
class Data(BaseModel):
data: List[List[float]] = [[5.1, 3.5, 1.4, 0.2]]
| 2.234375 | 2 |
50_List_Remove_item/main.py | jmmedel/Python-Tutorials- | 0 | 12770568 |
"""
Remove Item
There are several methods to remove items from a list:
"""
thislist = ["apple", "banana", "cherry"]
thislist.remove("banana")
print(thislist)
| 4 | 4 |
controller/modules/NetworkOperations.py | saumitraaditya/ControllersMulticast | 0 | 12770569 | <filename>controller/modules/NetworkOperations.py
from controller.modules.NetworkGraph import ConnEdgeAdjacenctList
from controller.modules.NetworkGraph import ConnectionEdge
from controller.modules.NetworkGraph import EdgeTypesOut
class OperationsModel():
def __init__(self, conn_edge, op_type, priority):
... | 2.546875 | 3 |
app/main.py | agstack/weather-forecast | 0 | 12770570 | from flask import Flask, render_template, jsonify, request, url_for
from shapely.geometry import Point as Shapely_point, mapping
from geojson import Point as Geoj_point, Polygon as Geoj_polygon, Feature, FeatureCollection
from datetime import datetime
from sqlalchemy import *
import pandas as pd
import geopandas as gpd... | 2.125 | 2 |
tests/testutils/repo/__init__.py | gtristan/buildstream-plugins | 0 | 12770571 | from .bzrrepo import Bzr
from .gitrepo import Git
| 1.03125 | 1 |
cogs/help.py | Mrmagicpie/LineSMP-Bot | 2 | 12770572 | <reponame>Mrmagicpie/LineSMP-Bot<filename>cogs/help.py
#
# LineSMP help.py | 2020 :copyright: Mrmagicpie
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
#
import discord
from discord import Embed as e
from discord.ext import commands
from discord.e... | 2.34375 | 2 |
utils.py | PervasiveWellbeingTech/Popbots-Engine | 1 | 12770573 | <reponame>PervasiveWellbeingTech/Popbots-Engine
import os
import logging
import time
from functools import wraps
"""
Time wrapper from https://gist.github.com/bradmontgomery/bd6288f09a24c06746bbe54afe4b8a82
"""
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctim... | 2.46875 | 2 |
pandapower/shortcircuit/results.py | ZhengLiu1119/pandapower | 0 | 12770574 | # -*- coding: utf-8 -*-
# Copyright (c) 2016-2022 by University of Kassel and Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel. All rights reserved.
import numpy as np
import pandas as pd
from pandapower.shortcircuit.idx_brch import IKSS_F, IKSS_T, IP_F, IP_T, ITH_F, ITH... | 2.046875 | 2 |
mipengine/node/monetdb_interface/views.py | ThanKarab/MIP-Engine | 0 | 12770575 | <reponame>ThanKarab/MIP-Engine
from typing import List
from mipengine.filters import build_filter_clause
from mipengine.node import config as node_config
from mipengine.node.monetdb_interface.common_actions import get_table_names
from mipengine.node.monetdb_interface.monet_db_connection import MonetDB
from mipengine.n... | 2.484375 | 2 |
shop/migrations/0010_auto_20210911_0602.py | Johirul300/BookShop-Project | 0 | 12770576 | <reponame>Johirul300/BookShop-Project<filename>shop/migrations/0010_auto_20210911_0602.py
# Generated by Django 3.2.5 on 2021-09-11 06:02
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('shop', '0009_rename_customer_cart_... | 1.492188 | 1 |
include/wxPython/pubsub/core/callables.py | SWEN-712/screen-reader-brandonp728 | 1 | 12770577 | <reponame>SWEN-712/screen-reader-brandonp728
"""
Low level functions and classes related to callables.
The AUTO_TOPIC
is the "marker" to use in callables to indicate that when a message
is sent to those callables, the topic object for that message should be
added to the data sent via the call arguments. See the docs i... | 2.84375 | 3 |
makahiki/apps/widgets/status/migrations/0002_auto__chg_field_dailystatus_date__add_unique_dailystatus_date.py | justinslee/Wai-Not-Makahiki | 1 | 12770578 | <reponame>justinslee/Wai-Not-Makahiki
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'DailyStatus.date'
db.alter_column('status_dailysta... | 2.203125 | 2 |
app/models/vehicle.py | TataneInYourFace/wifill-api | 0 | 12770579 | from django.db import models
from app.models.user import User
class Vehicle(models.Model):
user = models.ForeignKey(User, null=True)
plate = models.CharField(max_length=255, blank=False)
brand = models.CharField(max_length=255, blank=False)
name = models.CharField(max_length=255, blank=False)
col... | 2.3125 | 2 |
src/cone/firebase/management.py | conestack/cone.firebase | 0 | 12770580 | from cone.app import ugm_backend
from cone.ugm.events import UserCreatedEvent
from cone.ugm.events import UserDeletedEvent
from cone.ugm.events import UserModifiedEvent
from firebase_admin import auth
from firebase_admin.auth import UserNotFoundError
from pyramid.security import remember
from typing import List
from ty... | 2.0625 | 2 |
DobotDemoV2.0/Python/DobotDemoForPython/DobotDemoForPython/DobotControl.py | nanusefue/dobotMagician | 5 | 12770581 | import threading
import DobotDllType as dType
CON_STR = {
dType.DobotConnect.DobotConnect_NoError: "DobotConnect_NoError",
dType.DobotConnect.DobotConnect_NotFound: "DobotConnect_NotFound",
dType.DobotConnect.DobotConnect_Occupied: "DobotConnect_Occupied"}
#Load Dll
api = dType.load()
#Connec... | 2.15625 | 2 |
tests/analysis/file_hashes.py | SamuelePilleri/plaso | 0 | 12770582 | <filename>tests/analysis/file_hashes.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the unique hashes analysis plugin."""
from __future__ import unicode_literals
import unittest
from dfvfs.path import fake_path_spec
from plaso.analysis import file_hashes
from tests.analysis import test_lib
class U... | 2.53125 | 3 |
Data Science With Python/02-intermediate-python-for-data-science/1-matplotlib/scatter_plot-(1).py | aimanahmedmoin1997/DataCamp | 3 | 12770583 | <reponame>aimanahmedmoin1997/DataCamp<filename>Data Science With Python/02-intermediate-python-for-data-science/1-matplotlib/scatter_plot-(1).py
'''
Scatter Plot (1)
100xp
When you have a time scale along the horizontal axis, the line plot is your friend.
But in many other cases, when you're trying to assess if there's... | 4.46875 | 4 |
plotting/output_mpl_colormap_to_RGB.py | mnky9800n/python-data-analysis-tools | 2 | 12770584 | <reponame>mnky9800n/python-data-analysis-tools
# output colormap to txt file
#
# dependencies: matplotlib
from matplotlib import cm
import csv
with open('ylgnbu.txt', 'wb') as f:
writer = csv.writer(f, delimiter=' ')
for c in range(0,255):
# in this case I picked YlGnBu but you can pick any... | 2.890625 | 3 |
forecast.py | Amirktb1994/infamous-werewolves | 0 | 12770585 | <reponame>Amirktb1994/infamous-werewolves
import os
import pickle
from features import *
pd.options.mode.chained_assignment = None
with open('model_dict.pickle' , 'rb') as f:
model = pickle.load(f)
data_dir = '/hkfs/work/workspace/scratch/bh6321-energy_challenge/data/'
save_dir = 'forecasts/'
# dataloader
t... | 2.75 | 3 |
vip/apis.py | zhongmei57485/SwiperPro | 0 | 12770586 | from django.shortcuts import render
from libs.http import render_json
from vip.models import Vip
def info(request):
vip_info = []
for vip in Vip.objects.exclude(level=0).order_by('level'):
v_info = vip.to_dict()
v_info['perms'] = []
for perm in vip.perms:
v_info['perms']... | 2.125 | 2 |
src/python/pants/backend/native/subsystems/libc_dev.py | StephanErb/pants | 0 | 12770587 | # coding=utf-8
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import os
from pants.backend.native.config.environment import HostLibcDev
from pants.bac... | 2.015625 | 2 |
data_preprocessing/map_root.py | skelemoa/mugl | 21 | 12770588 | import numpy as np
import ipyvolume as ipv
import h5py
import os
import matplotlib.pyplot as plt
import sys
from tqdm import tqdm
kinect_dir = '../dataset/kinect/'
dir = '../dataset/data/'
kinect_files = os.listdir(kinect_dir)
missing_file_count = 0
def get_vibe_dir(x):
x1 = x[16,:] - x[0,:]
x2 = x[17,:] - x... | 2.40625 | 2 |
oslo_messaging/tests/rpc/test_dispatcher.py | sapcc/oslo.messaging | 131 | 12770589 | <gh_stars>100-1000
# Copyright 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | 2 | 2 |
notebooks/96.0-BDP-try-leiden.py | zeou1/maggot_models | 0 | 12770590 | # %% [markdown]
# #
import os
import pickle
import warnings
from operator import itemgetter
from pathlib import Path
from timeit import default_timer as timer
import colorcet as cc
import community as cm
import matplotlib.colors as mplc
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import p... | 1.679688 | 2 |
tools/map_extractor.py | swiss-avalanches/swiss-avalanches.github.io | 4 | 12770591 | <reponame>swiss-avalanches/swiss-avalanches.github.io<gh_stars>1-10
import numpy as np
import argparse
import json
from pylab import contour
from PIL import ImageFilter, Image, ImageDraw
import cv2
from skimage import measure
import os
import json
import visvalingamwyatt as vw
import glob
import sys
from pathlib import... | 2 | 2 |
charfred.py | jinkhya/Charfred_Bot | 0 | 12770592 | <filename>charfred.py
import asyncio
import click
import logging
import coloredlogs
import traceback
import datetime
import aiohttp
import os
from pathlib import Path
from discord.ext import commands
from discord import ClientException, Intents
from utils import Config, CharfredContext
log = logging.getLogger('charfre... | 2.15625 | 2 |
examples/example_time_course_kspace_affines.py | GReguig/torchio | 0 | 12770593 | <reponame>GReguig/torchio
from torchio.transforms.augmentation.intensity.random_motion_kspace_time_course import RandomMotionTimeCourseAffines
from torchio import Image, ImagesDataset, transforms, INTENSITY, LABEL
from torchvision.transforms import Compose
import numpy as np
from nibabel.viewers import OrthoSlicer3D as... | 2.265625 | 2 |
main.py | ryokamoi/sg_langevin | 9 | 12770594 | import os
import shutil
import argparse
import datetime
import tensorflow as tf
import model
from get_dataset import get_dataset
from visualizer import Visualizer
tf.enable_eager_execution()
parser = argparse.ArgumentParser(description='Stochastic Gradient Langevin Dynamics')
parser.add_argument('--hparams', type=s... | 2.375 | 2 |
plus/model/mlp.py | bioembeddings/PLUS | 36 | 12770595 | # Written by <NAME>, Seoul National University (<EMAIL>)
# Some parts of the code were referenced from or inspired by below
# - <NAME>'s code (https://github.com/tbepler/protein-sequence-embedding-iclr2019)
# PLUS
""" MLP model classes and functions """
import torch
import torch.nn as nn
import torch.nn.functional as... | 2.734375 | 3 |
Calculators/College/debt calc.py | EnderBro1000/Scripts | 2 | 12770596 | <reponame>EnderBro1000/Scripts<gh_stars>1-10
debt = 95000
interest_percent = .059
yearly_salary = None
hourly_salary = 20
debt_repayment_percent = .2
debt_repayment_length = 0
work_days = 261
work_hours = 8
interest = 0
if yearly_salary and hourly_salary is not None:
if yearly_salary != hourly_salary * work_days *... | 3.5 | 4 |
cli/preprocess.py | Guitaricet/new-semantic-parsing | 0 | 12770597 | # Copyright 2020 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 1.789063 | 2 |
signal_processing.py | antonyvm1102/Redbox | 0 | 12770598 | import numpy as np
from Redbox_v2 import file_manager as fm
import pandas as pd
from scipy.fftpack import rfft, rfftfreq
import matplotlib.pyplot as plt
import os
import math
def rms_time_dom(signal):
N = len(signal)
return math.sqrt(np.sum(np.power(signal,2))/N)
def rms_freq_dom(amplitude):... | 2.96875 | 3 |
apphub/contrastive_learning/simclr/simclr_tf.py | DwijayDS/fastestimator | 57 | 12770599 | # Copyright 2021 The FastEstimator Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | 1.898438 | 2 |
part-1/process_strings.py | pt-dev/python-newbie | 0 | 12770600 | <gh_stars>0
max_len = 79
str_plier = 2
foo = "Oh oh oh oh you don't know, Joe."*str_plier
curr_len = len(foo)
if curr_len > max_len:
print("Danger, <NAME>!!!")
print("Your sentiment is {} ".format(curr_len-max_len)+"characters too long!")
else:
print("What a lovely sentiment!\n"+ foo+"\nIn only {} characte... | 3.703125 | 4 |
src/rawsalad/rsdbapi.py | CCLab/Raw-Salad | 0 | 12770601 | <reponame>CCLab/Raw-Salad
# -*- coding: utf-8 -*-
"""
project: Raw Salad
function: classes representing the API to data and meta-data
requirements: mongod, conf file (see conf_filename)
"""
from time import time
from ConfigParser import ConfigParser
import pymongo
import re
import os
meta_src= "md_budg_scheme"
state_... | 2.25 | 2 |
simple/nim/nimnega_v2.py | feiooo/games-puzzles-algorithms | 0 | 12770602 | <filename>simple/nim/nimnega_v2.py
#!/usr/bin/env python3
# compute nim values using negamax and a dictionary
# that holds values already computed RBH 2019
# version 2.0 December 2020 new features
# - verbose option, showing win/loss value once it is known
# - move initialization of the start position outside t... | 3.0625 | 3 |
process_run_chicago.py | Multiscale-Genomics/C-HiC | 0 | 12770603 | #!/usr/bin/env python
"""
.. See the NOTICE file distributed with this work for additional information
regarding copyright ownership.
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
... | 1.929688 | 2 |
status.py | SeverinDavis/MT | 1 | 12770604 | TEMPERATURE = 0x01
GAS = 0x02
VOLTAGE = 0x04
DELAY = 0x10
TEST_SUCCESS = 0x3F
ERROR_RELAY_OPEN = 0x04
ERROR_RELAY_CLOSED = 0x08
MODE_CONFIG = 0x80
MODE_RUN = 0x40
MODE_ERROR = 0xC0
MODE_TIMEOUT = 0x00
WRITE = 0x20
def print_status(state):
if(state&MODE_ERROR == MODE_ERROR):
print("ERROR MODE")
elif(state&MOD... | 3.109375 | 3 |
examples/beta/cdc-postgres/main.py | beneath-hq/beneath | 65 | 12770605 | import asyncio
import beneath
import psycopg2
import json
import yaml
from datetime import datetime
from schemas import get_schema, check_for_and_encode_ts
with open(".development.yaml", "r") as ymlfile:
config = yaml.safe_load(ymlfile)
POLLING_INTERVAL = 5
SCHEMA = """
type Change @schema {
table: String! @k... | 2.375 | 2 |
spotify_terminal/display.py | marcdjulien/spotifyterminal | 0 | 12770606 | <reponame>marcdjulien/spotifyterminal
import time
import datetime
from . import common
from . import unicurses as uc
from .gui import WindowManager
from .periodic import PeriodicCallback, PeriodicDispatcher
logger = common.logging.getLogger(__name__)
class CursesDisplay(object):
# How often to clear the screen... | 2.96875 | 3 |
pytools/log.py | alexfikl/pytools | 52 | 12770607 | from warnings import warn
warn("pytools.log was moved to https://github.com/illinois-ceesd/logpyle/. "
"I will try to import that for you. If the import fails, say "
"'pip install logpyle', and change your imports from 'pytools.log' "
"to 'logpyle'.", DeprecationWarning)
from logpyle import * ... | 1.476563 | 1 |
chapter_3/wheres_waldorf.py | prabal1997/uva_judge | 1 | 12770608 | import sys
#read input file
input_file = open("input_test_case", "r");
input_file = [ line.strip() for line in input_file if (line.strip() != "") ];
case_count = int(input_file[0]);
input_file = input_file[1:];
#access data
def access_data(input_matrix, start_range, end_range):
#receives address, returns '#' if ... | 3.40625 | 3 |
toleranceinterval/__init__.py | jedludlow/tolerance_interval_py | 9 | 12770609 | <filename>toleranceinterval/__init__.py
from . import oneside # noqa F401
from . import twoside # noqa F401
from . import hk # noqa F401
from . import checks # noqa F401
import os as _os # noqa F401
# add rudimentary version tracking
__VERSION_FILE__ = _os.path.join(_os.path.dirname(__file__), 'VERSION')
__versio... | 1.578125 | 2 |
generate/generate_all_data_augmentation.py | prise-3d/Thesis-NoiseDetection-metrics | 0 | 12770610 | # main imports
import sys, os, argparse
import numpy as np
import random
import time
import json
# image processing imports
from PIL import Image
from ipfml.processing import transform, segmentation
from ipfml import utils
# modules imports
sys.path.insert(0, '') # trick to enable import of main folder module
impor... | 2.1875 | 2 |
PedSimulation/gui/drawer/scene_drawer.py | HDL951236874/PedSimulation | 1 | 12770611 | <gh_stars>1-10
# TODO write docs
class SceneDrawer(object):
def __init__(self, device, register):
self.device = device
self.background_color = "black"
self.entity_register = register
def draw(self, scene):
for entity in scene.entities:
if entity.drawer is not None:... | 3.0625 | 3 |
nrm_django/contacts/models.py | 18F/NRM-Grants-Agreements | 5 | 12770612 | <reponame>18F/NRM-Grants-Agreements
# 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
# * Make sure each ForeignKey and OneToOneField has `on_delete` set to the desi... | 1.945313 | 2 |
integration_tests/test_manila_dalian_over_kuiper/step_3_run.py | KaushikChavali/hypatia | 70 | 12770613 | # The MIT License (MIT)
#
# Copyright (c) 2020 ETH Zurich
#
# 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... | 1.75 | 2 |
theory/lib/app_globals.py | ralfonso/theory | 4 | 12770614 | <reponame>ralfonso/theory
"""The application's Globals object"""
from theory.model.mpdpool import MPDPool
from theory.model.tconfig import TConfig
from pylons import config
class Globals(object):
"""Globals acts as a container for objects available throughout the
life of the application
"""
searchte... | 2.875 | 3 |
data.py | AlejandroCatalina/lstm_wind_energy | 1 | 12770615 | <reponame>AlejandroCatalina/lstm_wind_energy
import torch
import torchvision
import torch.utils.data.dataset as data
import os
import gzip
class Sotavento(data.Dataset):
train_file = 'stv_h_train.pt'
validation_file = 'stv_h_val.pt'
test_file = 'stv_h_test.pt'
def __init__(self,
root... | 2.796875 | 3 |
aws_toolbox/emails/email_sender.py | and-computers/aws_pytools | 0 | 12770616 | #!/usr/bin/env python3
import boto3
class EmailSender():
def __init__(self, from_address, session=None):
self._from_address = from_address
self._client = boto3.client('ses', region_name='us-east-1')
def send_email(self, to_address, subject, message):
# type checking
if isin... | 2.703125 | 3 |
nodes/roboclaw_node.py | utahrobotics/phidgets_ros | 0 | 12770617 | #!/usr/bin/env python
from __future__ import division
from math import pi, cos, sin
import sys
import diagnostic_msgs
import diagnostic_updater
sys.path.insert(1, '/home/usr2020/usr_ws/src/phidgets_ros/src')
from roboclaw_driver.roboclaw_driver import Roboclaw
import rospy
import tf
from geometry_msgs.msg import Quate... | 2.03125 | 2 |
lib/cmd/cmd.py | sachio222/socketchat_v3 | 1 | 12770618 | import socket
import subprocess
from chatutils import utils
from chatutils.chatio2 import ChatIO
configs = utils.JSONLoader()
HEADER_LEN = configs.dict["system"]["headerLen"]
def commands(client_socket):
# while True:
# breakpoint()
ChatIO().pack_n_send(client_socket, "C", b"<<cmd:#>>")
# client_soc... | 2.578125 | 3 |
S4/S4 Library/simulation/venues/park_zone_director.py | NeonOcean/Environment | 1 | 12770619 | <gh_stars>1-10
from situations.complex.yoga_class import YogaClassScheduleMixin
from venues.relaxation_center_zone_director import VisitorSituationOnArrivalZoneDirectorMixin
from venues.scheduling_zone_director import SchedulingZoneDirector
class ParkZoneDirector(YogaClassScheduleMixin, VisitorSituationOnArrivalZoneDi... | 1.21875 | 1 |
day-12/part-2/youyoun.py | evqna/adventofcode-2020 | 12 | 12770620 | <reponame>evqna/adventofcode-2020<gh_stars>10-100
from tool.runners.python import SubmissionPy
dir_plane_map = {
(0, 0): 0,
(0, 1): 1,
(1, 1): 2,
(1, 0): 3,
}
planes = [(-1, -1), (-1, 1), (1, 1), (1, -1)]
class YouyounSubmission(SubmissionPy):
def __init__(self):
super().__init__()
... | 2.71875 | 3 |
tests/test_example.py | lig/pyventory | 28 | 12770621 | import json
import os
import shlex
import subprocess
import pytest
@pytest.fixture(scope='session')
def example_dir(tests_dir):
return tests_dir / 'example'
@pytest.fixture(scope='session')
def anisble_inventory(example_dir):
return open(example_dir / 'ansible.json', 'r')
@pytest.fixture(scope='session')... | 1.90625 | 2 |
ms2ldaviz/add_parentmass.py | RP0001/ms2ldaviz | 6 | 12770622 | import os
import pickle
import numpy as np
import sys
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ms2ldaviz.settings")
import django
django.setup()
import jsonpickle
from basicviz.models import Experiment,Document
if __name__ == '__main__':
experiment_name = sys.argv[1]
experiment = Experiment.objects.get(na... | 2.40625 | 2 |
torchnlp/utils.py | JiaqiLiu/PyTorch-NLP | 0 | 12770623 | import logging
import inspect
import collections
import random
import torch
logger = logging.getLogger(__name__)
def get_tensors(object_):
""" Get all tensors associated with ``object_``
Args:
object_ (any): Any object to look for tensors.
Returns:
(list of torch.tensor): List of tenso... | 2.59375 | 3 |
tofu/data/_inversions_algos.py | WinstonLHS/tofu | 6 | 12770624 |
import warnings
import numpy as np
import scipy.linalg as scplin
import scipy.optimize as scpop
import scipy.sparse as scpsp
dfail = {}
try:
import sksparse as sksp
except Exception as err:
sksp = False
dfail['sksparse'] = "For cholesk factorizations"
try:
import scikits.umfpack as skumf
except E... | 1.976563 | 2 |
bdd/setup_losses.py | feedbackward/bdd | 1 | 12770625 | <filename>bdd/setup_losses.py
'''Setup: loss functions used for training and evaluation.'''
## External modules.
from copy import deepcopy
from numpy import absolute, expand_dims, sign
## Internal modules.
from mml.losses import Loss
from mml.losses.absolute import Absolute
from mml.losses.classification import Zero_... | 2.5 | 2 |
automol/extern/pybel_.py | snelliott/automol | 2 | 12770626 | <filename>automol/extern/pybel_.py
""" pybel interface
"""
import pybel
from phydat import ptab
import automol.geom.base
# geometry
def to_geometry(pbm):
""" Build an automol geometry data structure from a Pybel molecule object.
:param pbm: Pybel molecule object
:type pbm: Pybel object
:... | 2.515625 | 3 |
PAL/Cross/pupy/packages/all/portscan.py | infosecsecurity/OSPTF | 2 | 12770627 | <reponame>infosecsecurity/OSPTF
# -*- coding: UTF8 -*-
# Copyright (c) 2015, <NAME> (<EMAIL>)
# Pupy is under the BSD 3-Clause license. see the LICENSE file at the root of the project for the detailed licence terms
from scapy.all import *
def format_response(pkt):
res=""
if "R" in pkt.sprintf("%TCP.flags%"):
... | 2.390625 | 2 |
thespiae/conf/exception.py | apleshakov/thespiae | 0 | 12770628 | #
# SPDX-License-Identifier: Apache-2.0
#
# Copyright 2020 <NAME>
#
# 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 app... | 1.945313 | 2 |
tabnine-vim/third_party/ycmd/third_party/frozendict/setup.py | MrMonk3y/vimrc | 239 | 12770629 | from distutils.core import setup
setup(
name = 'frozendict',
version = '0.3',
url = 'https://github.com/slezica/python-frozendict',
author = '<NAME>',
author_email = '<EMAIL>',
packages = ['frozendict'],
license = 'MIT License',
description = 'An immutable dicti... | 1.03125 | 1 |
Python/016.py | jaimeliew1/Project_Euler_Solutions | 0 | 12770630 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Solution to Project Euler problem 16
Author: <NAME>
https://github.com/jaimeliew1/Project_Euler_Solutions
"""
def run():
n = pow(2,1000)
digitSum = sum(int(i) for i in str(n))
return digitSum
if __name__ == "__main__":
print(run())
| 2.796875 | 3 |
dependencies/src/4Suite-XML-1.0.2/Ft/Xml/Sax.py | aleasims/Peach | 0 | 12770631 | ########################################################################
# $Header: /var/local/cvsroot/4Suite/Ft/Xml/Sax.py,v 1.8 2006/04/12 21:06:09 uogbuji Exp $
"""
Abstraction module for Domlette SAX usage.
Copyright 2005 Fourthought, Inc. (USA).
Detailed license and copyright information: http://4suite.org/COPYRI... | 2.109375 | 2 |
app/forms.py | mihalw28/library_books | 1 | 12770632 | from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, TextAreaField
from wtforms.validators import DataRequired, ValidationError
from app.models import Book, Author, Category
class AddBook(FlaskForm):
title = StringField("Tytuł książki", validators=[DataRequired()])
author = StringFie... | 3.203125 | 3 |
replay_buffer.py | Jekyll1021/hindsight-experience-replay | 0 | 12770633 | <reponame>Jekyll1021/hindsight-experience-replay<filename>replay_buffer.py
import threading
import numpy as np
import time
"""
the replay buffer here is basically from the openai baselines code
"""
class replay_buffer:
def __init__(self, env_params, buffer_size, sample_func, image=False):
self.env_params... | 2.90625 | 3 |
tools/Polygraphy/tests/tools/args/onnxrt/test_loader.py | borisfom/TensorRT | 1 | 12770634 | <filename>tools/Polygraphy/tests/tools/args/onnxrt/test_loader.py
#
# Copyright (c) 2021, NVIDIA CORPORATION. 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... | 2 | 2 |
jobs/reverse_strings.py | mtahmed/antnest | 1 | 12770635 | <filename>jobs/reverse_strings.py<gh_stars>1-10
def processor(self, string):
return string[::-1]
def split(self, input_data, processor):
import taskunit
input_lines = input_data.split('\n')
for input_line in input_lines:
yield taskunit.TaskUnit(data=input_line, processor=processor)
def combine... | 3.375 | 3 |
OLD/agentModel/run.py | adamdboult/predictions | 0 | 12770636 | #!/usr/bin/env python3
#############
# Libraries #
#############
import random
import math
###########
# Classes #
###########
class person:
"""A person"""
instances = []
def __init__(self):
a = random.random()
self.prefs = [0.5, 0.5]
self.data = [a, 1 - a, 0]
... | 3.625 | 4 |
mode/examples/Basics/Structure/Loop/Loop.pyde | timgates42/processing.py | 1,224 | 12770637 | <reponame>timgates42/processing.py
"""
Loop.
The loop() function causes draw() to execute
repeatedly. If noLoop is called in setup()
the draw() is only executed once. In this example
click the mouse to execute loop(), which will
cause the draw() to execute repeatedly.
"""
y = 100
def setup():
"""
The state... | 3.78125 | 4 |
secure_mail/migrations/0001_initial.py | Imbernix/django-secure-mail | 14 | 12770638 | <reponame>Imbernix/django-secure-mail
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Key',
fields=[
... | 1.929688 | 2 |
model_zoo/YoloFastest/model/detector.py | danieltao1993/YoloAll | 190 | 12770639 | <reponame>danieltao1993/YoloAll
import torch
import torch.nn as nn
from model.fpn import *
from model.backbone.shufflenetv2 import *
class Detector(nn.Module):
def __init__(self, classes, anchor_num, load_param):
super(Detector, self).__init__()
out_depth = 112
stage_out_channels = [-1, 24... | 2.640625 | 3 |
qsiprep/interfaces/denoise.py | arokem/qsiprep | 36 | 12770640 | <filename>qsiprep/interfaces/denoise.py<gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
Interfaces for image denoising
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
import numpy as np
import nibabe... | 2.140625 | 2 |
swarm5 - Copy.py | bobmitch/swarm | 0 | 12770641 | from psyco.classes import *
from heapq import heappush, heappop
import math
import operator
import pyglet
pyglet.options['debug_gl'] = False # TURN ON FOR DEBUGGIN GL!!!
import random
from pyglet.window import key
from pyglet.window import mouse
from pyglet.gl import *
from pyglet import clock
import cop... | 2.34375 | 2 |
setup.py | ClashTheBunny/bluedesk | 6 | 12770642 | <reponame>ClashTheBunny/bluedesk
#!/usr/bin/env python3
from os import path
from distutils.core import setup
current_dir = path.abspath(path.dirname(__file__))
description_file = path.join(current_dir, 'README.md')
if path.exists(description_file):
with open(path.join(current_dir, 'README.md'), encoding='utf-8') a... | 1.59375 | 2 |
granite/analysis/example.py | codacy-badger/granite | 0 | 12770643 | <reponame>codacy-badger/granite
from markdowngenerator import MarkdownGenerator
def main():
with MarkdownGenerator(
# By setting enable_write as False, content of the file is written
# into buffer at first, instead of writing directly into the file
# This enables for example the generation ... | 3.265625 | 3 |
tests/internal/instance_type/test_instance_type_p4d_auto.py | frolovv/aws.ec2.compare | 0 | 12770644 | <gh_stars>0
# Testing module instance_type.p4d
import pytest
import ec2_compare.internal.instance_type.p4d
def test_get_internal_data_instance_type_p4d_get_instances_list():
assert len(ec2_compare.internal.instance_type.p4d.get_instances_list()) > 0
def test_get_internal_data_instance_type_p4d_get():
assert len(e... | 2.015625 | 2 |
scofield/account/urls.py | howiworkdaily/scofield-project | 4 | 12770645 | <reponame>howiworkdaily/scofield-project
from django.conf.urls.defaults import *
from account.forms import *
urlpatterns = patterns('',
url(r'^email/$', 'account.views.email', name="acct_email"),
url(r'^signup/$', 'account.views.signup', name="acct_signup"),
url(r'^login/$', 'account.views.login', name="ac... | 2.046875 | 2 |
test/e2e/live_cluster/test_show.py | jfwm2/aerospike-admin | 0 | 12770646 | <gh_stars>0
# Copyright 2013-2021 Aerospike, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | 1.695313 | 2 |
hpat/tests/test_utils.py | AlexanderKalistratov/hpat | 1 | 12770647 | import hpat
def count_array_REPs():
from hpat.distributed import Distribution
vals = hpat.distributed.dist_analysis.array_dists.values()
return sum([v == Distribution.REP for v in vals])
def count_parfor_REPs():
from hpat.distributed import Distribution
vals = hpat.distributed.dist_analysis.parf... | 2.46875 | 2 |
align.py | clamsproject/app-fastpunct | 0 | 12770648 | <reponame>clamsproject/app-fastpunct
"""align.py
Aligning two sequences. The elements of the sequences are stings or string like
elements, it is not clear to me what interface for the class is expected in the
latter case.
Originally written by <NAME>.
"""
def align(a, b, d=-5, s=lambda x,y: x==y, key=lambda x: x, ... | 3.234375 | 3 |
kolga/libs/service.py | Hi-Fi/kolga | 7 | 12770649 | from pathlib import Path
from typing import Dict, List, Mapping, Optional, Set
from kolga.utils.general import get_environment_vars_by_prefix, get_project_secret_var
from kolga.utils.models import HelmValues
class Service:
"""
A service is a by Helm deployable software
A service takes care of storing th... | 2.46875 | 2 |
meta_info_tools/test_meta_html.py | fawzi/meta-tools | 0 | 12770650 | <gh_stars>0
import unittest
from .meta_html import *
from .test_meta_schema import metaMetaSchema
import io
import json
import tempfile, shutil
class TestMetaHtml(unittest.TestCase):
"""tests the documentation generation"""
def test_md2html(self):
"tests markdown to html conversion (and math and meta... | 2.875 | 3 |