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 |
|---|---|---|---|---|---|---|
pmfp/entrypoint/grpc/build_/core.py | Python-Tools/pmfp | 4 | 47700 | <gh_stars>1-10
from pmfp.utils.endpoint import EndPoint
from ..core import grpc
class Build(EndPoint):
"""根据grpc的定义protobuf文件编译指定语言的模块.
需要本地有`protoc`,可以在`https://github.com/protocolbuffers/protobuf/releases`下载安装
"""
argparse_noflag = "serv_file"
schema = {
"$schema": "http://json-schema.o... | 1.898438 | 2 |
test/modules/tls/env.py | samkenxstream/httpd | 0 | 47701 | <filename>test/modules/tls/env.py
import inspect
import logging
import os
import re
import subprocess
from datetime import timedelta, datetime
from typing import List, Optional, Dict, Tuple, Union
from pyhttpd.certs import CertificateSpec
from pyhttpd.env import HttpdTestEnv, HttpdTestSetup
from pyhttpd.result import... | 2.328125 | 2 |
textattack/goal_functions/text/__init__.py | fighting41love/TextAttack | 2 | 47702 | from .non_overlapping_output import NonOverlappingOutput | 1.054688 | 1 |
scenarios/Gramineae.py | 865699871/IAGS_version1.0 | 5 | 47703 | from models.MultiGMPmodel import MultiCopyGMPmodel
from models.MultiGGHPmodel import MultiCopyGGHPmodel
from util.calculatedCRBrateAndEstimationAccuracy import calculatedCRBrateAndEstimationAccuracy
from util.cutCircularChromosomes import cutCircularChromosomes
"""
Inferring ancestor species for Gramineae species.
An... | 1.929688 | 2 |
service/models.py | robscarvalho8/currency_converter | 0 | 47704 | <gh_stars>0
from sqlalchemy import Column, Date, Integer, String, Float
from database import Base
class Currency(Base):
__tablename__ = "currency"
id = Column(Integer, primary_key=True, autoincrement=True)
name = Column(String)
abbreviated = Column(String)
dolar_quotation = Column(Float)
dat... | 2.796875 | 3 |
ads/opctl/constants.py | oracle/accelerated-data-science | 20 | 47705 | <filename>ads/opctl/constants.py<gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8; -*-
# Copyright (c) 2022 Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
DEFAULT_OCI_CONFIG_FILE = "~/.oci/config"
DEFAULT_PROFILE = "DEFAU... | 1.375 | 1 |
Threading/camera_thread.py | Oreowong/usv-based-on-raspberry | 0 | 47706 | <reponame>Oreowong/usv-based-on-raspberry
import os
import threading
import time
class Camthread:
def __init__(self):
self.working = False
#使用mjpg-streamer来实时传输视频
def receive(self):
if self.working == True:
os.system('/home/pi/mjpg-streamer-master/mjpg-streamer-experimental/mjpg_streamer -i "/home/pi/mjpg-s... | 2.484375 | 2 |
app/controllers/labels_controller.py | diegofigs/ths-client | 0 | 47707 | <gh_stars>0
from flask import request, Blueprint, Response
# Import the database object (db) from the main application module
# and the app object to initialize the flask_login manager
from app import app, db
# Import module models (i.e. User)
from app.models.tweets_model import Tweet
from app.models.labels_model impo... | 2.796875 | 3 |
stanCode_Projects/boggle_game_solver/boggle.py | yjchang-tw/sc-projects | 0 | 47708 | """
File: boggle.py
Name:
----------------------------------------
TODO:
"""
# This is the file name of the dictionary txt file
# we will be checking if a word exists by searching through it
FILE = 'dictionary.txt'
dict_list = []
final = []
def main():
"""
TODO:
"""
read_dictionary()
temp = ''
word_lst = []
for... | 3.796875 | 4 |
tags/urls.py | jrdbnntt/FaceTags | 0 | 47709 | from django.conf.urls import url
import views
urlpatterns = [
url(r'^user/', views.get_user, name='user'),
url(r'^all/', views.get_all, name='all'),
url(r'^fix/$', views.get_fix, name='fix'),
]
| 1.5625 | 2 |
rpse_count.py | Alejowilches0112/rpse | 0 | 47710 | <filename>rpse_count.py
# coding=UTF-8
import re
from collections import Counter
import unicodedata
import json as js
import ujson as json
from pyspark.sql.types import StructType, StructField, StringType, LongType
from sparkcc import CCSparkJob
from bs4 import BeautifulSoup
from bs4.dammit import EncodingDetector
... | 2.140625 | 2 |
code/utils.py | Riccorl/ml-malware-classifier | 5 | 47711 | <filename>code/utils.py
def timer(start: float, end: float) -> str:
"""
Timer function. Compute execution time from strart to end (end - start).
:param start: start time
:param end: end time
:return: end - start
"""
hours, rem = divmod(end - start, 3600)
minutes, seconds = divmod(rem, 60... | 3.40625 | 3 |
sky/tools/webkitpy/tool/commands/__init__.py | domenic/mojo | 5 | 47712 | <reponame>domenic/mojo
# Required for Python to search this directory for module files
from webkitpy.tool.commands.prettydiff import PrettyDiff
from webkitpy.tool.commands.queries import *
from webkitpy.tool.commands.rebaseline import Rebaseline
| 1.242188 | 1 |
program_synthesis/scripts/evaluate_beams_result.py | sunblaze-ucb/SED | 6 | 47713 |
import os
import argparse
import json
import tqdm
import numpy as np
from program_synthesis.datasets import dataset, executor
parser = argparse.ArgumentParser()
parser.add_argument("--data-pickle", default='data/karel/val.pkl')
parser.add_argument("--input-file", required=True, help="file containing list of beams,... | 2.359375 | 2 |
malib/envs/gr_football/__init__.py | ReinholdM/play_football_with_human | 5 | 47714 | from .grf_env import BaseGFootBall as base_env, ParameterSharingWrapper
from .encoders import encoder_basic, encoder_highpass, rewarder_basic
default_config = {
# env building config
"use_built_in_GK": True,
"scenario_config": {
"env_name": "5_vs_5",
"number_of_left_players_agent_controls":... | 1.8125 | 2 |
flowsa/NOAA_FisheryLandings.py | cchiq/flowsa | 0 | 47715 | <filename>flowsa/NOAA_FisheryLandings.py
# write_NOAA_fisheries_from_csv.py (scripts)
# !/usr/bin/env python3
# coding=utf-8
# <EMAIL>
"""
This script is run on it's own, not through flowbyactivity.py, as data pulled from csv in flowsa.
NOAA fisheries data obtained from: https://foss.nmfs.noaa.gov/apexfoss/f?p=215:20... | 2.75 | 3 |
tools/perf/contrib/cluster_telemetry/rasterize_and_record_micro_ct.py | zealoussnow/chromium | 14,668 | 47716 | # 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.
from contrib.cluster_telemetry import ct_benchmarks_util
from contrib.cluster_telemetry import page_set
from contrib.cluster_telemetry import repaint_helpers... | 1.929688 | 2 |
invenio_vocabularies/datastreams/datastreams.py | mitsosf/invenio-vocabularies | 0 | 47717 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2021-2022 CERN.
#
# Invenio-Vocabularies is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see LICENSE file for more
# details.
"""Base data stream."""
from .errors import ReaderError, TransformerError, WriterError
class Stream... | 3 | 3 |
api/models/datasets.py | weng-lab/SCREEN | 5 | 47718 | <reponame>weng-lab/SCREEN
#!/usr/bin/env python3
# SPDX-License-Identifier: MIT
# Copyright (c) 2016-2020 <NAME>, <NAME>, <NAME>, <NAME>
import requests
import json
import os
import sys
class Datasets:
def __init__(self, assembly, pgSearch):
self.assembly = assembly
rows = pgSearch.allDatasets(... | 2.1875 | 2 |
tead/event.py | JeFaProductions/TextAdventure2 | 2 | 47719 | import queue
ROOM_ENTERED = 'roomEntered'
class Event:
def __init__(self, eventType='', userParam=dict()):
self.type = eventType
self.userParam = userParam
class EventSystem:
def __init__(self):
self._eventQueue = queue.Queue()
self._eventHandlers = dict()
def registerE... | 3.359375 | 3 |
quantmotion/convert.py | jmcph4/quantmotion | 0 | 47720 | <gh_stars>0
from datetime import datetime
import csv
from io import StringIO
from .ohlcvdata import OHLCVData
from .timeseries import TimeSeries
DEFAULT_CSV_DELIMITER = ","
DEFAULT_CSV_QUOTE = '"'
def convert_csv_to_time_series(csv_data, dt_fmt):
"""
convert_csv_to_time_series(csv_data) -- parse csv_data to ... | 3.078125 | 3 |
Tutorials/tao-python/tao2.py | fovtran/PyGame_samples | 0 | 47721 | <gh_stars>0
import sys, time
import clr
clr.AddReferenceToFile("./libs/Tao.OpenGl.dll")
clr.AddReferenceToFile("./libs/Tao.FreeGlut.dll")
import Tao.OpenGl.Gl as Gl
import Tao.OpenGl.Glu as Glu
import Tao.FreeGlut.Glut as Glut
def init_graphics():
Gl.glEnable(Gl.GL_LIGHTING)
Gl.glEnable(Gl.GL_LIGHT0)
Gl.glLightfv(... | 1.789063 | 2 |
tool/rst2html_pygments.py | Tonhoko/cmemo | 138 | 47722 | <reponame>Tonhoko/cmemo<filename>tool/rst2html_pygments.py
#!/usr/bin/python
# :Author: <NAME>, the Pygments team, <NAME>
# :Date: $Date: $
# :Copyright: This module has been placed in the public domain.
# This is a merge of the docutils_ `rst2html` front end with an extension
# suggestion taken from the pygments_ do... | 1.945313 | 2 |
Validation/RecoTau/python/config_costom.py | jolim97/cmssw | 0 | 47723 | import os
import FWCore.ParameterSet.Config as cms
process = cms.Process('TauDQMOffline')
process.load("FWCore.MessageLogger.MessageLogger_cfi")
process.MessageLogger.cerr.FwkReport.reportEvery = 1000
# import of standard configurations
from Configuration.StandardSequences.GeometryRecoDB_cff import *
process.load(... | 1.445313 | 1 |
2016/python/day20.py | astonshane/AdventOfCode | 0 | 47724 | MAX = 4294967295
blacklist = []
with open("inputs/day20.txt") as f:
for line in f:
line = line.strip().split('-')
blacklist.append([int(x) for x in line])
blacklist.sort()
def part1():
ip = 0
for i in range(0, len(blacklist)):
bl = blacklist[i]
if ip < bl[0]:
... | 2.578125 | 3 |
Optuna.py | Dekakhrone/EEGNet | 2 | 47725 | import os
import numpy as np
import tensorflow as tf
import tensorflow_addons as tfa
from loguru import logger
import config
from Train import train
from Model import EEGNet
class OptunaTrainer:
def __init__(self, checkpointPath, epochs, batchsize, logPath=None):
self.checkpointPath = checkpointPath
self.logpa... | 2.15625 | 2 |
cmdpy.py | Sujaykumarh/CmdPy | 0 | 47726 | <filename>cmdpy.py
#!/usr/bin/python
import argparse, subprocess
_appName = "CmdPy" # App Name
_appVer = "0.0.1" # App Version
_input_file = '' # Global Variable for input file location
_output_file = '' # Global Variable for output file location
_command = '' # Global Variable for command
_overwrite_file = Fals... | 3.140625 | 3 |
pixstyle.py | dancer69/2048pyqt | 2 | 47727 | from PyQt5 import QtGui, QtWidgets, QtCore
class RoundPixmapStyle(QtWidgets.QProxyStyle):
def __init__(self, radius=10, *args, **kwargs):
super(RoundPixmapStyle, self).__init__(*args, **kwargs)
self._radius = radius
def drawItemPixmap(self, painter, rectangle, alignment, pixmap):
pain... | 2.578125 | 3 |
qcodes/instrument_drivers/QuTech/D4.py | generalui/Qcodes-Package | 5 | 47728 | from qcodes import Instrument
try:
from spirack import D4_module
except ImportError:
raise ImportError(('The D4_module class could not be found. '
'Try installing it using pip install spirack'))
from functools import partial
class D4(Instrument):
"""
Qcodes driver for the D4 A... | 2.578125 | 3 |
test/test_centerline_operations.py | KVSlab/vascularManipulationToolkit | 19 | 47729 | ## Copyright (c) <NAME>, <NAME>. All rights reserved.
## See LICENSE file for details.
## This software is distributed WITHOUT ANY WARRANTY; without even
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
## PURPOSE. See the above copyright notices for more information.
from .f... | 2.25 | 2 |
typistry/validators/yaml.py | kyprifog/typistry | 0 | 47730 | from typing import Optional
import yaml
from returns.result import Result, Success, Failure
from typistry.protos.invalid_object import InvalidObject, IgnorableObject
from typistry.protos.typed_dict import TypedDict
def safe_parse_yaml(file: str, include_file: bool = False, filter_type: Optional[str] = None) -> Resu... | 2.40625 | 2 |
data/county_level/raw/cmu_covidcast/load.py | csinva/covid-19-analysis | 2 | 47731 | <gh_stars>1-10
#!/usr/bin/python3
import pandas as pd
from os.path import join as oj
import os
import covidcast
from datetime import date
def load_cmu_covidcast(data_dir='.'):
''' Load in CMU COVIDcast (county-level) data set (pulled directly from source)
Parameters
----------
data_dir : str; pat... | 2.4375 | 2 |
src/sites/nefilim.py | LAC-Japan/ransomwatch | 244 | 47732 | from datetime import datetime
import logging
from bs4 import BeautifulSoup
from db.models import Victim
from net.proxy import Proxy
from .sitecrawler import SiteCrawler
import time
class Nefilim(SiteCrawler):
actor = "Nefilim"
def _handle_page(self, soup):
victim_list = soup.find_all("header", ... | 2.578125 | 3 |
model.py | Riksi/nerf | 0 | 47733 | <filename>model.py
import tensorflow as tf
import math
from helpers import get_rays, ndc_rays
def get_sample_bounds(near, far, num_samples):
diff = (far - near)
idx = tf.range(num_samples)
diff_term = diff / num_samples
start = near + idx * diff_term
end = start + diff_term
return start, end
... | 2.34375 | 2 |
diagnostics/diagnostic_analysis/scripts/export_csv.py | zhj-buffer/ROS2-driver-for-Realsense | 2 | 47734 | #!/usr/bin/python
#
# Software License Agreement (BSD License)
#
# Copyright (c) 2008, <NAME>, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must ret... | 1.335938 | 1 |
lessons/02_spacetime/working/space_time.py | PaulM5406/numerical-mooc | 0 | 47735 | import numpy
import sympy
from matplotlib import pyplot
from sympy.utilities.lambdify import lambdify
# Set the font family and size to use for Matplotlib figures.
pyplot.rcParams['font.family'] = 'serif'
pyplot.rcParams['font.size'] = 16
sympy.init_printing()
x, nu, t = sympy.symbols('x nu t')
phi = (sympy.exp(-(x ... | 2.296875 | 2 |
tests/test_emulator.py | maldieve/luma.emulator | 0 | 47736 | <filename>tests/test_emulator.py<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2017-18 <NAME> and contributors
# See LICENSE.rst for details.
"""
Tests for :py:class:`luma.emulator.device.emulator`.
"""
from luma.emulator.device import emulator
import pytest
import pygame
from PIL import... | 2.203125 | 2 |
src/schedulers/capacity_coefficient_scheduler.py | jp172/covid19-hospital-scheduler | 5 | 47737 | <reponame>jp172/covid19-hospital-scheduler<filename>src/schedulers/capacity_coefficient_scheduler.py
from .utils import get_feasible_hospitals
from ..objects.proposal import RankedProposal
class CapacityScheduler:
def assign_request(self, instance, request):
hospitals = instance.get_hospitals_in_area(re... | 2.734375 | 3 |
picha/forms.py | amon-wanyonyi/gallery-app | 0 | 47738 | from django import forms
from django.forms import ModelForm
from .models import Category,Image, Location
class ImageForm(forms.ModelForm):
class Meta:
model = Image
fields = '__all__'
CATEGORIES =(
("1", "Cars"),
("2", "Food"),
("3", "Travel"),
("4", "Animals"),
("5", "N... | 2.515625 | 3 |
functional_tests/test_simple_list_creation.py | migglu/todo-lists | 0 | 47739 | from .base import FunctionalTest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
class NewVisitorTest(FunctionalTest):
def test_can_start_a_list_and_retrieve_it_later(self):
self.browser.get(self.server_url)
self.assertIn("To-Do", self.browser.title)
header... | 2.65625 | 3 |
ltr/actors/__init__.py | Jee-King/ICCV2021_Event_Frame_Tracking | 15 | 47740 | <filename>ltr/actors/__init__.py
from .base_actor import BaseActor
from .bbreg import AtomActor
from .tracking import DiMPActor, KYSActor | 1.203125 | 1 |
unit_06/car7.py | janusnic/21v-pyqt | 0 | 47741 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sqlite3 as lite
import sys
uId = 1
uPrice = 62300
con = lite.connect('test.db')
with con:
cur = con.cursor()
cur.execute("UPDATE Cars SET Price=? WHERE Id=?", (uPrice, uId))
con.commit()
print "Number of rows updated: %d" % cur.row... | 2.59375 | 3 |
reservoir_nn/keras/rewiring_test.py | keras-team/reservoir_nn | 3 | 47742 | # Copyright 2021 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, ... | 2.125 | 2 |
src/lib/debuggers/trictdet.py | ivalab/GraspKpNet | 16 | 47743 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
import numpy as np
from progress.bar import Bar
import torch
import math
import copy
from .base_debugger import BaseDebugger
from models.utils import _tranpose_and_gather_feat, _gather_feat
from mo... | 1.820313 | 2 |
packages/pyright-internal/src/tests/samples/properties3.py | Jasha10/pyright | 3,934 | 47744 | # This sample tests the type checker's ability to handle
# custom subclasses of property.
from typing import Any, Callable
class custom_property1(property):
pass
class Custom1(object):
@custom_property1
def x(self) -> int:
return 3
@custom_property1
def y(self) -> float:
retur... | 3.109375 | 3 |
azul/base_price_manager.py | brettelliot/azul | 7 | 47745 | import logbook
import pandas as pd
import zipline as zl
from datetime import datetime, timedelta
import pathlib
import azul
import numpy as np
from typing import List, Tuple
log = logbook.Logger('BasePriceManager')
class BasePriceManager(object):
def __init__(self, calendar_name='NYSE'):
self._calendar ... | 2.5 | 2 |
maxwellbloch/ob_base.py | amcdawes/maxwellbloch | 0 | 47746 | <reponame>amcdawes/maxwellbloch
# -*- coding: utf-8 -*-
import os
from maxwellbloch import sigma
import numpy as np
import qutip as qu
class OBBase(object):
""" TODO: Desc here. Parent class.
Attributes:
num_states: the number of states of the system, in this case: 2.
rho: the density matr... | 2.953125 | 3 |
cs3api4lab/tests/test_cs3_share_api.py | SoftwareMind-ScienceMesh/cs3api4lab | 2 | 47747 | from unittest import TestCase
from unittest import skip
from cs3api4lab.api.cs3_share_api import Cs3ShareApi
from cs3api4lab.api.cs3_file_api import Cs3FileApi
from cs3api4lab.config.config_manager import Cs3ConfigManager
from traitlets.config import LoggingConfigurable
class TestCs3ShareApi(TestCase, LoggingConfigur... | 2.078125 | 2 |
Dcard.py | funkman56/Dcard | 0 | 47748 | # -*- coding: utf-8 -*-
"""
Created on Mon Jul 1 23:11:03 2019
@author: Relieak
"""
'''
DCARD 熱門前30文章搜尋
純用 BeautifulSoup 寫法
'''
from bs4 import BeautifulSoup
import requests
import re
url = "https://www.dcard.tw/f/"
html = requests.get(url)
html.encoding = "utf-8"
#print(html.text)
sp = BeautifulSoup(html.text... | 2.859375 | 3 |
python/statrollers/4d6droplowest.py | exposit/katamoiran | 6 | 47749 | import random
import sys
print("")
print("4d6, drop lowest:")
print("")
def roll4d6():
global threshold
target_met = False
total = []
for attr in range(0,6):
result = []
raw = []
for roll in range(0,4):
dice = random.randint(1,6)
result.append(dice)
... | 3.4375 | 3 |
strategypy/bots/unittest_moveleft.py | davide-ceretti/strategypy | 8 | 47750 | def action(ctx):
return 'move left'
| 1.390625 | 1 |
mct_xml_tools/src/mct_xml_tools/machine.py | iorodeo/mct | 0 | 47751 | from __future__ import print_function
import os
import os.path
from xml.etree import ElementTree
def read_machine_file():
"""
Reads the machine definition xml ROS launch file MCT_CONFIG/machine/mct.machine
Returns a list containg a dictionary of attributes for each machine in the
machine file.
... | 3.140625 | 3 |
flask/sqlitDb.py | ddgvv/SMDA | 0 | 47752 | <gh_stars>0
import json
import sqlite3
def getQuery(index,queryName):
with open('data.txt') as json_file:
data = json.load(json_file)
return data['query'][index][queryName]
def runQuery(index,queryName):
conn = sqlite3.connect('test.db')
conn.execute(getQuery(index,queryName))
conn.commit()
print ("Table c... | 3.25 | 3 |
checkFailedImages.py | NGTS/frame-movies | 0 | 47753 | #!/usr/local/python/bin/python
# script to check the previously unsolved files
#
# to do:
# Sanity check all the image_ids in the table actually have a png
# quick check shows 1349 in DB and 1353 pngs, 4 out, not bad
#
from create_movie import create_movie
import os,sys,getpass,time
import glob as g
from astropy.io... | 2.515625 | 3 |
merger/download-all-docs.py | andyil/baguette | 0 | 47754 |
from csv import DictReader
from os.path import dirname, join, exists
from os import makedirs, stat
from concurrent.futures import ThreadPoolExecutor, as_completed
import urllib.request
from time import time
def get_file_by_case(case):
D = r'C:\Users\andy\supreme-court-scrap\documents-from-student-decoding'
pa... | 2.921875 | 3 |
get_pop/modules/helper/move.py | SimmonsRitchie/get-pop | 1 | 47755 | from pathlib import Path
from shutil import copyfile
import logging
def move_files(dir_from: Path, dir_to: Path):
logging.info(f"Moving files from '{dir_from}' to '{dir_to}'")
p = dir_from.glob("**/*")
input_paths = [x for x in p if x.is_file()]
for input_path in input_paths:
filename = input_... | 3.1875 | 3 |
emotion.py | im2856813/Sentistock-core | 2 | 47756 | #!/usr/bin/python
#-*-coding=utf-8-*-
import json
import jieba
class emo:
dict = {}
emoVal = {}
emodir = "emo_dict"
def __init__(self,dictname):
self.dict = self.loadDict(dictname)
def loadDict(self,dictname):
path = "./"+self.emodir+"/"+dictname+".json"
print ("l... | 3.0625 | 3 |
Project_Euler/01_mults_3_or_5/find_sum.py | perlygatekeeper/glowing-robot | 2 | 47757 | #!/opt/local/bin/python
sum_3_5 = 0
for i in range(1,1000):
if i % 3 == 0 or i % 5 == 0:
print(i)
sum_3_5 += i
print(sum_3_5)
| 3.59375 | 4 |
project/agents/agent.py | msaska9/gym-multigrid | 0 | 47758 | import random
import numpy as np
from gym_multigrid.multigrid import World
from gym_multigrid.multigrid import DIR_TO_VEC
from gym_multigrid.multigrid import Actions
class Agent:
def __init__(self, agent_id, agent_type=0):
self.id = agent_id
self.total_reward = 0
self.action_probabilities ... | 2.796875 | 3 |
mnu_gsheets/utils/user_agent.py | seanbreckenridge/mnu_gsheets | 1 | 47759 | <reponame>seanbreckenridge/mnu_gsheets
from random import choice
user_agents = [
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108",
"Mozilla/5.0 (Windows NT 5.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90",
"Mozilla/5.0 (Wind... | 2.65625 | 3 |
db_upgrade.py | dnaroid/laser-server | 0 | 47760 | <reponame>dnaroid/laser-server
#!env/bin/python
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
api.upgrade(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
print('Current database version: ' + str(api.db_version(
SQLALCHEMY_DATABASE_URI, S... | 1.898438 | 2 |
data_process.py | bisno/MER | 1 | 47761 | # -*- coding: UTF-8 -*-
import glob
import numpy as np
import pandas as pd
from PIL import Image
import random
# h,w = 60,50
h, w = (60, 50)
size = h * w
# Receding_Hairline Wearing_Necktie Rosy_Cheeks Eyeglasses Goatee Chubby
# Sideburns Blurry Wearing_Hat Double_Chin Pale_Skin Gray_Hair Mustache Bald
... | 2.453125 | 2 |
playlist_creation/migrations/0002_create_privacy_policy_flatpage.py | theLionWar/time_capsule | 0 | 47762 | # Generated by Django 3.2.4 on 2021-08-03 15:02
from django.contrib.sites.management import create_default_site
from django.db import migrations
def create_privacy_policy_flatpage(apps, schema_editor):
Site = apps.get_model("sites", "Site")
site = Site.objects.first()
if not site:
create_default_s... | 1.859375 | 2 |
Inheritence.py | neocodejack/python-practice | 0 | 47763 | <filename>Inheritence.py<gh_stars>0
class Animal(object):
def __init__(self, name):
self.name = name
def eat(self, food):
print("%s is eating %s" % (self.name, food))
class Dog(Animal):
def fetch(self, thing):
print("%s goes after the %s" % (self.name, thing))
class Cat(Animal):
... | 3.546875 | 4 |
rockiot/app/migrations/0039_auto_20211015_1658.py | isocserbia/rockiot | 2 | 47764 | # Generated by Django 3.2.8 on 2021-10-15 16:58
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0038_auto_20211012_1634'),
]
operations = [
migrations.RenameField(
model_name='device',
old_name='erase_wifi_credent... | 1.617188 | 2 |
profiles_api/views.py | singhmonika10/profiles-rest-api | 0 | 47765 | from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
from rest_framework import viewsets
from rest_framework.authentication import TokenAuthentication
from rest_framework import filters
from profiles_api import serializers
from profiles_api import mo... | 2.375 | 2 |
canvas_course_site_wizard/tests/test_view_canvas_course_site_create.py | Harvard-University-iCommons/django-canvas-course-site-wizard | 0 | 47766 | __author__ = 'ely817'
| 0.933594 | 1 |
mprocessing/client.py | ftranschel/evoMPS | 1 | 47767 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This module is part of
an extension of evoMPS by adding
dissipative dynmaics based on
Monte-Carlo methods.
This part is the client file
for the distributed computing
framework that utilizes parallel
processing to speed up dissipative
dynamics.
@author: <NAME>
"""
im... | 2.40625 | 2 |
lib/modeling/pcb.py | hanleiyu/prcv | 1 | 47768 | <filename>lib/modeling/pcb.py
from __future__ import division, absolute_import
import torch.utils.model_zoo as model_zoo
import torch
from torch import nn
from torch.nn import functional as F
from .backbones import build_backbone
from lib.layers.pooling import GeM
from lib.layers.metric_learning import Arcface, Cosface... | 2.109375 | 2 |
Practice/Beginner/Number Mirror/PYTHON/number-mirror.py | avantikat/codechef-1 | 2 | 47769 | <reponame>avantikat/codechef-1<gh_stars>1-10
"""
AUTHOR - <NAME>
GITHUB - https://github.com/AtharvaD11
QUESTION LINK - https://www.codechef.com/problems/START01
"""
**********************************
n = int(input())
print(n)
| 2.265625 | 2 |
.modules/.recon-ng/modules/reporting/pushpin.py | termux-one/EasY_HaCk | 1,103 | 47770 | <gh_stars>1000+
from recon.core.module import BaseModule
import codecs
import os
import re
import time
import webbrowser
class Module(BaseModule):
meta = {
'name': 'PushPin Report Generator',
'author': '<NAME> (@LaNMaSteR53)',
'description': 'Creates HTML media and map reports for all of t... | 2.296875 | 2 |
conv-ae/preprocess.py | QuantumFractal/hackisu-2017-nucleus | 2 | 47771 | <filename>conv-ae/preprocess.py
import matplotlib.pyplot as plt
import numpy as np
from patcher import Patcher
import os
import random
from sklearn.feature_extraction import image
import h5py
import gc
import sys
#dataset = sys.argv[1]
savename = sys.argv[1]
#data_path = 'C:\\nucleus\\' + dataset
dat... | 2.21875 | 2 |
auctions/models.py | adamiantorno/CS50W-commerce | 0 | 47772 | <filename>auctions/models.py
from django.contrib.auth.models import AbstractUser
from django.urls import reverse
from django.db import models
from datetime import date
class User(AbstractUser):
pass
class Listing(models.Model):
CATEGORIES = (
('ART', 'Art'),
('CLT', 'Clothing & Accessories')... | 2.421875 | 2 |
nereid/nereid/core/utils.py | phobson/nereid | 0 | 47773 | <filename>nereid/nereid/core/utils.py
from typing import Optional, Dict, Any, Tuple
from copy import deepcopy
from pathlib import Path
from nereid.core.io import load_cfg
from nereid.core.config import APP_CONTEXT
def validate_request_context(context: Dict[str, Any]) -> Tuple[bool, str]:
dp = context.get("data_... | 2.25 | 2 |
adversarial-training/codemixer.py | LaudateCorpus1/adversarial-polyglots | 10 | 47774 | # -*- coding: utf-8 -*-
import random, json, string, warnings
from typing import Union, List, Set, Dict
from simalign import SentenceAligner
from nltk.translate.phrase_based import phrase_extraction
class CodeMixer(object):
def __init__(self, matrix_lg: str, embedded_lgs: Union[List[str],Set[str]], device='cuda',... | 2.578125 | 3 |
pycodes/__init__.py | blazaid/pycodes | 0 | 47775 | __version__ = '0.0.1'
__url__ = 'http://github.com/blazaid/pycodes/'
__author__ = 'blazaid'
def check_ean13():
pass | 0.976563 | 1 |
main.py | Raymonzut/NATO-phonetic-alphabet | 0 | 47776 | #! python3
# To write files and make a directory
import os
# To filter string
import re
# For sleeping
import time
# Googles Text to speech lib
from gtts import gTTS
# File info reader, in this case, it is for determening the length of a mp3
from mutagen.mp3 import MP3
def format_text(text: str):
"""
Rem... | 3.71875 | 4 |
0077_Combinations/python/solution.py | jeffvswanson/LeetCode | 0 | 47777 | <gh_stars>0
"""
77. Combinations
Given two integers n and k, return all possible combinations of k numbers out of the range [1, n].
You may return the answer in any order.
Examples
--------
Example 1:
Input: n = 4, k = 2
Output:
[
[2,4],
[3,4],
[2,3],
[1,2],
[1,... | 3.765625 | 4 |
CameraToServer/python/client/SendDataWithSSL.py | yabuta/CameraSender | 0 | 47778 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import socket
import cv2
import time
import threading
import datetime
import ssl
import readSettings as RS
"""
send picture per 5 second.
when called stop, thread finish.
picture convert from mat to jpeg
"""
class SendThread(threading.Thread):
def __init__(self... | 2.953125 | 3 |
src/noelbundick/azext_noelbundick/__init__.py | vijayraavi/azure-cli-extension-noelbundick | 0 | 47779 | import importlib
from azure.cli.core import AzCommandsLoader
from ._help import helps
# Imported modules MUST implement load_command_table and load_arguments
# Imported modules CAN optionally implement init
module_names = ['ad', 'aks', 'browse', 'cloudshell', 'functionapp', 'loganalytics', 'self_destruct', 'vm']
#... | 2.359375 | 2 |
Data/Database/addPics.py | jessalbarian/CUApps | 0 | 47780 | #!/usr/bin/env python
import json
jsonFile = open('temp.json', 'r')
jsonData = json.load(jsonFile)
places = jsonData["places"]
for item in places:
originalArray = places[item]
newArray = ["default"]
for originalPiece in originalArray:
newArray.append(originalPiece)
places[item] = newArray
jsonData["places"] ... | 3.265625 | 3 |
swig/build.py | ShawnZhong/python-c-extension | 0 | 47781 | from setuptools import setup, Extension
setup(ext_modules=[
Extension('_module', sources=["module_wrap.c"])
]) | 1.148438 | 1 |
appengine_config.py | mjd119/Habit-Tracker | 0 | 47782 | from gaesessions import SessionMiddleware
# suggestion: generate your own random key using os.urandom(64)
# WARNING: Make sure you run os.urandom(64) OFFLINE and copy/paste the output to
# this file. If you use os.urandom() to *dynamically* generate your key at
# runtime then any existing sessions will become junk ev... | 2.34375 | 2 |
donut/modules/rooms/__init__.py | rlin0/donut | 0 | 47783 | import flask
blueprint = flask.Blueprint('rooms', __name__, template_folder='templates')
from . import routes
| 1.421875 | 1 |
PyFunceble/checker/syntax/domain_base.py | Centaurioun/PyFunceble | 213 | 47784 | <reponame>Centaurioun/PyFunceble
"""
The tool to check the availability or syntax of domain, IP or URL.
::
██████╗ ██╗ ██╗███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗██████╗ ██╗ ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝██╔══██╗██║ ██╔════╝
██████╔╝ ╚████╔╝ █████╗ ██║... | 2.046875 | 2 |
pygamev14.py | HRALYB-PYGAME/PYGAME | 0 | 47785 | <reponame>HRALYB-PYGAME/PYGAME
# -*- coding: UTF-8 -*-
import pygame
import time
import random
pygame.init()
win = pygame.display.set_mode((3300,1900))
pygame.display.set_caption("hralyb best game")
x = 0
y = 0
widht = 100
height = 100
x2 = 2900
y2 = 1800
widht2 = 100
height2 = 100
vel = 100
vel2 = 100
... | 2.96875 | 3 |
test/git_copy_test.py | rec/gitz | 24 | 47786 | <filename>test/git_copy_test.py
from gitz.git import GIT
from gitz.git import functions
from gitz.git import repo
import unittest
class GitCopyTest(unittest.TestCase):
@repo.test
def test_simple(self):
repo.make_commit('1')
GIT.new('one')
GIT.copy('two', '-v')
expected = {'orig... | 2.34375 | 2 |
python/testData/resolve/DocStringModule.py | jnthn/intellij-community | 2 | 47787 | "Docstring of our own module"
import DocStringModule as m
m._<ref>_doc__
| 1.21875 | 1 |
apps/notice/serializers.py | slyslyme/CTF_AWD_Platform | 85 | 47788 | from rest_framework import serializers
from .models import NoticeProfile
class NoticeSerializer(serializers.ModelSerializer):
class Meta:
model = NoticeProfile
fields = "__all__" | 1.796875 | 2 |
ndnt/paths.py | Masynchin/ndnt | 1 | 47789 | <reponame>Masynchin/ndnt
"""Paths interface and its implementations."""
from pathlib import Path
from typing import Iterable
from pathspec import PathSpec
from pathspec.patterns import GitWildMatchPattern
from ndnt.extension import Extension
class Paths(Iterable[Path]):
"""Paths inteface.
`Paths` behaves ... | 2.28125 | 2 |
Virtualenv/Env/src/GoTravel/Booking/apps.py | Anoop01234/Go-Travel | 0 | 47790 | <reponame>Anoop01234/Go-Travel
from django.apps import AppConfig
class BookingConfig(AppConfig):
name = 'Booking'
| 1.304688 | 1 |
Computer_science/B05_Python/01_Basics/S12_Debugging.py | Polirecyliente/SGConocimiento | 0 | 47791 |
# Debugging
#T# Table of contents
#C# Python debugger (pdb)
#T# Beginning of content
#C# Python debugger (pdb)
# |-------------------------------------------------------------
#T# pdb is the builtin Python debugger, it has breakpoints, stepping through the code, printing the values of variables, post-mortem deb... | 3.90625 | 4 |
bts/utilities/getUsersRedd.py | SuprPhatAnon/Burn-the-Subs | 0 | 47792 | <gh_stars>0
#sudo apt-get install python3-requests
#app had to be registered properly from the reddit thread steps
#https://www.reddit.com/r/Twitch/comments/6ycems/an_example_python_script_to_retrieve_a_list_of/
from urllib.parse import urlencode
from requests import Session
from requests.adapters import HTTPAdapter
f... | 2.5625 | 3 |
learning/LearnPython3TheHardWay/InteractiveFictionClass/GoogleColabStarterCode/Parser.py | AlexanderTN/Python | 1 | 47793 | <filename>learning/LearnPython3TheHardWay/InteractiveFictionClass/GoogleColabStarterCode/Parser.py<gh_stars>1-10
class Parser:
"""The Parser is the class that handles the player's input. The player
writes commands, and the parser performs natural language understanding
in order to interpret what the playe... | 4.0625 | 4 |
Obligatory tasks/Obligatory_task_02/02.02_exercise.py | Szymon-Budziak/ASD_exercises_solutions | 7 | 47794 | # Tablica T jest długości n, ale zawiera tylko ceil(logn) różnych wartości. Proszę zaproponować
# jak najszybszy algorytm sortujący taką tablicę.
def counting_sort(T, k):
C = [0]*len(T)
B = [0]*10
for i in range(len(T)):
index = T[i]/k
B[int(index % 10)] += 1
for i in range(1, 10):
... | 3.640625 | 4 |
python3/numpy/numpy_absolute.py | Nahid-Hassan/code-snippets | 2 | 47795 | """
Created on Sat Mar 23 00:23:27 2019
@author: nahid
"""
#https://docs.scipy.org/doc/numpy/reference/generated/numpy.absolute.html
import numpy as np
import matplotlib.pyplot as plt
x = np.array([-1.2, 1.2])
x = np.absolute(x)
print(x)
print(np.absolute(1 + 2j))
#Plot the function over [-10, 10]:
x = np.linspace(-1... | 3.265625 | 3 |
fa_management_server/utils/__init__.py | Msms-NJ/fa_management_server | 0 | 47796 | <reponame>Msms-NJ/fa_management_server<gh_stars>0
# -*- coding: utf-8 -*-
from flask import jsonify, Blueprint
from flask.views import MethodView
from flask_login import login_required
from collections import ChainMap
from .custom_json_encoder import CustomJsonEncoder
def response_common(error_code=1, error_message=N... | 2.03125 | 2 |
src/ctc/toolbox/lending_utils/lending_summary.py | fei-protocol/checkthechain | 94 | 47797 | from __future__ import annotations
import asyncio
import typing
import types
import pandas as pd
import tooltime
from ctc import evm
from ctc import spec
async def async_get_lending_flows(
wallet: spec.Address,
pool_token: spec.ERC20Reference,
protocol: typing.Literal['aave', 'compound', 'rari'],
w... | 2.1875 | 2 |
dresscolor.py | christarazi/dresscolor | 0 | 47798 | from PIL import Image, ImageDraw
im = Image.open("a.jpg")
im = im.resize((150,150))
result = im.convert('P', palette=Image.ADAPTIVE, colors=8)
result.putalpha(0)
colors = result.getcolors(150*150)
newimg = Image.new('RGB', (64*8, 64))
draw = ImageDraw.Draw(newimg)
posx = 0
for row, col in colors:
draw.rectangle([po... | 3.0625 | 3 |
baseline_model/constants.py | rtoengi/transfer-learning-for-sign-language-recognition | 1 | 47799 | # List of the training runs for the different target dataset sizes
TRAINING_RUNS = [
'large_dataset/20200616_090434',
'medium_dataset/20200616_214425',
'small_dataset/20200617_143139'
]
| 1.390625 | 1 |