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 |
|---|---|---|---|---|---|---|
W3Schools Online Lessons/ML/Normal Data Distribution.py | Hetti219/Python-Projects | 1 | 45200 | import numpy
import matplotlib.pyplot as plt
x = numpy.random.normal(1.9, 1.0, 109324)
plt.hist(x, 100)
plt.show()
| 2.59375 | 3 |
magma/t.py | leonardt/magma | 167 | 45201 | <filename>magma/t.py
import abc
import enum
from magma.common import deprecated
from magma.compatibility import IntegerTypes, StringTypes
from magma.ref import AnonRef, NamedRef, TempNamedRef, DefnRef, InstRef
from magma.protocol_type import magma_value
from magma.wire import wire
class Direction(enum.Enum):
In =... | 2.734375 | 3 |
src/python/baekjoon/10996.py | Hyeon9mak/Baekjoon | 0 | 45202 | N = int(input())
R = []
for i in range(0, N*2) :
if i%2 == 0 : R.append("*")
else : R.append(" ")
for l in range(0, N) :
P1 = P2 = ""
for i in range(0, N) :
P1 += R[i]
print(P1)
for i in range(N*2-1, N-1, -1) :
P2 += R[i]
print(P2) | 3.578125 | 4 |
analysededonneesavecnumpy/effectuerdescomparaisons1.py | haxuyennt38/python-learning | 0 | 45203 | import numpy as np
vector = np.array([5, 10, 15, 20])
equal_to_ten = (vector == 10)
print(equal_to_ten)
matrix = np.array([[10, 25, 30], [45, 50, 55], [60, 65, 70]])
equal_to_25 = (matrix[:, 1]) == 25
print(equal_to_25)
##Lire le dataset world_alcohol.csv dans la variable world_alcohol
world_alcohol = np.genf... | 3.34375 | 3 |
src/digit_reader/model/model.py | dadamsncsa/python-best-practices-course | 0 | 45204 | class MNISTModel:
def __init__(self):
pass
def train_model(self):
"""
some notes
"""
pass
def evaluate_model(self
"""
more notes
"""
pass
| 2.015625 | 2 |
evaluator/base_evaluator.py | marsggbo/CovidNet3D | 5 | 45205 | <gh_stars>1-10
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import argparse
import json
import logging
import os
import time
from argparse import ArgumentParser
import numpy as np
import torch
import torch.nn as nn
from torch.utils.tensorboard import SummaryWriter
import nni
from datasets... | 1.929688 | 2 |
venv/lib/python3.6/site-packages/ansible_collections/community/vmware/plugins/modules/vmware_content_library_info.py | usegalaxy-no/usegalaxy | 7 | 45206 | <filename>venv/lib/python3.6/site-packages/ansible_collections/community/vmware/plugins/modules/vmware_content_library_info.py<gh_stars>1-10
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Ansible Project
# Copyright: (c) 2019, <NAME> <<EMAIL>>
# GNU General Public License v3.0+ (see COPYING or https:/... | 1.757813 | 2 |
recirq/qml_lfe/circuit_blocks_test.py | MarkDaoust/ReCirq | 0 | 45207 | # Copyright 2021 Google
#
# 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, soft... | 1.78125 | 2 |
RecoEgamma/EgammaElectronProducers/python/lowPtGsfElectronsPreRegression_cfi.py | ckamtsikis/cmssw | 13 | 45208 | from RecoEgamma.EgammaElectronProducers.gsfElectrons_cfi import ecalDrivenGsfElectrons
lowPtGsfElectronsPreRegression = ecalDrivenGsfElectrons.clone(gsfElectronCoresTag = "lowPtGsfElectronCores")
from Configuration.Eras.Modifier_fastSim_cff import fastSim
fastSim.toModify(lowPtGsfElectronsPreRegression,ctfTracksTag =... | 1.117188 | 1 |
tests/fixtures/script-files/sample_script.py | avoltz/poetry-core | 205 | 45209 | <gh_stars>100-1000
#!/usr/bin/env python
hello = "Hello World!"
| 1.164063 | 1 |
example/models.py | acdh-oeaw/django-gnd | 0 | 45210 | <gh_stars>0
from django.db import models
from django.urls import reverse
from gnd.models import GndPersonBase
class MyText(models.Model):
title = models.CharField(max_length=250, blank=True, null=True)
text = models.TextField(blank=True, null=True)
def __str__(self):
return self.title
class Pe... | 2.390625 | 2 |
programs/migrations/0004_auto_20200708_1510.py | bycristhian/psp | 2 | 45211 | # Generated by Django 3.0.5 on 2020-07-08 20:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('programs', '0003_program_total_lines'),
]
operations = [
migrations.AlterField(
model_name='program',
name='finish_d... | 1.398438 | 1 |
example.py | Resident234/dejavu | 0 | 45212 | <gh_stars>0
import warnings
import json
import logging
import datetime
import threading, time
import vlc
import os
import sys
#import multiprocessing
from multiprocessing import Process
warnings.filterwarnings("ignore")
from dejavu import Dejavu
from dejavu.recognize import FileRecognizer, MicrophoneRecognizer
from d... | 2.4375 | 2 |
nabu/postprocessing/reconstructors/weighted_kmeans.py | Darleen2019/Nabu-MSSS | 18 | 45213 | # Based on: https://towardsdatascience.com/clustering-the-us-population-observation-weighted-k-means-f4d58b370002
import random
import numpy as np
import scipy.spatial
def distance(p1,p2):
return np.linalg.norm(p1,p2)
def cluster_centroids(data,weights, clusters, k):
results=[]
for i in range(k):
results.... | 3.046875 | 3 |
Web.PY/client-post.py | Phoebus-Ma/Python-Helper | 0 | 45214 | ###
# Python http post example.
#
# License - MIT.
###
import os
# pip install requests.
import requests
# pip install lxml
# pip install beautifulsoup4
from bs4 import BeautifulSoup
# login github class.
class login_github():
# {
# Initialization function.
def __init__(self):
# {
# Chromium c... | 3.109375 | 3 |
wqxlib/wqx_v3_0/BiologicalHabitatCollectionInformation.py | FlippingBinary/wqxlib-python | 0 | 45215 | from yattag import Doc
from .CollectionEffort import CollectionEffort
from .MeasureCompact import MeasureCompact
from .NetInformation import NetInformation
from .SimpleContent import CollectionDescriptionText, PassCount
class BiologicalHabitatCollectionInformation:
"""
Allows for the reporting of b... | 2.53125 | 3 |
Python/Search/Search-1-Billion-Users.py | sethmh82/SethDevelopment | 0 | 45216 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 29 15:50:49 2020
@author: SethHarden
"""
import math
# Add any extra import statements you may need here
"""
We have N different apps with differnt user growth rates.
At a given time (t)
Measure in days (d)
the number of users using an app is g ^ t
can be ... | 3.859375 | 4 |
033.Search in Rotated Sorted Array/better.py | hotheat/LeetCode | 2 | 45217 | <gh_stars>1-10
class Solution:
def search(self, nums, target):
if not nums:
return -1
low, high = 0, len(nums) - 1
while low <= high:
mid = (low + high) // 2
if target == nums[mid]:
return mid
if nums[mid] < nums[high]:
... | 3.53125 | 4 |
app/grandchallenge/workstations/urls.py | njmhendrix/grand-challenge.org | 1 | 45218 | <gh_stars>1-10
from django.urls import path
from grandchallenge.workstations.views import (
SessionCreate,
WorkstationCreate,
WorkstationDetail,
WorkstationEditorsUpdate,
WorkstationImageCreate,
WorkstationImageDetail,
WorkstationImageUpdate,
WorkstationList,
WorkstationUpdate,
... | 1.929688 | 2 |
terminalcolor/TerminalColor.py | cheongwoli/PythonTerminalTextColor | 0 | 45219 | from enum import Enum
from typing import Any
__all__ = ['ctext', 'cprint']
class ANSIColor(Enum):
"""
This class is Enum and is the repository for ANSI Color.
In brightness, F stands for foreground and B stands for background.
"""
# colors (3/4 bit)
RED = 1
GREEN = 2
YELLOW = 3
... | 3.734375 | 4 |
2021/day_23/solution_first.py | krother/advent_of_code | 3 | 45220 | """title
https://adventofcode.com/2021/day/23
"""
from heapq import heappush, heappop
import itertools
entry_finder = {} # mapping of tasks to entries
REMOVED = '<removed-task>' # placeholder for a removed task
counter = itertools.count() # unique sequence count
def add_task(pq, task, priori... | 3.171875 | 3 |
Project10- Bank Marketing.py | vaibhav162/Banking-Marketing-Project | 0 | 45221 | <reponame>vaibhav162/Banking-Marketing-Project<gh_stars>0
#!/usr/bin/env python
# coding: utf-8
# # Importing Libraries and Dataset
# In[1]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
# In[2]:
bank= pd.read_csv(r"C:\Users\shruti\Desktop\Decodr\Project\Decodr Pro... | 3.875 | 4 |
backend/recotem/recotem/api/serializers/project.py | codelibs/recotem | 7 | 45222 | <filename>backend/recotem/recotem/api/serializers/project.py
from rest_framework import serializers
from recotem.api.models import Project, TrainingData
class ProjectSerializer(serializers.ModelSerializer):
class Meta:
model = Project
fields = "__all__"
class TrainingDataForSummarySerializer(se... | 2 | 2 |
rest_api.py | OHNLP/clinical-problem-standardization | 5 | 45223 | '''
REST API for processing free-text diagnosis statements into either:
(1) OWL class expressions
(2) FHIR Condition Resources
(3) SNOMED CT Expressions
(4) Raw concept relationship graphs
'''
from flask import Flask, request
import api
from transformers.transform import FhirConditionTransformer, Snom... | 2.234375 | 2 |
hvplot/tests/testgridplots.py | lhoupert/hvplot | 338 | 45224 | <reponame>lhoupert/hvplot
from unittest import SkipTest
from collections import OrderedDict
import numpy as np
from holoviews import Store
from holoviews.element import RGB, Image
from holoviews.element.comparison import ComparisonTestCase
try:
import xarray as xr
except:
raise SkipTest('XArray not available'... | 2.40625 | 2 |
countries/regions/NorthAmerica.py | vincihb/paper_database | 0 | 45225 | from countries.Countries import Countries
class NorthAmerica(Countries):
def __init__(self):
super().__init__()
self.lst_of_countries = ['Canada', 'United States']
self.all_papers = self.get_all_papers()
if __name__ == "__main__":
a = NorthAmerica()
papers = a.all_papers
prin... | 2.9375 | 3 |
app/SuperPhy/models/sparql/genomes.py | superphy/semantic | 16 | 45226 | <reponame>superphy/semantic
#!/usr/bin/python
from SuperPhy.models.sparql.endpoint import Endpoint
from SuperPhy.models.sparql.prefixes import prefixes
def get_all_syndromes():
"""
input - None
output - list of all the unique syndromes
"""
string = prefixes + """
SELECT ?syndromes
WHERE
... | 2.65625 | 3 |
AER_experimentalist/experiment_environment/IV.py | musslick/DARTS-Cognitive-Modeling | 0 | 45227 | from abc import ABC, abstractmethod
from tinkerforge_variable import Tinkerforge_Variable
class IV(Tinkerforge_Variable):
def __init__(self, *args, **kwargs):
self._name = "IV"
self._variable_label = "Independent Variable"
super(IV, self).__init__(*args, **kwargs)
# Method for measur... | 3.4375 | 3 |
Machine Learning/T.py | WilliamPoch/Assignments | 0 | 45228 | from pyimagesearch.centroidtracker import CentroidTracker
from pyimagesearch.trackableobject import TrackableObject
from imutils.video import VideoStream
from imutils.video import FPS
import numpy as np
import argparse
import imutils
import time
import dlib
import cv2
ap = argparse.ArgumentParser()
ap.add_argument("-... | 2.5625 | 3 |
examples/generic_attributes/simulations/declarations.py | daniel17903/gcmi | 0 | 45229 | <reponame>daniel17903/gcmi
from enum import Enum
import math
from functools import reduce
import numpy as np
import os
import csv
test_id = 'test_name'
class MethodContainer:
def __init__(self, allocation_method):
self.errors = {}
self.num_conflicts = []
self.severities = []
self... | 2.765625 | 3 |
main.py | flairmix/tg_bot_coffee | 0 | 45230 | <reponame>flairmix/tg_bot_coffee<filename>main.py
from replit import db
import os
import telebot
from datetime import date, timedelta
API_KEY = os.getenv('API_KEY')
bot = telebot.TeleBot(API_KEY)
@bot.message_handler(commands=['help'])
def help(message):
str_output = "Привет, маленький беспомощный любитель кофе!... | 2.328125 | 2 |
Leetcode/Move Zeroes/Move Zeroes.py | rahil-1407/Data-Structure-and-Algorithms | 51 | 45231 | <reponame>rahil-1407/Data-Structure-and-Algorithms<gh_stars>10-100
class Solution:
def moveZeroes(self, nums: List[int]) -> None:
non_zeros = [i for i in range(len(nums)) if nums[i] != 0] # List comprehension to keep only numbers that are non -zero
nz = len(non_zeros)
nums[:nz] = [... | 3.609375 | 4 |
tools/data_process.py | ztjryg4/HDUCourseCatalog | 5 | 45232 | <reponame>ztjryg4/HDUCourseCatalog<filename>tools/data_process.py<gh_stars>1-10
# coding:utf-8
import csv, codecs
import re
# 前处理:手动替换csv中的逗号 删除上课时间 地点 合班
'''
col0 开课状态
col1 课程名称
col2 学分
col3 考核方式
col4 课程性质
col5 任课教师
col6 选课课号
col7 起止周
col8 上课时间 ele[9]
col9 上课地点 ele[10]
col10 开课学院 ele[8]
col11 合班信息 ele[11]
'''
inputfi... | 2.453125 | 2 |
src/karta_manual_anchor.py | CrackerCat/Karta | 716 | 45233 | #!/usr/bin/python
from config.utils import *
from elementals import Prompter
from function_context import SourceContext, BinaryContext, IslandContext
import os
import sys
import argparse
import logging
from collections import defaultdict
def recordManualAnchors(library_config, knowledge_conf... | 2.640625 | 3 |
commemorativeCoins.py | AndrewLauu/CodeLib | 0 | 45234 | import logging
import os
import time
import requests
from lxml import etree
import urllib.parse
import json
import schedule
from colorama import Fore,init
def getICBCNews()->tuple:
logging.debug('Getting icbc news...')
url = 'https://www.icbc.com.cn/ICBC/纪念币专区/default.htm'
re = requests.get(url)
htm... | 2.6875 | 3 |
sandbox/test/test_misc.py | yingted/pysandbox | 1 | 45235 | from __future__ import with_statement
from sandbox import Sandbox, SandboxError, SandboxConfig, Timeout
from sandbox.test import createSandbox, createSandboxConfig, SkipTest
from sandbox.test.tools import capture_stdout
def test_valid_code():
def valid_code():
assert 1+2 == 3
createSandbox().call(valid... | 2.265625 | 2 |
crawl/spiders/circulation_shareholders.py | maifusha/dongfangcaifu-stock-crawler | 0 | 45236 | # -*- coding: utf-8 -*-
""" 东方财富网:流通股东爬虫(已废弃) """
import scrapy
import json
import time
from crawl import db
from crawl import helper
from crawl.models.Stock import Stock
from crawl.models.CirculationShareholder import CirculationShareholder
class CirculationShareholdersSpider(scrapy.Spider):
name = "circulatio... | 2.671875 | 3 |
mayan/apps/ocr/literals.py | CMU-313/fall-2021-hw2-451-unavailable-for-legal-reasons | 2 | 45237 | DEFAULT_OCR_AUTO_OCR = True
DEFAULT_OCR_BACKEND = 'mayan.apps.ocr.backends.tesseract.Tesseract'
DEFAULT_OCR_BACKEND_ARGUMENTS = {'environment': {'OMP_THREAD_LIMIT': '1'}}
TASK_DOCUMENT_VERSION_PAGE_OCR_RETRY_DELAY = 10
TASK_DOCUMENT_VERSION_PAGE_OCR_TIMEOUT = 10 * 60 # 10 Minutes per page
| 1.03125 | 1 |
tests/test_doc.py | bartdegoede/textpipe | 0 | 45238 | """
Testing for textpipe doc.py
"""
import pytest
import random
import spacy
from textpipe.doc import Doc
TEXT_1 = """<p><b>Text mining</b>, also referred to as <i><b>text data mining</b></i>, roughly
equivalent to <b>text analytics</b>, is the process of deriving high-quality <a href="/wiki/Information"
title="Infor... | 3.328125 | 3 |
pyugend/Comparison.py | university-gender-evolution/py-university-gender-dynamics-pkg | 0 | 45239 | <gh_stars>0
__author__ = 'krishnab'
import numpy as np
import pandas as pd
from bokeh.plotting import figure, output_file, show
from bokeh.layouts import gridplot
from operator import add, sub
from .ColumnSpecs import MODEL_RUN_COLUMNS, EXPORT_COLUMNS_FOR_CSV
from .PlotComposerOverallAttrition import PlotComposerOveral... | 2.265625 | 2 |
drivers/i2c.py | clapeyre/pico-arcade | 0 | 45240 | <filename>drivers/i2c.py
from machine import Pin, I2C
I2C0 = I2C(0, scl=Pin(21), sda=Pin(20))
| 1.992188 | 2 |
article/templatetags/article_tags.py | brahici/WBO | 0 | 45241 | from django.template import Library
from taggit.models import Tag
from ..models import Article, Category
register = Library()
@register.inclusion_tag('article/tags/recent_articles.html')
def get_recent_articles(number=5):
articles = Article.published.all()[:number]
return {'articles': articles,}
@register.... | 2.140625 | 2 |
app/status/models.py | LCOGT/serol | 0 | 45242 | from datetime import datetime
from django.db import models
from django.contrib import admin
from django.contrib.auth.models import AbstractUser
from django.conf import settings
from django_fsm import FSMField, transition
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from djang... | 2.015625 | 2 |
Other/modulosort.py | devAdhiraj/coding-problems | 0 | 45243 | input()
c = int(input())
a = sorted((map(int, input().split())))
a.sort(key= lambda x: x%c)
print(*a) | 3.203125 | 3 |
twindb_backup/exporter/datadog_exporter.py | RyanCPeters/backup | 69 | 45244 | # -*- coding: utf-8 -*-
"""
Module defines DataDog exporter class.
"""
from datadog import initialize, statsd
from twindb_backup.exporter.base_exporter import (
BaseExporter,
ExportCategory,
ExportMeasureType,
)
from twindb_backup.exporter.exceptions import DataDogExporterError
class DataDogExporter(Bas... | 2.1875 | 2 |
src/utils/kick.py | GolfGrab/pog-discord-bot | 0 | 45245 | from src.utils.config import CONFIG
from discord.ext.commands import MemberConverter
from random import sample, random
async def kick_person(user):
await user.move_to(None)
async def random_kick(bot, ctx, user):
prob = random()
if user is not None:
if prob <= 0.5:
await ctx.send(f'โช... | 2.296875 | 2 |
TgBot/handlers/users/watch.py | Na3aga/gmbot | 0 | 45246 | from aiogram import types
from aiogram.dispatcher import FSMContext
from aiogram.dispatcher.filters.builtin import Command
from TgBot.loader import dp
from TgBot.utils.misc import rate_limit
from TgBot.utils import chat_emails_keyboard
from TgBot.states.watch import WatchGmail
from loader import gmail_API, psqldb
from... | 2.1875 | 2 |
Ninja/Leetcode/200_Number_of_Islands.py | cyandterry/Python-Study | 61 | 45247 | """
Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water.
Example 1:
Input:
11110
11010
11000
00000
Output: 1
Exam... | 3.65625 | 4 |
tfrecord_handler/io.py | m-zayan/tfrecord-handler | 0 | 45248 | from tfrecord_handler._io import *
| 1.007813 | 1 |
tests/test_auth.py | tagmeh/uipath-auth | 0 | 45249 | <filename>tests/test_auth.py
import unittest
import configparser
from uipath_api import auth
import os
import datetime
ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
class TestAuth(unittest.TestCase):
def setUp(self) -> None:
self.config = configparser.ConfigParser()
self.con... | 2.859375 | 3 |
send_mail/tasks.py | ritstudentgovernment/PawPrints | 15 | 45250 | <filename>send_mail/tasks.py
"""
Defines email sending tasks that will run in the background with Huey
Author: <NAME> & <NAME> & <NAME> (lxy5611)
All db_tasks will retry at most 3 times.
"""
from petitions.models import *
from profile.models import Profile
from django.conf import settings
from django.db.models import... | 2.21875 | 2 |
parse_loadstone.py | EmperorArthur/Loadstone_Parser | 0 | 45251 | #!/bin/python3
#Utilities for downloading and parsing Final Fantasy 14 Loadstone content
#Copyright <NAME> 2016 BSD 3 clause license
import requests
from bs4 import BeautifulSoup
import re
def loastone_login():
print('http://na.finalfantasyxiv.com/lodestone/account/login/')
#Get a page from the Loadstone
# retur... | 2.578125 | 3 |
backalley/local_file_collector.py | marcsello/backalley | 0 | 45252 | from typing import List
from queue import Queue
import logging
import os
import os.path
from entity_info import EntityInfo, EntityType
class LocalFileCollector:
"""
This class is used to collect all paths that are need to be backed up.
"""
def __init__(self, source_list: List[str], queue_size: int ... | 2.734375 | 3 |
setup.py | spyoungtech/commander | 3 | 45253 | from setuptools import setup
setup(
name='voice-commander',
version='0.0.2a',
packages=['voice_commander'],
install_requires=['fuzzywuzzy', 'fuzzywuzzy[speedup]', 'keyboard', 'easygui', 'pyaudio', 'SpeechRecognition'],
url='https://github.com/spyoungtech/voice-commander',
license='MIT',
aut... | 1.15625 | 1 |
DecoratorEx.py | JaeGyu/PythonEx_1 | 0 | 45254 |
def greet(name):
return "Hello {}".format(name)
print(greet("Alice"))
def greet2(name):
def greet_message():
return "Hello"
return "{} {}".format(greet_message(),name)
print(greet2("Alice"))
def change_name_greet(func):
name = "Alice"
return func(name)
print(change_name_greet(greet))
... | 3.484375 | 3 |
model/QuerySpecificBBCluster.py | nihilistsumo/Blackbox_clustering | 1 | 45255 | from model.BBCluster import CustomSentenceTransformer, OptimCluster, euclid_dist
from experiments.treccar_run import prepare_cluster_data_train_only, prepare_cluster_data2, get_trec_dat, \
get_paratext_dict
from util.Data import InputTRECCARExample
import numpy as np
import torch
import torch.nn as nn
from torch im... | 2.078125 | 2 |
sme_management/tests/test_models.py | BuildForSDG/Team-004-Backend | 2 | 45256 | import os
from django.core.files import File
from django.test import TestCase
from django.contrib.auth import get_user_model
from django.conf import settings
from sme_management.models import *
def create_sample_sme(org_name='Andela', address='Ikorodu Rd'):
"""Create and return sample sme."""
return SME.obj... | 2.21875 | 2 |
python/tests/evaluation_helpers/test_http_helper.py | kbarnes3/TierOnePointFive | 0 | 45257 | import requests
import requests.exceptions
import requests_mock
from tieronepointfive.enums import State, Transition
from tieronepointfive.state_machine import StateMachineTick
from tieronepointfive.evaluation_helpers import HttpHelper
from ..mock_config import MockConfig
google = 'https://www.google.com'
b... | 2.296875 | 2 |
glance/tests/gate/test_data_migration_version.py | bwLehrpool/glance | 0 | 45258 | # Copyright 2019 Red Hat, Inc.
# 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... | 1.835938 | 2 |
iota/commands/extended/helpers.py | joWeiss/iota.lib.py | 0 | 45259 | <gh_stars>0
class Helpers(object):
"""
Adds additional helper functions that aren't part of the core or extended
API.
"""
def __init__(self, api):
self.api = api
def is_promotable(self, tail):
# type: (TransactionHash) -> bool
"""
Determines if a tail transaction is promotable.
:param... | 2.453125 | 2 |
setup.py | skunkie/vrealize-pysdk | 2 | 45260 | <reponame>skunkie/vrealize-pysdk
import os
from setuptools import setup
def read(fname):
with open(os.path.join(os.path.dirname(__file__), fname)) as f:
return f.read()
setup(
name='vralib',
packages=['vralib'],
version='0.1',
description='This is a helper library used to manage vRealiz... | 1.59375 | 2 |
examples/sandbox_api_v2/complex_project.py | acbart/python-analysis | 14 | 45261 | '''
Instructor control script for Project 5- Text Adventure Beta
@author: acbart
@requires: pedal
@title: Project 5- Text Adventure- Control Script
@version: 4/4/2019 10:29am
'''
__version__ = 1
from pedal.assertions.organizers import phase, postcondition, precondition
from pedal.assertions.setup import resolve_all
f... | 2.15625 | 2 |
neatest/genome.py | goktug97/NEATEST | 13 | 45262 | <reponame>goktug97/NEATEST<gh_stars>10-100
from typing import List
import math
import os
from .connection import Connection, GeneRate, Weight
from .node import Node, NodeType, group_nodes
from .version import VERSION
import cloudpickle # type: ignore
try:
disable_mpi = os.environ.get('NEATEST_DISABLE_MPI')
i... | 2.203125 | 2 |
release/stubs.min/System/Windows/Forms/__init___parts/FormClosedEventArgs.py | YKato521/ironpython-stubs | 0 | 45263 | class FormClosedEventArgs(EventArgs):
"""
Provides data for the System.Windows.Forms.Form.FormClosed event.
FormClosedEventArgs(closeReason: CloseReason)
"""
@staticmethod
def __new__(self, closeReason):
""" __new__(cls: type,closeReason: CloseReason) """
pass
Clos... | 2.078125 | 2 |
x_server.py | koshtony/remote-xploiter | 0 | 45264 | <filename>x_server.py
from threading import *
from socket import *
class server:
def __init__(self):
self.serv=socket(AF_INET,SOCK_STREAM)
address=('192.168.1.18',2234)
self.serv.bind(address)
self.serv.listen(5)
self.con,addr=self.serv.accept()
self.os = self.con.re... | 3.046875 | 3 |
jmeter_api/configs/__init__.py | dashawn888/jmeter_api | 11 | 45265 | <gh_stars>10-100
from jmeter_api.configs.counter.elements import Counter
from jmeter_api.configs.csv_data_set_config.elements import CsvDataSetConfig
from jmeter_api.configs.http_auth_manager.elements import HTTPAuthManager
from jmeter_api.configs.http_cache_manager.elements import HTTPCacheManager
from jmeter_api.conf... | 1.375 | 1 |
2020/17/part1.py | cheshyre/advent-of-code | 1 | 45266 | <reponame>cheshyre/advent-of-code
import os
import cube
cur_dir = os.path.dirname(os.path.abspath(__file__))
z = 0
active_dict = {}
with open(f"{cur_dir}/input") as f:
for y, line in enumerate(f):
for x, char in enumerate(line.strip()):
if char == "#":
active_dict[(x, y, z)] ... | 2.875 | 3 |
src/features/build_features.py | victormmp/ibm_advanced_ds_capstone | 0 | 45267 | import csv
import pandas as pd
import numpy as np
import os
import sys
root_dir = os.path.dirname(__file__)
sys.path.insert(0, root_dir + '/../..')
class ETL:
def __init__(self):
self.data = None
def load_data(self, path):
self.data = pd.read_csv(path)
return self
| 2.78125 | 3 |
03/03/islower.py | pylangstudy/201708 | 0 | 45268 | s = b'abc'; print(s.islower(), s)
s = b'Abc'; print(s.islower(), s)
s = b'ABC'; print(s.islower(), s)
s = b'123'; print(s.islower(), s)
s = b'(_)'; print(s.islower(), s)
s = b'(abc)'; print(s.islower(), s)
s = b'(aBc)'; print(s.islower(), s)
s = bytearray(b'abc'); print(s.islower(), s)
s = bytearray(b'Abc'); print(s.i... | 3.109375 | 3 |
tornadoutil.py | langloisjp/tornado-logging-app | 1 | 45269 | """
Tornado server utilities
- LoggingApplication: a base Application class with logging and metrics
- RequestHandler: a base request handler with helpers
Dependencies:
- metrics
- servicelog
See tests/test_tornadoutil.py for usage example.
"""
import json
import datetime
import uuid
import httplib # for httplib.r... | 2.546875 | 3 |
doc/source/EXAMPLES/mu_reproj_interact.py | kapteyn-astro/kapteyn | 3 | 45270 | <reponame>kapteyn-astro/kapteyn
from kapteyn import maputils
from matplotlib import pyplot as plt
import numpy
# Read first image as base
Basefits = maputils.FITSimage(promptfie=maputils.prompt_fitsfile)
print(type(Basefits), isinstance(Basefits, maputils.FITSimage))
# Get data from a second image. This is the data ... | 2.796875 | 3 |
eventline/api_object.py | exograd/py-eventline | 0 | 45271 | # Copyright (c) 2022 Exograd SAS.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WA... | 2.25 | 2 |
python/Container With Most Water.py | kuwarkapur/Hacktoberfest-2022 | 1 | 45272 | class Solution:
def maxArea(self, height: List[int]) -> int:
i = 0
j = len(height)-1
res = 0
area = 0
while i < j:
area = min(height[i],height[j])*(j-i)
#print(area)
res = max(res,area)
if height[i]<height[j]:
i+... | 3.140625 | 3 |
dplace_app/load/glottocode.py | Lumilam/D-Place | 0 | 45273 | # -*- coding: utf-8 -*-
import logging
from collections import defaultdict
from dplace_app.models import Language, ISOCode, Society, LanguageFamily
from util import delete_all
def xd_to_language(items, languoids):
delete_all(Language)
delete_all(LanguageFamily)
delete_all(ISOCode)
glottolog = {l['i... | 2.28125 | 2 |
so_ana_util/error_handling.py | HBernigau/StackOverflowAnalysis | 0 | 45274 | """
contains several utilities for error handling
allows for storing "chained error information" without copying the entire
traceback object.
Note: module is currently not used / within a later refactoring the following error-Approach will be
implemented:
- bellow-flow level errors are never ignored / rather: throw ... | 2.53125 | 3 |
lib/hyperparams.py | J-Moravec/pairtree | 15 | 45275 | explanations = {
'gamma': '''
Proportion of tree modifications that should use mutrel-informed choice for
node to move, rather than uniform choice
''',
'zeta': '''
Proportion of tree modifications that should use mutrel-informed choice for
destination to move node to, rather than uniform choice
... | 2.421875 | 2 |
test/com/facebook/buck/parser/testdata/python_user_defined_rules/errors/invalid_attr_name/bad_attrs.bzl | Unknoob/buck | 8,027 | 45276 | <reponame>Unknoob/buck
def _impl(_ctx):
pass
bad_attrs = rule(implementation = _impl, attrs = {"1234isntvalid": attr.int()})
| 1.421875 | 1 |
app/database/seed/seeds/real_madrid/team.py | batistado/FlaskFootball | 0 | 45277 | import os
import app.database.seed.seed_helper as helper
from app.translation.deserializer import Deserializer
from app.extensions import db
real_madrid = {
'name': '<NAME>',
'players': helper.read_csv_file(os.path.join(os.path.dirname(__file__), 'players.csv')),
}
team = Deserializer().deserialize_team(rea... | 2.171875 | 2 |
solver/problem4.py | suzannastep/eulers | 0 | 45278 | import solver.algorithms as alg
import numpy as np
def problem4(t0, tf, NA0, NB0, tauA, tauB, n, returnlist=False):
"""Uses Euler's method to model the solution to a radioactive decay problem where dNA/dt = -NA/tauA and dNB/dt = NA/tauA - NB/tauB.
Args:
t0 (float): Start time
tf (float): End t... | 3.515625 | 4 |
mhkit/river/io/__init__.py | Matthew-Boyd/MHKiT-Python | 21 | 45279 | from mhkit.river.io import usgs
| 1.085938 | 1 |
examples/loop.py | letmaik/exhaust | 1 | 45280 | # This example shows how a space can be modelled with loops.
import exhaust
def generate_numbers(state: exhaust.State):
numbers = []
for _ in range(5):
numbers.append(state.randint(1, 5))
return numbers
for numbers in exhaust.space(generate_numbers):
print(numbers)
# Output:
# [1, 1, 1, 1, 1... | 3.890625 | 4 |
src/unittest/python/raq_matchers/TimeMatchers.py | Continuous-Delivery-Machines/raqcrawl | 0 | 45281 | from datetime import datetime, timedelta
from hamcrest.core.base_matcher import BaseMatcher
class WithinDatetimeMatcher(BaseMatcher):
def __init__(self, lower_limit_datetime: datetime, upper_limit_datetime: datetime):
self.__lowerLimit = lower_limit_datetime
self.__upperLimit = upper_limit_datet... | 3.015625 | 3 |
seatsvotes/cvtools.py | ljwolf/seatsvotes | 0 | 45282 | <filename>seatsvotes/cvtools.py
import numpy as np
import statsmodels as __sm
import pandas as pd
sm = __sm.api
def leverage(results):
"""
Compute the leverage matrix from a WLS model:
H = W^.5 X(X'WX)^-1X'W^.5
where W^.5 is the scalar square root.
"""
if isinstance(results.model, sm.WLS):
... | 2.78125 | 3 |
pana.py | gigae-Cyon/PearlAbyssNewsArchive | 0 | 45283 | import requests
from bs4 import BeautifulSoup
import pickle
import re, datetime
# 뉴스 중복 확인
def duplication_check(new_news, saved_news_list):
if new_news in saved_news_list:
return False
else:
saved_news_list.append(new_news)
return True
# 기사 날짜, 시간 표현 (시간정보가 '~전'인 경우)
def get_released_time1(current_ti... | 2.5625 | 3 |
app/api/v1/models/meetups_model.py | MRichardN/Questioner-api | 0 | 45284 | <reponame>MRichardN/Questioner-api
from datetime import datetime
from ..utils.utils import idGenerator
from .base_model import Model
meetups = []
class Meetup(Model):
""" This class represents the meetup model."""
def __init__(self):
super().__init__(meetups)
def save(self, data):
""" Sa... | 2.734375 | 3 |
code/extracted_features_gridsearch.py | prediction2020/multimodal-classification | 2 | 45285 | """
File name: extracted_features_gridsearch.py
Author: <NAME>
Date created: 29.04.2019
"""
import numpy as np
import sys
import os
import yaml
import pickle
import pandas as pd
import pandas.core.indexes
sys.modules['pandas.indexes'] = pandas.core.indexes
import json
import time
import keras
import tensorflow as t... | 2.078125 | 2 |
FootageOverview/FootageManager/migrations/0003_footage_staticpath.py | nylser/FootageOverview | 0 | 45286 | # Generated by Django 2.1.1 on 2018-09-20 07:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('FootageManager', '0002_footage_length'),
]
operations = [
migrations.AddField(
model_name='footage',
name='staticpat... | 1.789063 | 2 |
dataschema/dataschemaMgmt.py | italia/daf-ckan-crawler | 0 | 45287 | import pandas as pd
import json
import numpy as np
#DEFINITIONS
NAMESPACE = "it.gov.daf.dataset.opendata"
def getData(path):
if (path.lower().endswith((".json", ".geojson"))):
with open(path) as data_file:
dataJson = json.load(data_file)
return pd.io.json.json_normalize(dataJson, sep='... | 2.78125 | 3 |
scripts/misc/redis_test.py | cclauss/archai | 344 | 45288 | import redis
redis_client = redis.StrictRedis(host="127.0.0.1", port=6379)
input("") | 1.75 | 2 |
app/route/errors.py | DreamAndDead/flask-glass | 2 | 45289 | <gh_stars>1-10
"""
what flask do when 404 or something wrong happens
"""
from flask import render_template
from . import main
@main.app_errorhandler(404)
def page_not_found(e):
"""
404 error page
"""
return render_template('404.html'), 404
@main.app_errorhandler(500)
def internal_server_error(e):
... | 2.5 | 2 |
cert_issuer/transaction_handler.py | NunoEdgarGFlowHub/cert-issuer | 0 | 45290 | import logging
import random
from abc import abstractmethod
from pycoin.serialize import b2h
from cert_issuer import tx_utils
from cert_issuer.errors import InsufficientFundsError
from cert_issuer.signer import FinalizableSigner
# Estimate fees assuming worst case 3 inputs
ESTIMATE_NUM_INPUTS = 3
# Estimate fees as... | 2.375 | 2 |
pypro/aperitivos/tests/test_video.py | ravellys/curso-django | 0 | 45291 | <reponame>ravellys/curso-django
import pytest
from django.urls import reverse
from model_mommy import mommy
from pypro.aperitivos.models import Video
from pypro.django_assertions import assert_contains
@pytest.fixture
def video(db):
return mommy.make(Video)
@pytest.fixture
def resp(client, video):
return c... | 2.296875 | 2 |
tests/test_analytics.py | lakshyaag/csgo | 118 | 45292 | import pytest
import numpy as np
from csgo.analytics.distance import (
bombsite_distance,
point_distance,
polygon_area,
area_distance,
)
from csgo.analytics.coords import Encoder
class TestCSGOAnalytics:
"""Class to test CSGO analytics"""
def test_bombsite_distance(self):
"""Test bo... | 2.59375 | 3 |
Problems/Dynamic Programming/Easy/BuySellStock1/buy_sell_stock_1.py | dolong2110/Algorithm-By-Problems-Python | 1 | 45293 | <filename>Problems/Dynamic Programming/Easy/BuySellStock1/buy_sell_stock_1.py
from typing import List
def max_profit_1(prices: List[int]) -> int:
min_price, max_profit = prices[0], 0
for price in prices:
min_price = min(min_price, price)
profit = price - min_price
max_profit = max(max_p... | 3.796875 | 4 |
src/Web Server Micropython/src/config.py | AlestanAlves/IoT-Devices | 0 | 45294 | <reponame>AlestanAlves/IoT-Devices<gh_stars>0
# Networking settings
ssid = ""
password = "" | 0.953125 | 1 |
equinox/__init__.py | marcelroed/equinox | 0 | 45295 | from . import experimental, nn
from .filters import (
combine,
filter,
is_array,
is_array_like,
is_inexact_array,
is_inexact_array_like,
partition,
)
from .grad import filter_custom_vjp, filter_grad, filter_value_and_grad
from .jit import filter_jit
from .module import Module, static_field
f... | 0.929688 | 1 |
server/edd/__init__.py | zhwycsz/edd | 1 | 45296 | # coding: utf-8
import logging
import re
from itertools import chain
from textwrap import TextWrapper
from django.core import mail
from django.test import TestCase as DjangoTestCase
from django.views import debug
from six import string_types
from six.moves.urllib.parse import urlparse, urlunparse
from threadlocals.th... | 2.03125 | 2 |
zfs/obj_desc.py | hiliev/py-zfs-recovery | 14 | 45297 | # Copyright (c) 2017 <NAME> <<EMAIL>>
# 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 retain the above copyright notice, this
# list of conditions and t... | 0.960938 | 1 |
ner-cmv-tagger.py | jouniluoma/ner-cmv-tagger | 0 | 45298 | <filename>ner-cmv-tagger.py
import os
import sys
import re
import numpy as np
from collections import deque
import functools
from multiprocessing import Pool
from multiprocessing import cpu_count
import tensorflow as tf
from common import load_ner_model, argument_parser
from pubmeddb import stream_documents, get_wo... | 2.1875 | 2 |
sopel/util/textgen.py | Ameenekosan/Yumiko | 0 | 45299 | <gh_stars>0
import re
import random
TEMPLATE_RE = re.compile(r"\{(.+?)\}")
class TextGenerator(object):
def __init__(self, templates, parts, default_templates=None, variables=None):
self.templates = templates
self.default_templates = default_templates
self.parts = parts
self.varia... | 3.484375 | 3 |