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 |
|---|---|---|---|---|---|---|
compare.py | andrewyatz/refget-application-note | 0 | 12770251 | #!/usr/bin/env python3
import sys
import os.path
import gzip
from os import path
def process_file(file, output_file):
if path.exists(file) == False:
print("Cannot continue because {} does not exist".format(file), file=sys.stderr)
sys.exit(1)
if path.exists(output_file) == True:
os.rem... | 3.296875 | 3 |
tests/clients/test_users.py | unparalleled-js/py42 | 0 | 12770252 | # -*- coding: utf-8 -*-
import json
import pytest
from requests import Response
import py42.settings
from py42.clients.users import UserClient
from py42.response import Py42Response
USER_URI = "/api/User"
DEFAULT_GET_ALL_PARAMS = {
"active": None,
"email": None,
"orgUid": None,
"roleId": None,
"... | 2.328125 | 2 |
VFD_MDM166.py | pluschris/VFD_MDM166 | 1 | 12770253 | #!/usr/bin/python3
# #####################################
# info: This class can connect to VFD MDM166
#
# date: 2017-06-13
# version: 0.1.1
#
# Dependencies:
# $ sudo apt-get install python3-dev libusb-1.0-0-dev libudev-dev python3-pip
# $ sudo pip3 install --upgrade setuptools
# $ sudo pip3 install hidapi
# place a... | 2.640625 | 3 |
lib/cogs/ping.py | weibolu-rm/weibolu-bot | 0 | 12770254 | <filename>lib/cogs/ping.py
from discord.ext.commands import Cog
from discord.ext.commands import command
class Ping(Cog):
def __init__(self, bot):
self.bot = bot
# ctx is a context ctx.send == ctx.channel.send
@command(name="ping")
async def ping(self, ctx):
await ctx.send("pon... | 2.78125 | 3 |
SRC/Check.py | vscv/HuWeiSPClassification | 0 | 12770255 | # ==============================================================================
# 2017_04_15 LSW@NCHC.
#
# Change 3 code to use new in, out dir name for fit the needs.
# cp new.image to /out/ do not need to chnage code of classify.py.
#
# USAGE: time py Check.py /home/TF_io/
# =========================================... | 2.453125 | 2 |
src/config.py | Viewly/alpha-2 | 0 | 12770256 | <reponame>Viewly/alpha-2
import json
from os import getenv, environ, getcwd, path
from dotenv import load_dotenv, find_dotenv
from funcy import rpartial
from toolz import pipe
load_json_file = rpartial(pipe, open, lambda x: x.read(), json.loads)
def config_folder_prefix():
# todo: improve this quick hack
# ... | 2.3125 | 2 |
dependencies/src/4Suite-XML-1.0.2/Ft/Lib/DistExt/Version.py | aleasims/Peach | 0 | 12770257 | <filename>dependencies/src/4Suite-XML-1.0.2/Ft/Lib/DistExt/Version.py
import re
from distutils.version import Version, StrictVersion
__all__ = ['CommonVersion', 'VersionPredicate', 'SplitProvision',
'SplitComparison',
]
class CommonVersion(Version):
"""
Version numbering that handles mos... | 2.359375 | 2 |
test/integration/test_main.py | RedHatOfficial/receptor | 6 | 12770258 | <filename>test/integration/test_main.py
import asyncio
import socket
from unittest.mock import patch
import pytest
import receptor
from receptor.config import ReceptorConfig
from receptor.receptor import Receptor
@pytest.fixture
def receptor_config(unused_tcp_port, tmpdir, type="node"):
return ReceptorConfig(
... | 2.296875 | 2 |
rest_framework_docs/compat.py | harwee/django-rest-framework-docs | 4 | 12770259 | try:
from django.urls import (
URLPattern,
URLResolver,
)
except ImportError:
# Will be removed in Django 2.0
from django.urls import (
RegexURLPattern as URLPattern,
RegexURLResolver as URLResolver,
)
# This is from the similarly named compat.py file of django-rest... | 2.296875 | 2 |
mmdet/models/utils/token_transformer_block.py | sota-joson/KE-RCNN | 0 | 12770260 | from timm.models.layers.weight_init import trunc_normal_
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.utils import _pair
from einops import rearrange
from mmcv.cnn import build_conv_layer, kaiming_init
class FeatEmbed(nn.Module):
"""Image to Patch Embedding.
Args:... | 2.265625 | 2 |
src/models.py | luisgc93/stock_reminder_bot | 26 | 12770261 | from datetime import datetime, timedelta
from os import environ
from peewee import (
BigIntegerField,
DateField,
DateTimeField,
CharField,
FloatField,
Model,
BooleanField,
InternalError,
)
from playhouse.db_url import connect
# Use default sqlite db in tests
db = connect(environ.get("D... | 2.640625 | 3 |
scripts/002_activity_to_land_use_mapping.py | UrbanIntelligenceLab/Exposure-Density-and-Neighborhood-Disparities-in-COVID-19-Infection-Risk | 0 | 12770262 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Author: <NAME>
Description:
This PySPark scripts maps geolocated mobility data for valid users
to specific land use type where the activity occured and counts
number of unique users within each land use type aggregated to 250m x 250m
neighborhoods in New York City.
"... | 2.859375 | 3 |
stevesie/resources/task_dependency.py | Stevesie/stevesie-py | 1 | 12770263 | <reponame>Stevesie/stevesie-py<filename>stevesie/resources/task_dependency.py
from typing import NamedTuple, Sequence
from datetime import datetime
from stevesie.remote_resource import RemoteResource
from stevesie.resources.task_collection_field import TaskCollectionField
class TaskDependencyTuple(NamedTuple):
id... | 2.09375 | 2 |
fat_checker_utils/image_and_manifest_preparation.py | dr-darryl-wright/fat_checker_utils | 0 | 12770264 | import os
import random
import argparse
import numpy as np
from PIL import Image, ImageDraw, ImageFont
def make_blank_placeholder(image_file, out_file):
#print(out_file)
image = np.asarray(Image.open(image_file))
blank = np.ones(image.shape)*255
blank = blank.astype(np.uint8)
#print(blank.shape)
im = Ima... | 3.078125 | 3 |
sentiment/app.py | sethah/sentiment-explorer | 0 | 12770265 | import pickle
import logging
import hashlib
import numpy as np
import os
from pathlib import Path
import spacy
import shutil
import sys
import tarfile
import tempfile
import torch
from typing import Dict, List
sys.path.append("nbsvm")
from nltk import word_tokenize
from nltk.stem import WordNetLemmatizer
from nltk.ste... | 2.1875 | 2 |
listas/media_alunos.py | fernando-datageo/Python | 0 | 12770266 | <filename>listas/media_alunos.py
# -*- coding: utf-8 -*-
"""
Programa que recebe como entrada dois arquivos:
O primeiro arquivo contém nomes de alunos
O segundo arquivo contém as notas dos alunos
E será gerado um terceiro arquivo contendo as médias.
"""
def acertarNotas(aluno,nota):
f1 = open(aluno,"r") # Abre no m... | 3.578125 | 4 |
src/masonite/managers/QueueManager.py | Abeautifulsnow/masonite | 1 | 12770267 | <filename>src/masonite/managers/QueueManager.py<gh_stars>1-10
"""Queue Manager Module."""
from ..contracts import QueueManagerContract
from .Manager import Manager
class QueueManager(Manager, QueueManagerContract):
"""Manages all queue drivers.
Arguments:
Manager {from .managers.Manager} -- The base... | 2.40625 | 2 |
maestrowf/abstracts/containers/__init__.py | kennyweiss/maestrowf | 90 | 12770268 | ###############################################################################
# Copyright (c) 2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory
# Written by <NAME>, <EMAIL>.
#
# LLNL-CODE-734340
# All rights reserved.
# This file is part of MaestroWF, Version: 1... | 1.203125 | 1 |
victim/models.py | knowapi/DeveloperPortalExamples | 2 | 12770269 | from django.db import models
from operation.models import Operation
from processor.utils import push_record_to_sqs_queue
import logging
SAFETY_LEVELS = (
(0, 'SAFE'),
(1, 'NOT CONFIRMED'),
(2, 'UNREACHABLE'),
(3, 'NEED_HELP'),
(4, 'NOT IN ZONE')
)
class Victim(models.Model):
"""
Used to s... | 2.078125 | 2 |
app/routes/actor.py | jabertuhin/dvdrental-backend | 1 | 12770270 | from fastapi import APIRouter, Depends
from app.dtos.responses.actor import ActorsDto, ActorDto
from app.services.actor_service import ActorService
from app.services.implementations.actor_service_implementation import (
ActorServiceImplementation,
)
router = APIRouter(tags=["Actor Resource"])
@router.get(path="... | 2.328125 | 2 |
abduct/stream.py | movermeyer/python-abduct | 4 | 12770271 | <filename>abduct/stream.py
import sys
from contextlib2 import contextmanager
from abduct.compat import StringIO
def stdout(release_on_exception=False, tee=False):
return make_stream_context('stdout', release_on_exception, tee)
def stderr(release_on_exception=False, tee=False):
return make_stream_context('st... | 2.5 | 2 |
src/thex/app.py | harris-2374/THEx | 0 | 12770272 | <gh_stars>0
import dash
import dash_bootstrap_components as dbc
from flask import cli
cli.show_server_banner = lambda *_: None
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(
__name__,
external_stylesheets = [dbc.themes.DARKLY],
suppress_callback_exceptions = True,
... | 1.75 | 2 |
codility/countingElements/permCheck.py | j-dags/Algos | 0 | 12770273 | # A non-empty array A consisting of N integers is given.
# A permutation is a sequence containing each element from 1 to N once, and only once.
# For example, array A such that:
# A[0] = 4
# A[1] = 1
# A[2] = 3
# A[3] = 2
# is a permutation, but array A such that:
# A[0] = 4
# A[1] = 1
# ... | 3.890625 | 4 |
src/model/domain.py | ajaykumarsampath/microgrid-model | 1 | 12770274 | <gh_stars>1-10
from dataclasses import dataclass
from functools import cached_property
from typing import List
import numpy as np
from model.component_interface import IComponent, IGridNetwork
from model.generator_interface import IGeneratorComponent
from shared.component import BUS_ID
UNIT_BUS_ID_MAP = [str, BUS_ID... | 2.265625 | 2 |
Server/PythonCrawl/src/main.py | yodebu/Interview-Street | 0 | 12770275 | <gh_stars>0
#!/usr/bin/env python
'''
--------------------------------------------------
--------------------------------------------------
@ Module : Main Module
@ Name: GeeksForGeeks Article Extractor
@ Purpose: To download and save articles filed under each and every tag mentioned in www.geeksforgeeks.org
... | 2.75 | 3 |
ucb/raw_ucb.py | Kylin824/federated-learning | 0 | 12770276 | import numpy as np
import matplotlib.pyplot as plt
# 计算delta
def calculate_delta(t, chosen_count, item):
if chosen_count[item] == 0:
return 1
else:
return np.sqrt(2 * np.log(t) / chosen_count[item])
def choose_arm(upper_bound_probs):
max = np.max(upper_bound_probs)
idx = np.where(upp... | 3.203125 | 3 |
get_free_proxy/self/SelfEnum.py | zwzw911/get-free-proxy | 0 | 12770277 | <gh_stars>0
#! /usr/bin/env python3
# -*- coding:utf-8 -*-
__author__ = 'zwzw911'
from enum import Enum, unique
# # 使用url作为value,以便检测是否需要代理才能连接
# @unique
# class SupportedWeb(Enum):
# Xici = 'https://www.xicidaili.com'
# Kuai = 'https://www.kuaidaili.com/free'
# Hidemy = 'https://hidemy.name/en/proxy-lis... | 2.34375 | 2 |
source/39-Sequência_de_Collatz_mais_longa.py | FelixLuciano/DesSoft-2020.2 | 0 | 12770278 | # Sequência de Collatz mais longa
# Considere a seguinte sequência iterativa definida para os números inteiros positivos:
# \begin{align}
# n &\rightarrow n/2 (n\text{ é par}) \\
# n & \rightarrow 3n+1 (n\text{ é ímpar})
# \end{align}
# Usando a regra acima e começando com o número 13, geramos a seguinte sequência:
# 1... | 4.03125 | 4 |
itch_dl/consts.py | DragoonAethis/ItchJamDownloader | 3 | 12770279 | <filename>itch_dl/consts.py
ITCH_BASE = "itch.io"
ITCH_URL = f"https://{ITCH_BASE}"
ITCH_API = f"https://api.{ITCH_BASE}"
# Extracts https://user.itch.io/name to {'author': 'user', 'game': 'name'}
ITCH_GAME_URL_REGEX = r"^https:\/\/(?P<author>[\w\d\-_]+).itch.io\/(?P<game>[\w\d\-_]+)$"
ITCH_BROWSER_TYPES = [
"gam... | 1.984375 | 2 |
Django 3 By Example-Book/My Shop/shop/models.py | ibnshayed/Python-Programming | 0 | 12770280 | <gh_stars>0
from django.db import models
from django.urls import reverse
# Create your models here.
class Category(models.Model):
name = models.CharField(max_length=200, db_index=True)
slug = models.SlugField(max_length=200, unique=True)
class Meta:
ordering = ('name',)
verbose_name = 'ca... | 2.25 | 2 |
Class_buildSample.py | ms-saleh/SampleGenerators | 0 | 12770281 | <filename>Class_buildSample.py
# -*- coding: utf-8 -*-
"""
Created on Fr Mar 12 13:36:25 2021
@author: <NAME> @ Cornell.<EMAIL>
Get the design of experiment for micro channe arrays, build the geometery in
nTopology Platform and create buildfiles in Nanoscribe
"""
import os
import subprocess
import json
import shutil... | 2.4375 | 2 |
contextily/_providers.py | jpn--/contextily | 163 | 12770282 | """
Tile providers.
This file is autogenerated! It is a python representation of the leaflet
providers defined by the leaflet-providers.js extension to Leaflet
(https://github.com/leaflet-extras/leaflet-providers).
Credit to the leaflet-providers.js project (BSD 2-Clause "Simplified" License)
and the Leaflet Provider... | 2.03125 | 2 |
api/config.py | 114000/webapp-boilerplate | 0 | 12770283 | # encoding: utf-8
from os import path, getenv
from datetime import timedelta
import ast
basedir = path.abspath(path.dirname(__file__))
class Config (object):
APP_NAME = getenv('APP_NAME', 'Python Flask Boilerplate')
DEV = ast.literal_eval(getenv('DEV', 'True'))
DEBUG = ast.literal_eval(getenv('... | 1.875 | 2 |
nobullshitonlyanswers/qa/forms.py | tanyadixit21/my-django-shenanigans | 0 | 12770284 | from django import forms
from django.contrib.auth import get_user_model
from qa.models import Question
from qa.models import Answer
class QuestionForm(forms.ModelForm):
user = forms.ModelChoiceField(
widget = forms.HiddenInput,
queryset = get_user_model().objects.all(),
... | 2.21875 | 2 |
feedsearch_crawler/crawler/__init__.py | DBeath/feedsearch-crawler | 20 | 12770285 | <filename>feedsearch_crawler/crawler/__init__.py
from feedsearch_crawler.crawler.crawler import Crawler
from feedsearch_crawler.crawler.duplicatefilter import DuplicateFilter
from feedsearch_crawler.crawler.item import Item
from feedsearch_crawler.crawler.item_parser import ItemParser
from feedsearch_crawler.crawler.li... | 1.960938 | 2 |
tests/core/urls.py | zhd785576549/flamingo | 0 | 12770286 | from flamingo.url.conf import path
routers = [
path(url="/test", view_func_or_module="tapp.urls", name="test")
]
| 1.75 | 2 |
04_repair_eeg_artefacts.py | JoseAlanis/supplementary_dpx_tt | 0 | 12770287 | """
===============================================
Repair EEG artefacts caused by ocular movements
===============================================
Identify "bad" components in ICA solution (e.g., components which are highly
correlated the time course of the electrooculogram).
Authors: <NAME> <<EMAIL>>
License: BSD ... | 2.375 | 2 |
molecool/tests/test_measure.py | MadelynnWatson/molecool | 0 | 12770288 | <reponame>MadelynnWatson/molecool
"""
Tests for the measure module
"""
# imports
import molecool
import numpy as np
import pytest
def test_calculate_distance():
r1 = np.array([0,0,0])
r2 = np.array([0,1,0])
expected_distance = 1
calculated_distance = molecool.calculate_distance(r1,r2)
assert e... | 2.828125 | 3 |
Graphical.py | Sunuba/roc | 23 | 12770289 | from tkinter import *
from classes.AttackBarbarians import AttackBarbarians
from classes.ExploreFog import ExploreFog
from classes.Screenshot import Screenshot
from classes.tester import Tester
starter = Tk()
starter.winfo_toplevel().title('Rise of Kingdom - Automator')
starter.geometry('250x500')
class MainInterfac... | 3.203125 | 3 |
train/experiment.py | deepmind/ithaca | 389 | 12770290 | # Copyright 2021 the Ithaca Authors
#
# 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 w... | 1.53125 | 2 |
firmware/set_wind_speed.py | mastensg/windportal | 1 | 12770291 | #!/usr/bin/env python3
import sys
import tkinter as tk
import time
import copy
import numpy as np
import matplotlib as mpl
import matplotlib.backends.tkagg as tkagg
from matplotlib.backends.backend_agg import FigureCanvasAgg
from matplotlib.backends.backend_tkagg import (FigureCanvasTkAgg,
... | 2.5 | 2 |
passl/modeling/heads/simclr_contrastive_head.py | juneweng/PASSL | 136 | 12770292 | # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve.
#
# 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 ap... | 2.234375 | 2 |
PlotExamples/title_gitrev.py | scienceopen/python-examples | 5 | 12770293 | #!/usr/bin/env python
"""
example of putting git short revision in matplotlib plot, up in the corner
(rather than in title where git revision text is too large)
This is helpful for when a colleague wants a plot exactly recreated from a year ago,
to help find the exact code used to create that plot.
http://matplotlib... | 2.625 | 3 |
disp/cli/cmd_tools.py | zhubonan/disp | 1 | 12770294 | <filename>disp/cli/cmd_tools.py
"""
Collection of useful tools
"""
import click
from ase.io import read
from disp.tools.modcell import modify_cell
@click.group('tools')
@click.pass_context
def tools(ctx):
"""Collection of tools"""
_ = ctx
@tools.command('modcell')
@click.argument('base_cell')
@click.argumen... | 2.0625 | 2 |
String/784.The Longest Common Prefix II/Solution.py | Zhenye-Na/LxxxCode | 12 | 12770295 | <gh_stars>10-100
class Solution:
"""
@param words: the n strings
@param target: the target string
@return: The ans
"""
def the_longest_common_prefix(self, words, target):
# write your code here
ans = 0
for word in words:
same = 0
for j in range(0,... | 3.296875 | 3 |
app/base/func.py | edwarts/igenweb_supplier | 0 | 12770296 | # list to csv
def listToCSV(obj):
csv = ''
for x in obj:
csv += str(x)
csv += ','
return csv[:-1]
# csv to list
def CSVToList(csv):
obj = csv.split(',')
li = []
for x in obj:
li.append(int(x))
return li
# 更新数据库
def update_db(obj, d):
if not isinstance(d, dict)... | 3.34375 | 3 |
dogey/exceptions.py | Shadofer/dogey | 3 | 12770297 | class DogeyError(Exception):
""" The base Dogey Exception, expect this as the main type of Dogey-specific errors such as InvalidCredentialsError. """
pass
class DogeyCommandError(Exception):
def __init__(self, command_name: str, message: str, *args):
""" The basic Dogey exception for commands, exp... | 3.34375 | 3 |
examples/list_stable_particles.py | tianluyuan/particletools | 2 | 12770298 | from __future__ import print_function
from particletools.tables import (PYTHIAParticleData, c_speed_of_light,
print_stable, make_stable_list)
import math
pdata = PYTHIAParticleData()
print_stable(pdata.ctau('D0') / c_speed_of_light,
title=('Particles with known finite li... | 2.34375 | 2 |
network-client/src/gmu/chord/FingerEntry.py | danfleck/Class-Chord | 1 | 12770299 | ''' Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Created on Feb 24, 2014
@author: dfleck
'''
import math
class FingerEntry:
'''Represents an entry in the finger table.
Note: Finger indexes go from 0-->m-1 which is different than the
C... | 3.203125 | 3 |
repos/system_upgrade/el7toel8/actors/opensshconfigscanner/actor.py | sm00th/leapp-repository | 21 | 12770300 | from leapp.actors import Actor
from leapp.libraries.actor import readopensshconfig
from leapp.models import OpenSshConfig
from leapp.tags import FactsPhaseTag, IPUWorkflowTag
class OpenSshConfigScanner(Actor):
"""
Collect information about the OpenSSH configuration.
Currently supporting the following opt... | 2.5 | 2 |
bin/shell.py | charnley/optimize_gamess_parameters | 1 | 12770301 |
from subprocess import Popen, PIPE
def shell(cmd, shell=False):
if shell:
p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE)
else:
cmd = cmd.split()
p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
output, err = p.communicate()
return output
| 2.96875 | 3 |
app/question/migrations/0001_initial.py | PICT-ACM-Student-Chapter/OJ_API | 2 | 12770302 | # Generated by Django 3.1.4 on 2020-12-22 07:46
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import question.models
class Migration(migrations.Migration):
initial = True
dependencies = [
('core', '0001_initial'),
]
operations = [
... | 1.820313 | 2 |
src/delete_non_photos.py | thompsonsed/sortphotos | 0 | 12770303 | """
Deletes files in a directory that is not a photo.
"""
import logging
from PIL import Image
import pathlib
def check_image_with_pil(path: pathlib.Path) -> bool:
"""
Checks if the path is an image.
:param pathlib.Path path: path to check the image of
:return: true if the path is an image.
:rt... | 3.453125 | 3 |
src/scripts/ona_service/notification_publisher.py | cvcrckt/ona | 0 | 12770304 | # Copyright 2015 Observable Networks
#
# 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 ... | 1.710938 | 2 |
tests/devices/test_kogan_switch2.py | lperez31/tuya-local | 0 | 12770305 | <filename>tests/devices/test_kogan_switch2.py
"""Tests for the switch entity."""
from unittest import IsolatedAsyncioTestCase
from unittest.mock import AsyncMock, patch
from homeassistant.components.switch import DEVICE_CLASS_OUTLET
from homeassistant.const import STATE_UNAVAILABLE
from custom_components.tuya_... | 2.296875 | 2 |
objetto/observers.py | brunonicko/objetto | 8 | 12770306 | # -*- coding: utf-8 -*-
"""Observer mixin class."""
from ._observers import ActionObserver, ActionObserverExceptionData, ActionObserverToken
__all__ = ["ActionObserver", "ActionObserverToken", "ActionObserverExceptionData"]
| 1.28125 | 1 |
base/catalog/urls.py | daavelino/vulnerability-catalog | 12 | 12770307 | from django.urls import include, path
from catalog.admin import admin_site
from django.contrib.auth import logout
from django.conf import settings
from . import views
app_name="catalog"
urlpatterns = [
path('', views.HomeView.as_view(), name='home'),
path('accounts/login/', views.LoginView.as_view(), name='l... | 1.859375 | 2 |
ynlldb.py | espider/yinuo | 7 | 12770308 | <filename>ynlldb.py
#!/usr/bin/python
# coding:utf-8
# help for debug .net core with lldb
# this work with lldb.like:command script import ~/ynlldb.py
# ref: https://lldb.llvm.org/python-reference.html
# ref: https://lldb.llvm.org/python_reference/index.html
# Copyright (c) 2017, chengliang
# All rights reserved.
i... | 2.234375 | 2 |
jim/fizzbuzz_objects.py | CorySpitzer/FizzBuzz | 0 | 12770309 | """
fizzbuzz_objects.py (Python 2.7.5)
An object oriented approach to the FizzBuzz problem.
<NAME> | cs.marlboro.edu | Jan 2014 | opensource.org/licenses/MIT
"""
class FizzBuzzInt(object):
""" An integer with a string representation per the FizzBuzz recipe.
>>> print FizzBuzzInt(7)
7
... | 3.8125 | 4 |
srv/decorate.py | greenify/zodiacy | 1 | 12770310 | """
Copyright (c) 2011, <NAME>.
License: MIT (see http://www.opensource.org/licenses/mit-license.php for details)
URL: http://www.gtsystem.eu/blog/2011/11/bottle-decorator-for-validate-query-parameters/
"""
from bottle import request
import functools
import inspect
def checkParams(**types):
def decorate(f):
... | 2.59375 | 3 |
vendors/rez-2.23.1-py2.7/rez/serialise.py | ColinKennedy/tk-config-default2-respawn | 4 | 12770311 | """
Read and write data from file. File caching via a memcached server is supported.
"""
from rez.package_resources_ import package_rex_keys
from rez.utils.scope import ScopeContext
from rez.utils.sourcecode import SourceCode, early, late, include
from rez.utils.logging_ import print_debug
from rez.utils.filesystem imp... | 2.671875 | 3 |
age/data/load/transformations.py | torfjelde/covid19_datasets | 49 | 12770312 | <reponame>torfjelde/covid19_datasets<filename>age/data/load/transformations.py
import pandas as pd
def add_both_sexes(data: pd.DataFrame) -> pd.DataFrame:
"""Add male and female data to obtain data for both sexes combined."""
if len(data.Sex.unique()) != 2:
raise ValueError(
f'Expecting 2 ... | 3.15625 | 3 |
problemsets/Codeforces/Python/A63.py | juarezpaulino/coderemite | 0 | 12770313 | <filename>problemsets/Codeforces/Python/A63.py<gh_stars>0
"""
*
* Author: <NAME>(coderemite)
* Email: <EMAIL>
*
"""
n=int(input())
o=dict(zip('tminp',[0,1,1,2,3]))
a=sorted(enumerate([input().split()for _ in[0]*n]),key=lambda x:(o[x[1][1][2]],x[0]))
for x in a:print(x[1][0])
| 3.15625 | 3 |
notions/models/database.py | micktwomey/notions | 1 | 12770314 | import datetime
import enum
import typing
import uuid
import pydantic
from .color import Color
from .number import Number
from .parent import DatabaseParents
from .rich_text import RichText
class NumberProperty(pydantic.BaseModel):
id: str
name: str
type: typing.Literal["number"] = "number"
number: ... | 2.453125 | 2 |
web/pipeline/migrations/0078_auto_20200904_0711.py | stevenstuber/CIT | 10 | 12770315 | <reponame>stevenstuber/CIT
# Generated by Django 2.2.13 on 2020-09-04 07:11
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('pipeline', '0077_community_parent_community'),
]
operations = [
migrations.Alte... | 1.617188 | 2 |
exchange-scrappers/pipelines.py | joa-rodrigues/crypto-exchange-listings | 6 | 12770316 | <filename>exchange-scrappers/pipelines.py
import datetime
import pymongo
import telepot
from scrapy.utils.project import get_project_settings
settings = get_project_settings()
class CoinbaseScrapper(object):
def __init__(self):
mongo_server = settings.get('MONGO_SERVER')
mongo_url = f"mongodb:... | 2.53125 | 3 |
tests/scheduler/invalid_cron_recurring.py | abhijeetkaurav1st/calm-dsl | 0 | 12770317 | import uuid
from calm.dsl.builtins import Job, JobScheduler
start_date_time = "2050-10-08 16:17:15"
expiry_date_time = "2050-10-09 00:17:00"
cron = "15 1 32 * *"
time_zone = "America/Jamaica"
RUNBOOK_NAME = "invalid_cron_recurring"
class JobInvalidRecurringSpec(Job):
"""Recurring Job for Executing a Runbook wi... | 2.484375 | 2 |
labeling-tool/main.py | bytecell/Industrial-Project | 14 | 12770318 | import sys
from PyQt5.uic import loadUi
import PyQt5.QtCore as QtCore
from PyQt5.QtWidgets import QDialog, QApplication, QStackedWidget, QFileDialog, QProgressBar, QTableWidget, \
QAbstractItemView, QPushButton, QDesktopWidget, QTableWidgetItem
from transformers import AutoTokenizer
import re
import emoji
from soyn... | 2.09375 | 2 |
src/models/predict_CNN.py | danielemingolla/sentiment_analysis_performances_comparison | 0 | 12770319 | from keras.models import load_model
from sklearn.externals import joblib
from keras.preprocessing.sequence import pad_sequences
import os
current_directory = os.getcwd()
file_name = "CNN__31_05_2020__20_33.h5"
tokenizer_name = "tokenizer_31_05_2020__20_45.pkl"
input_path = "\\".join([current_directory, "models", file... | 2.78125 | 3 |
src/python/wakplot.py | chanul13/EDMFTF | 7 | 12770320 | <reponame>chanul13/EDMFTF
#!/usr/bin/env python
from scipy import *
from pylab import *
from scipy import weave
import glob, os, sys
code="""
#line 10 "wakplot.py"
using namespace std;
double Ry2eV = 13.6056920311654;
double Ax = 0;
for (int ib=0; ib<nbands; ib++){
complex<double> e... | 2.015625 | 2 |
src/__init__.py | PythonistaMX/py231 | 3 | 12770321 | #! /usr/bin/python3
from flask import abort, jsonify
from json import loads
carreras = ("Sistemas", "Derecho", "Actuaría", "Arquitectura", "Administración")
orden = ('nombre', 'primer_apellido', 'segundo_apellido', 'carrera','semestre', 'promedio', 'al_corriente')
campos = {'cuenta': (int, True), 'nombre': (str, True... | 3.078125 | 3 |
tests/stores/test_elasticsearch_conf.py | synthetic-intelligence/zentral | 0 | 12770322 | <gh_stars>0
from django.test import SimpleTestCase
from django.utils.crypto import get_random_string
from accounts.events import EventMetadata, LoginEvent
from zentral.conf.config import ConfigDict
from zentral.core.exceptions import ImproperlyConfigured
from zentral.core.stores.backends.elasticsearch import EventStore... | 2.109375 | 2 |
xssor/tcp.py | boundmania/xssor2 | 2,126 | 12770323 | <filename>xssor/tcp.py
sys_name = "XSS'OR"
sys_copyright = <EMAIL>cos.me"
def sys(req):
return {
'sys_name': sys_name,
'sys_copyright': sys_copyright,
}
| 2.03125 | 2 |
lightkurve_ext_pg_runner.py | orionlee/PH_TESS_I_LightCurveViewer | 2 | 12770324 | import contextlib
import logging
from time import time_ns
from types import SimpleNamespace
import warnings
import ipywidgets as widgets
from IPython.display import display
import lightkurve_ext as lke
import lightkurve_ext_tls as lke_tls
import lightkurve_ext_pg as lke_pg
def _current_time_millis():
return ti... | 2.171875 | 2 |
bk169X/main.py | ddamiani/bk169X | 1 | 12770325 | <filename>bk169X/main.py<gh_stars>1-10
import sys
import argparse
import serial
import IPython
import os
import glob
import bk169X.control as _bkcont
import bk169X.calib as _bkcal
def __parse_cli():
parser = argparse.ArgumentParser(
description='A tool for control and calibration of BK Precision 169X Se... | 2.625 | 3 |
manga_py/providers/translate_webtoons_com.py | sonvt1710/manga-py | 7 | 12770326 | from manga_py.provider import Provider
from .helpers.std import Std
class TranslateWebToonsCom(Provider, Std):
def get_archive_name(self) -> str:
return self.normal_arc_name(self.get_chapter_index())
def get_chapter_index(self) -> str:
return self.re.search(r'\bepisodeNo=(\d+)', self.chapter)... | 2.3125 | 2 |
python/tasker/src/json/Importer.py | PUT-II/akai-org-rekrutacja | 0 | 12770327 | <reponame>PUT-II/akai-org-rekrutacja<filename>python/tasker/src/json/Importer.py
import json
class Importer:
def __init__(self):
self.__encoded_tasks: str = ""
pass
def read_tasks(self):
with open("taski.json", mode="r", encoding="utf8") as file:
self.__encoded_tasks = fi... | 2.25 | 2 |
kCharge-firmware/handlers.py | koalacreations/kCharge-firmware | 0 | 12770328 | import logging
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
def start_action(payload, channels, ws):
# extract all of the data that we need
channel = payload.get("channel")
action = payload.get("action")
rate = payload.get("rate")
cutoff_voltage = payload.get("cutoffVoltage")
... | 2.953125 | 3 |
tests/test_misc.py | jansel/torchdynamo | 41 | 12770329 | <filename>tests/test_misc.py
#!/usr/bin/env pytest
import collections
import copy
import dataclasses
import dis
import enum
import functools
import math
import sys
import typing
import unittest
import numpy as np
import torch
import torchdynamo.testing
from torchdynamo import bytecode_transformation
from torchdynamo.... | 2.4375 | 2 |
luft/common/s3_utils.py | profesia/luft | 1 | 12770330 | # -*- coding: utf-8 -*-
"""S3 utils."""
import gzip
from typing import Optional
import boto3
def get_s3(aws_access_key, aws_secret_access_key):
"""Get S3 connections."""
s3 = boto3.client('s3', aws_access_key_id=aws_access_key,
aws_secret_access_key=aws_secret_access_key)
return s3... | 2.53125 | 3 |
extra_tests/test_weakref.py | olliemath/pypy | 1 | 12770331 | <filename>extra_tests/test_weakref.py
import sys
import textwrap
import subprocess
def test_WeakValueDictionary_len(tmpdir):
src = textwrap.dedent("""
from weakref import WeakValueDictionary
class Foo:
pass
N = 1000
D = WeakValueDictionary()
for i in range(N):
... | 2.546875 | 3 |
src/tinder/v2/__init__.py | maxime-peim/tinder-api | 0 | 12770332 | <filename>src/tinder/v2/__init__.py
import tinder
class V2Exception(tinder.APIException):
pass
URL = tinder.URL / 'v2'
BUCKET_EP = URL / 'buckets'
RECS_EP = URL / 'user' / 'recs'
MATCHES = URL / 'matches' | 2.140625 | 2 |
projects/tests/test_example.py | csm-adapt/karon | 1 | 12770333 | <gh_stars>1-10
import pytest
import numpy as np
import pandas as pd
from karon.tree import NLRTree
from ..example import Example
@pytest.fixture
def structured():
return {
'filename': '../../tests/data/example.xlsx',
'aggregate': 'data/example-aggregate.xlsx',
'propagate': 'data/example-pr... | 2.0625 | 2 |
vendoasg.py | asgard-sp-z-o-o/vendoasg | 0 | 12770334 | #! python
#-*- coding: utf-8 -*-
import requests
import json
class Vendo:
def __init__(self, url_api):
self.setHeader({'Content-Type' : 'application/json', "Content-Length" : "length"})
self.setApi(url_api)
def setApi(self,api_url):
self.API_URL = api_url
def setHeader(self, api... | 2.390625 | 2 |
landsat_cloudScore.py | sig-gis/Ecuador_SEPAL | 13 | 12770335 | <reponame>sig-gis/Ecuador_SEPAL
# Sentinel-2 package
from paramsTemplate import *
import ee
from Py6S import *
import math
import datetime
import os, sys
from utils import *
import sun_angles
import view_angles
import time
class env(object):
def __init__(self):
"""Initialize the environment."""
# Initialize the... | 2.234375 | 2 |
lygos/plot_tess_psfn.py | tdaylan/pandora | 2 | 12770336 | from util import *
import h5py
pathdata = os.environ['TCAT_DATA_PATH'] + '/tesspsfn/'
pathtemp = pathdata + 'temp.txt'
indxcams = range(1, 5)
indxccds = range(1, 5)
indxrows = [1, 513, 1025, 1536, 2048]
indxcols = [45, 557, 1069, 1580, 2092]
#boolplotflgt = False
boolplotflgt = True
pathsave = pathdata + 'listpsfn.... | 2.015625 | 2 |
product_api/api.py | Lnvictor/ProductAPI | 0 | 12770337 | """
Http Server for our API
"""
from flask import Flask, jsonify, request
from controller import product_controller
app = Flask(__name__)
def serialize(products):
return list(map(lambda p: p.serialize(), products))
@app.route("/product/<name>")
def get_product(name: str):
return jsonify({"product": produ... | 3.140625 | 3 |
Scripts/dk/collisionshape/__init__.py | hhg128/DKGL | 14 | 12770338 | <reponame>hhg128/DKGL<filename>Scripts/dk/collisionshape/__init__.py
import _dk_core as core
UP_AXIS_LEFT = 0
UP_AXIS_TOP = 1
UP_AXIS_FORWARD = 2
TYPE_CUSTOM = 0
TYPE_EMPTY = 1
TYPE_COMPOUND = 2
TYPE_BOX = 3
TYPE_CAPSULE = 4
TYPE_CYLINDER = 5
TYPE_CONE = 6
TYPE_SPHERE = 7
TYPE_MULTI_SPHERE = 8
TYPE_CONVEX_HULL = 9
TY... | 1.71875 | 2 |
vanilla_segmentation/loss.py | drapado/densefusion | 1 | 12770339 | from torch.nn.modules.loss import _Loss
from torch.autograd import Variable
import torch
import time
import numpy as np
import torch.nn as nn
import random
import copy
import math
CEloss = nn.CrossEntropyLoss()
def loss_calculation(semantic, target):
bs = semantic.size()[0]
pix_num = 480 * 640
... | 2.828125 | 3 |
hdlConvertorAst/translate/common/add_call_operator_for_call_without_parenthesis.py | Nic30/hdlConvertorAst | 16 | 12770340 | from hdlConvertorAst.hdlAst import HdlOp, HdlValueId, HdlFunctionDef, HdlOpType
from hdlConvertorAst.to.hdl_ast_modifier import HdlAstModifier
from hdlConvertorAst.translate.verilog_to_basic_hdl_sim_model.utils import hdl_call
class AddCallOperatorForCallWithoutParenthesis(HdlAstModifier):
"""
Verilog functio... | 2.453125 | 2 |
ds_queues/hotpotato.py | dileepkr/datastructures | 0 | 12770341 | <gh_stars>0
from myqueue import Queue
def hotPotato(namelist, numrounds):
namequeue = Queue()
for name in namelist:
namequeue.enqueue(name)
while namequeue.size() > 1:
for i in range(numrounds):
namequeue.enqueue(namequeue.dequeue())
namequeue.dequeue()
ret... | 3.453125 | 3 |
2020/17/17.py | Sveder/advent_of_code | 0 | 12770342 | import copy
import itertools
input = """###..#..
.#######
#####...
#..##.#.
###..##.
##...#..
..#...#.
.#....##"""
# input = """.#.
# ..#
# ###"""
cycles_count = 6
def step(world):
size = len(world[0][0])
new_size = size + 2
new_world = copy.deepcopy(world)
# RESIZE PART:
# Add new planes and ... | 3.140625 | 3 |
remote/xyzplotlyhandler.py | b38tn1k/rover | 0 | 12770343 | <gh_stars>0
# <NAME> March 2016
# simple streaming x/y/z scatter plot contructor
import plotly.plotly as py
from plotly.graph_objs import Scatter, Layout, Figure, Data, Stream, YAxis
import datetime
from time import sleep
def new_scatter(name, token):
new_scatter = Scatter(
x=[],
y=[],
nam... | 2.71875 | 3 |
twitter/tweets/admin.py | vBubbaa/django-twitter | 1 | 12770344 | from django.contrib import admin
from tweets.models import Tweet, Comment, Likes
admin.site.register(Tweet)
admin.site.register(Comment)
admin.site.register(Likes)
| 1.507813 | 2 |
scrapenhl2/plot/team_score_shot_rate.py | muneebalam/scrapenhl2 | 17 | 12770345 | """
This module creates a scatterplot for specified team with shot attempt rates versus league median from down 3 to up 3.
"""
import matplotlib.pyplot as plt
import math
import pandas as pd
import scrapenhl2.scrape.team_info as team_info
import scrapenhl2.manipulate.manipulate as manip
import scrapenhl2.plot.visuali... | 3.109375 | 3 |
Lib/Nets/utils/generic/tile_creator.py | cattale93/pytorch_self_supervised_learning | 0 | 12770346 | import torch
import os
from Lib.Nets.utils.generic.image2tensorboard import reconstruct_tile
import pickle as pkl
path = '/home/ale/Documents/Python/13_Tesi_2/runs/agan/10_32_idt/checkpoints/args.pkl'
opt = pkl.load(open(path, "rb"))
posx = pkl.load(open(os.path.join(opt.data_dir_train, 'posx.pkl'), "rb"))
posy = pkl.... | 2.15625 | 2 |
app/models.py | awesome-archive/susnote | 0 | 12770347 | #!/usr/bin/env python
# encoding: utf-8
from peewee import *
from playhouse.postgres_ext import *
import datetime
class BaseModel(Model):
id = PrimaryKeyField()
create_time = DateTimeField(verbose_name='create_time', constraints=[SQL('DEFAULT CURRENT_TIMESTAMP')])
class Notebook(BaseModel):
name = CharField(max_l... | 2.140625 | 2 |
tests/_namespace_util_test.py | poros/data_pipeline | 110 | 12770348 | <filename>tests/_namespace_util_test.py
# -*- coding: utf-8 -*-
# Copyright 2016 Yelp 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
#
#... | 2.015625 | 2 |
tests/unit2/test_arcade.py | LiorAvrahami/arcade | 824 | 12770349 | <filename>tests/unit2/test_arcade.py
import logging
import arcade
def test_logging():
arcade.configure_logging(logging.WARNING)
logger = logging.getLogger('arcade')
assert logger.level == logging.WARNING
| 2.296875 | 2 |
app/__init__.py | ralphdc/zihan | 0 | 12770350 | <reponame>ralphdc/zihan<gh_stars>0
#!/usr/bin/env python3
from .Download import Download
class GetHandler():
_ITEM_ = {
'download': Download
}
@classmethod
def get_unit(cls, unit, **kwargs):
if unit in cls._ITEM_:
return cls._ITEM_.get(unit)(**kwargs)
else:
... | 2.59375 | 3 |