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 |
|---|---|---|---|---|---|---|
python/testData/intentions/quotedStringDoubleSlash_after.py | jnthn/intellij-community | 2 | 36800 | <reponame>jnthn/intellij-community<gh_stars>1-10
data_path = dirname(realpath(__file__)).replace("\\", '/') | 1.46875 | 1 |
usfm_references/__init__.py | anthonyraj/usfm-references | 0 | 36801 | """
USFM References Tools
"""
import re
__version__ = '1.1.0'
ANY_REF = re.compile(r'^[1-9A-Z]{3}\.([0-9]{1,3}(_[0-9]+)?(\.[0-9]{1,3})?|INTRO\d+)$')
CHAPTER = re.compile(r'^[1-6A-Z]{3}\.[0-9]{1,3}(_[0-9]+)?$')
CHAPTER_OR_INTRO = re.compile(r'^[1-9A-Z]{3}\.([0-9]{1,3}(_[0-9]+)?|INTRO\d+)$')
SINGLE_CHAPTER_OR_VERSE = r... | 1.976563 | 2 |
dataset/gla_vol_time_series/cumul_to_rates_rgi01regions.py | subond/ww_tvol_study | 20 | 36802 | <gh_stars>10-100
import os, sys
import pandas as pd
import numpy as np
import pyddem.tdem_tools as tt
# example to integrate the RGI-O1 cumulative time series into rates with time-varying glacier areas
# file with time-varying areas for RGI regions
fn_tarea = '/home/atom/data/inventory_products/RGI/tarea_zemp.csv'
#... | 2.15625 | 2 |
wallarm_api/core/api/triggers_api.py | Neraverin/wallarm-api-python | 0 | 36803 | from wallarm_api.core.api.base_api import BaseApi
from wallarm_api.core.models.trigger import Triggers
class TriggersApi(BaseApi):
def get_triggers(self, clientid):
url = f'/v2/clients/{clientid}/triggers?denormalize=true'
response = self.client.get(url)
triggers = Triggers(trig... | 2.015625 | 2 |
kokki/cookbooks/gearmand/metadata.py | samuel/kokki | 11 | 36804 | <gh_stars>10-100
__description__ = "Gearman RPC broker"
__config__ = {
"gearmand.listen_address": dict(
description = "IP address to bind to",
default = "127.0.0.1",
),
"gearmand.user": dict(
display_name = "Gearmand user",
description = "User to run the gearmand procses as"... | 1.625 | 2 |
class0/pil.py | dapianzi/tf_start | 0 | 36805 | from PIL import Image
from matplotlib import pyplot as plt
import numpy as np
names = locals()
img0 = Image.open("./assets/pyCharm.png")
# print image info:
print(img0.size, img0.format, img0.mode, np.array(img0))
# save other format
# img0.save('./assets/pyCharm.tiff')
# img0.convert('RGB').save('./assets/pyCharm.jp... | 3.0625 | 3 |
rpython/jit/backend/x86/codebuf.py | kantai/passe-pypy-taint-tracking | 2 | 36806 | from rpython.rtyper.lltypesystem import lltype, rffi
from rpython.rlib.rarithmetic import intmask
from rpython.rlib.debug import debug_start, debug_print, debug_stop
from rpython.rlib.debug import have_debug_prints
from rpython.jit.backend.llsupport.asmmemmgr import BlockBuilderMixin
from rpython.jit.backend.x86.rx86 i... | 1.921875 | 2 |
apps/integrations/github/resources/__init__.py | wizzzet/github_backend | 0 | 36807 | <gh_stars>0
from .users import UsersListResource # NOQA
from .users import UserResource # NOQA
from .followers import FollowersListResource # NOQA
from .repos import ReposListResource # NOQA
from .repos import RepoResource # NOQA
| 1.070313 | 1 |
2019/day03/day03_part1.py | boffman/adventofcode | 0 | 36808 | import math
def apply_move(maze, x, y):
key = "{},{}".format(x,y)
maze.add(key)
def calc_distance(key):
x, y = [int(v) for v in key.split(",")]
return abs(x) + abs(y)
def find_smallest_distance(maze):
min_distance = None
for key in maze:
distance = calc_distance(key)
print("I... | 4 | 4 |
server/src/weaverbird/pipeline/steps/aggregate.py | JeremyJacquemont/weaverbird | 54 | 36809 | from typing import List, Literal, Optional, Sequence
from pydantic import Field, root_validator, validator
from pydantic.main import BaseModel
from weaverbird.pipeline.steps.utils.base import BaseStep
from weaverbird.pipeline.steps.utils.render_variables import StepWithVariablesMixin
from weaverbird.pipeline.steps.ut... | 2.359375 | 2 |
src/ea/libs/FileModels/TestUnit.py | dmachard/extensivetesting | 9 | 36810 | <reponame>dmachard/extensivetesting<filename>src/ea/libs/FileModels/TestUnit.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------
# Copyright (c) 2010-2021 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this... | 1.445313 | 1 |
BenchmarkScripts/convert2panoptic.py | Skywalker666666/scannet_dataset_prep | 0 | 36811 | <reponame>Skywalker666666/scannet_dataset_prep<gh_stars>0
#!/usr/bin/python
#
# Convert to COCO-style panoptic segmentation format (http://cocodataset.org/#format-data).
#
# python imports
from __future__ import print_function, absolute_import, division, unicode_literals
import os
import glob
import sys
import argpars... | 2.28125 | 2 |
tlmshop/settings.py | LegionMarket/django-cms-base | 0 | 36812 | <filename>tlmshop/settings.py<gh_stars>0
"""
Django settings for this project.
Generated by 'django-admin startproject' using Django 1.10.7.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.co... | 1.882813 | 2 |
examples/02-hello_kml.py | JMSchietekat/polycircles | 9 | 36813 | <filename>examples/02-hello_kml.py
import os
import simplekml
from polycircles.polycircles import Polycircle
polycircle = Polycircle(latitude=31.611878, longitude=34.505351, radius=100)
kml = simplekml.Kml()
pol = kml.newpolygon(name=f"Polycircle", outerboundaryis=polycircle.to_kml())
kml.save('02.kml') | 3.234375 | 3 |
amazon_main_xgboost.py | twankim/ensemble_amazon | 236 | 36814 | """ Amazon Access Challenge Code for ensemble
<NAME> script for Amazon .
xgboost on input data
based on <NAME>'s Script.
"""
from __future_
_ import division
import numpy as np
from sklearn import preprocessing
from sklearn.metrics import roc_auc_score
import XGBoostClassifier as xg
from sklearn.cross_validation i... | 2.6875 | 3 |
venv/lib/python3.6/site-packages/ansible/modules/set_fact.py | usegalaxy-no/usegalaxy | 1 | 36815 | <filename>venv/lib/python3.6/site-packages/ansible/modules/set_fact.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2013, <NAME> (@dagwieers) <<EMAIL>>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_fun... | 2.421875 | 2 |
general/general_app_for_company/general_ledger.py | surajano/general | 0 | 36816 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import flt, cstr, cint
from frappe import _
from frappe.model.meta import get_field_precision
from erpnext.accounts.util... | 1.835938 | 2 |
virgool_cloud/config-sample.py | mavahedinia/virgoolcloud | 1 | 36817 | <filename>virgool_cloud/config-sample.py
bot_token = ''
waiting_timeout = 5 # Seconds
admin_id = ""
channel_id = ""
bitly_access_token = ""
vars_file = ""
| 1.28125 | 1 |
src/runs/step321_pulmonary_summary.py | uw-bionlp/ards | 0 | 36818 | <filename>src/runs/step321_pulmonary_summary.py
from __future__ import division, print_function, unicode_literals
from sacred import Experiment
from sacred.observers import FileStorageObserver
from pathlib import Path
import os
import re
import numpy as np
import json
import joblib
import pandas as pd
from collection... | 1.59375 | 2 |
pydanmaku_old/game.py | Alokpro1/PyDanmaku | 0 | 36819 | import pygame
import inspect
from .bullet import Bullet
from .player import Player
PRESSED = {
pygame.K_UP: 'up',
pygame.K_DOWN: 'down',
pygame.K_LEFT: 'left',
pygame.K_RIGHT: 'right',
}
DOWN = {
pygame.K_LSHIFT: 'shift',
}
UP = {
pygame.K_LSHIFT: 'unshift',
}
class Game:
def __init__... | 2.78125 | 3 |
inz/tests/test_utils.py | matbur/inz | 0 | 36820 | import numpy as np
import pandas as pd
import pytest
from sklearn.feature_selection import SelectKBest, chi2 as sk_chi2
from inz.utils import chi2, select_k_best, split, train_test_split
def test_split_list_int():
ints = list(range(7))
want = [[0, 1, 2], [3, 4, 5], [6]]
get = list(split(ints, 3))
ass... | 2.640625 | 3 |
Library/Database.py | kensand/HonorsProject | 0 | 36821 | <filename>Library/Database.py
import psycopg2
batch_size = 10000
embedding_length=256
#These are the default database settings, and assumes the tweets, tweets_hashtags, and hashtags tables are in the public schema.
# default database information
Dbname = 'postgres'
User = 'kenny'
Host = 'localhost'
Password = '<PAS... | 2.15625 | 2 |
train.py | TaoHuUMD/3D-Reconstruction | 0 | 36822 | <reponame>TaoHuUMD/3D-Reconstruction
import time
import open3d
from options.train_options import TrainOptions
from data import CreateDataLoader
from models import create_model
from util.visualizer import Visualizer
from config import *
import os
from torch.utils.tensorboard import SummaryWriter
if __name__ == '__main... | 1.992188 | 2 |
tests/contracts/KT1BDMQEhMATgVAcwtgqNgZNBM6LEM1PANuM/test_michelson_coding_KT1BDM.py | juztin/pytezos-1 | 1 | 36823 | from unittest import TestCase
from tests import get_data
from pytezos.michelson.micheline import michelson_to_micheline
from pytezos.michelson.formatter import micheline_to_michelson
class MichelsonCodingTestKT1BDM(TestCase):
def setUp(self):
self.maxDiff = None
def test_michelson_parse_code_KT... | 2.734375 | 3 |
kmeans/dbscan.py | kravtsun/au-ml | 0 | 36824 | #!/bin/python
import argparse
import numpy as np
from cluster import read_csv, plot_clusters, distance, print_cluster_distribution
def kmeans_chosen(data, centers):
def best_cluster(p):
distances = [distance(p, c) for c in centers]
return np.argmin(distances)
return np.apply_along_axis(best_clu... | 2.71875 | 3 |
harness.py | vmchale/phash-fut | 2 | 36825 | import timeit
setup = """
import phash
import imageio
import numpy as np
mod = phash.phash()
"""
read_image = """
img0 = np.array(imageio.imread('data/frog.jpeg', pilmode='F'))
mod.img_hash_f32(img0)
"""
print('data/frog.jpeg', timeit.timeit(read_image, setup=setup, number=100) * 10, "ms")
setup_imagehash = """
fr... | 2.46875 | 2 |
simopt/models/san.py | simopt-admin/simopt | 24 | 36826 | <reponame>simopt-admin/simopt
"""
Summary
-------
Simulate duration of stochastic activity network (SAN).
"""
import numpy as np
from base import Model, Problem
class SAN(Model):
"""
A model that simulates a stochastic activity network problem with tasks
that have exponentially distributed durations, and... | 3.09375 | 3 |
algorithms/da3c/__init__.py | j0k/relaax | 4 | 36827 | <gh_stars>1-10
from .common.config import Config
from .parameter_server.parameter_server import ParameterServer
from .agent.agent import Agent
from .bridge.bridge import BridgeControl
| 1.132813 | 1 |
examples/simple-box.py | renovate-tests/gaphas | 0 | 36828 | <filename>examples/simple-box.py
#!/usr/bin/env python
"""A simple example containing two boxes and a line.
"""
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
from gaphas import Canvas, GtkView
from gaphas.examples import Box
from gaphas.painter import DefaultPainter
from gaphas.item import... | 3.171875 | 3 |
09_NNI/files/nni_xgb.py | aiq2020-tw/automl-notebooks | 17 | 36829 | <gh_stars>10-100
# NNIをインポートする
import nni
import pandas as pd
import xgboost as xgb
from sklearn.model_selection import KFold, cross_val_score
from sklearn.preprocessing import LabelEncoder
def load_data(train_file_path):
"""
データの前処理を行う関数
Parameters
----------
train_file_path : str
... | 2.796875 | 3 |
tests/data.py | biologic/stylus | 0 | 36830 | <gh_stars>0
# The following is a list of gene-plan combinations which should
# not be run
BLACKLIST = [
('8C58', 'performance'), # performance.xml make specific references to 52DC
('7DDA', 'performance') # performance.xml make specific references to 52DC
]
IGNORE = {
'history' : ['uuid', 'creationTool'... | 1.601563 | 2 |
hidtcore.py | zengxinzhy/HiDT | 0 | 36831 | import torch
import sys
import coremltools as ct
from hidt.style_transformer import StyleTransformer
from ops import inference_size
sys.path.append('./HiDT')
class HiDT(torch.nn.Module):
def __init__(self):
super().__init__()
config_path = './configs/daytime.yaml'
gen_weights_path = './t... | 2.109375 | 2 |
prm/relations/migrations/0010_delete_mood.py | justaname94/innovathon2019 | 0 | 36832 | <filename>prm/relations/migrations/0010_delete_mood.py
# Generated by Django 2.2.6 on 2019-10-03 23:37
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('relations', '0009_auto_20191003_2258'),
]
operations = [
migrations.DeleteModel(
... | 1.257813 | 1 |
tests/fake_websocket_server.py | UrbanOS-Examples/PredictiveParking | 2 | 36833 | <reponame>UrbanOS-Examples/PredictiveParking
import json
def _standard_join_messages():
connection_status = [{
'event': 'phx_reply',
'payload': {
'status': 'ok'
}
}]
cached_records = [
update_event({
'id': '9861',
'occupancy': 'UNOCCUPIE... | 2.015625 | 2 |
simplepush/__init__.py | bobquest33/django-simplepush | 1 | 36834 | import json
from .helpers import send_notification_to_user
def send_user_notification(user, payload, ttl=0):
payload = json.dumps(payload)
send_notification_to_user(user, payload, ttl) | 2.203125 | 2 |
goalrepresent/models/lenia_BC/pytorchnnrepresentation/helper.py | flowersteam/holmes | 6 | 36835 | <gh_stars>1-10
import math
from math import floor
from numbers import Number
import h5py
import numpy as np
import torch
from torch import nn
from torch.nn import functional as F
from torch.nn.init import xavier_uniform_, xavier_normal_, kaiming_uniform_, kaiming_normal_
from torch.utils.data import Dataset
from torch... | 2.421875 | 2 |
100_days_of_code/Intermediate+/day_32/practice/main.py | Tiago-S-Ribeiro/Python-Pro-Bootcamp | 0 | 36836 | <gh_stars>0
import smtplib
import random
import datetime as dt
from data import EML, PWD, DST, HOST_SERVER
if dt.datetime.now().weekday() == 0: #Monday
try:
with open("./quotes.txt") as file:
quotes = file.readlines()
except FileNotFoundError:
print("File not found. Please provide a... | 2.84375 | 3 |
tenant_workspace/templatetags/qt_066_tag.py | smegurus/smegurus-django | 1 | 36837 | <filename>tenant_workspace/templatetags/qt_066_tag.py
# -*- coding: utf-8 -*-
from django import template
from django.db.models import Q
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from django.shortcuts import get_objec... | 1.804688 | 2 |
octavia_f5/common/constants.py | notandy/octavia-f5-provider-driver | 0 | 36838 | <filename>octavia_f5/common/constants.py
# Copyright 2018 SAP SE
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | 1.210938 | 1 |
tests/loris/parameters/api_tests.py | jpstroop/loris-redux | 7 | 36839 | from loris.parameters.api import AbstractParameter
from unittest.mock import Mock
import pytest
class ProperImpl(AbstractParameter):
def __init__(self, uri_slice, enabled_features):
super(ProperImpl, self).__init__(uri_slice, enabled_features)
@property
def canonical(self):
return "canoni... | 2.6875 | 3 |
29_ticTacToeGame.py | hjlarrea/pythonExercises | 0 | 36840 | <reponame>hjlarrea/pythonExercises
#This exercise is Part 4 of 4 of the Tic Tac Toe exercise series. The other exercises are: Part 1, Part 2, and Part 3.
#
#In 3 previous exercises, we built up a few components needed to build a Tic Tac Toe game in Python:
#
# Draw the Tic Tac Toe game board
# Checking whether a ... | 4.375 | 4 |
rdr_server/model/site.py | robabram/raw-data-repository-v2 | 0 | 36841 | from rdr_server.common.enums import SiteStatus, EnrollingStatus, DigitalSchedulingStatus, ObsoleteStatus
from sqlalchemy import Column, Integer, String, Date, Float, ForeignKey, UnicodeText
from rdr_server.model.base_model import BaseModel, ModelMixin, ModelEnum
class Site(ModelMixin, BaseModel):
__tablename__ =... | 2.125 | 2 |
hacku/contents/models/contents.py | aleducode/hacku_backend | 1 | 36842 | <filename>hacku/contents/models/contents.py
"""Contents Models."""
# Django
from django.db import models
from django.contrib.postgres.fields import JSONField
# utilities
from hacku.utils.models import HackuModel
class ContentType(models.Model):
"""Content type format."""
name = models.CharField('Content ty... | 2.359375 | 2 |
passwd_validate/utils.py | clamytoe/Password-Validate | 2 | 36843 | # _*_ coding: utf-8 _*_
"""
password-validate.utils
-----------------------
This module provides utility functions that are used within password_validate
that are also useful for external consumption.
"""
import hashlib
from os.path import abspath, dirname, join
DICTIONARY_LOC = "dictionary_files"
DICTIONARY = "dicti... | 3.53125 | 4 |
downstream/finetune/eval.py | YihengZhang-CV/Sequence-Contrastive-Learning | 31 | 36844 | <gh_stars>10-100
import argparse
import os
import json
import torch
import torch.backends.cudnn as cudnn
import torch.distributed as dist
from torch.nn.parallel import DistributedDataParallel
from torchvision import transforms
from seco_util import clip_transforms
from seco_util.logger import setup_logger
from datase... | 1.992188 | 2 |
notebooks/data_cleaning/track_meta.py | roannav/learntools | 359 | 36845 | track = dict(
author_username='alexisbcook',
course_name='Data Cleaning',
course_url='https://www.kaggle.com/learn/data-cleaning',
course_forum_url='https://www.kaggle.com/learn-forum/172650'
)
lessons = [ {'topic': topic_name} for topic_name in
['Handling missing values', #1
... | 1.9375 | 2 |
three_sum.py | jaebradley/leetcode.py | 0 | 36846 | <filename>three_sum.py
"""
https://leetcode.com/problems/3sum/
Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.
Note:
The solution set must not contain duplicate triplets.
Example:
Given array nums = [-... | 3.890625 | 4 |
bookwyrm/migrations/0145_sitesettings_version.py | mouse-reeve/fedireads | 270 | 36847 | <reponame>mouse-reeve/fedireads
# Generated by Django 3.2.12 on 2022-03-16 18:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("bookwyrm", "0144_alter_announcement_display_type"),
]
operations = [
migrations.AddField(
model... | 1.398438 | 1 |
crawls/ProxyPool/proxy_spiders/spider_ip181.py | NCU-NLP/news_feed | 2 | 36848 | <reponame>NCU-NLP/news_feed<gh_stars>1-10
import requests
import re
import logging
import time
import threading
from bs4 import BeautifulSoup
headers = {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-US,en;q=0.5",
... | 2.625 | 3 |
toolbox/docker/utils.py | avatao-content/challenge-engine | 23 | 36849 | <filename>toolbox/docker/utils.py<gh_stars>10-100
import os
import subprocess
from glob import glob
from typing import Any, Dict, Iterable, List, Tuple
from toolbox.config.docker import DOCKER_REGISTRY, DOCKER_REGISTRY_MIRRORS, WHITELISTED_DOCKER_REGISTRIES
from toolbox.utils import run_cmd, fatal_error
def get_imag... | 2.3125 | 2 |
complex_neural_net.py | mehdihosseinimoghadam/Complex-Neural-Networks | 0 | 36850 | """
Complex Valued Neural Layers From Scratch
Programmed by <NAME>
* MIT Licence
* 2022-02-15 Last Update
"""
from torch import nn
import torch
##__________________________________Complex Linear Layer __________________________________________
class CLinear(nn.Module):
def __init__(self, in_channels, ... | 2.640625 | 3 |
scripts/sample_script.py | TheConfused/LinkedIn | 0 | 36851 | from simplelinkedin import LinkedIn
def run_script(settings):
with LinkedIn(
username=settings.get("LINKEDIN_USER"),
password=settings.get("LINKEDIN_PASSWORD"),
browser=settings.get("LINKEDIN_BROWSER"),
driver_path=settings.get("LINKEDIN_BROWSER_DRIVER"),
headless=bool(sett... | 2.484375 | 2 |
F20/SVM_3beat/HeatMap.py | rmorse7/TCH_Arrhythmias_F20 | 0 | 36852 | <filename>F20/SVM_3beat/HeatMap.py
import numpy as np
import matplotlib.pyplot as plt
time_max_normalized = 1.25
normalized_amplitude = 400
num_bins_x = 50
num_bins_y = 50
# ----------------------------------------------------
# Based off code from D2K MIC group from Spring 2020. Rewritten and optimized for beat dis... | 2.484375 | 2 |
models/image/greenFluorescenceQuantifier.py | marinarobin/uwaterloo-igem-2018 | 3 | 36853 | # <NAME>
# August 22, 2018
# A program designed for the UW iGEM Robots Subsubteam within the Math Subteam. It is meant to
# help quantify the amount of green fluorescence visible in an image. We have a very bright blue
# LED and a band pass filter that blocks blue light but lets through green light (and also red
# ligh... | 3.21875 | 3 |
src/domain/image.py | wlsouza/py-video-maker | 3 | 36854 | # !usr/bin/python
# -*- coding: UTF-8 -*-
class Image:
def __init__(self, name, path, url):
self.name = name
self.path = path
self.url = url
@property
def full_path(self):
return self.path + self.name
def __str__(self):
return self.name
def __repr__(self... | 2.921875 | 3 |
GreyMatter/open_firefox.py | nayangupta824/Melissa-Web | 20 | 36855 | <reponame>nayangupta824/Melissa-Web<filename>GreyMatter/open_firefox.py
from selenium import webdriver
from SenseCells.tts import tts
def open_firefox():
tts('Aye aye captain, opening Firefox')
webdriver.Firefox()
| 1.71875 | 2 |
gym_quoridor/__init__.py | Xe-Xo/GymQuoridor | 1 | 36856 | <reponame>Xe-Xo/GymQuoridor
from gym.envs.registration import register
register(
id='quoridor-v0',
entry_point='gym_quoridor.envs:QuoridorEnv',
) | 1.28125 | 1 |
Python3/OTUS/lesson04/lesson04-6.py | neon1ks/Study | 0 | 36857 | <filename>Python3/OTUS/lesson04/lesson04-6.py
from http.server import BaseHTTPRequestHandler, HTTPServer
class MyHandler(BaseHTTPRequestHandler):
def do_GET(self):
print('In GET request')
self.send_response(200)
self.send_header('Content-type', 'text-html')
self.end_headers()
... | 2.65625 | 3 |
pacote-download/ex111/utilidadescev/moeda/__init__.py | nkonai/Curso-em-video-Python | 0 | 36858 | <reponame>nkonai/Curso-em-video-Python
def metade(preco,sit):
if sit==True:
return (f'R${preco/2}')
else:
return preco/2
def dobro(preco,sit):
if sit==True:
return (f'R${preco * 2}')
else:
return preco * 2
def aumentar(preco,r,sit):
if sit==True:
return (f'R... | 3.328125 | 3 |
test/unit/tools/filter_modules/filtermod.py | ramezrawas/galaxy-1 | 6 | 36859 | """ Test filters used by test_toolbox_filters.py.
"""
def filter_tool( context, tool ):
"""Test Filter Tool"""
return False
def filter_section( context, section ):
"""Test Filter Section"""
return False
def filter_label_1( context, label ):
"""Test Filter Label 1"""
return False
def filt... | 1.625 | 2 |
countd.py | sushmitajaiswal/PythonPrograms | 0 | 36860 | word=input("enter any word:")
d={}
for x in word:
d[x]=d.get(x,0)+1
for k,v in d.items():
print(k,"occured",v,"times") | 3.8125 | 4 |
body/test/test_hello_utils.py | soumith/stretch_body | 0 | 36861 | <reponame>soumith/stretch_body
import unittest
import stretch_body.hello_utils
import time
import warnings
class TestHelloUtils(unittest.TestCase):
def test_yaml_file_released(self):
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
# read yaml, gene... | 2.734375 | 3 |
2019/016_cielab_color_space/check_boundary_characteristic.py | toru-ver4/sample_code | 19 | 36862 | <filename>2019/016_cielab_color_space/check_boundary_characteristic.py
# -*- coding: utf-8 -*-
"""
XYZ空間やL*a*b*空間の境界線の確認
======================================
XYZ空間やL*a*b*空間の境界線を確認する
"""
# import standard libraries
import os
import ctypes
# import third-party libraries
import numpy as np
import matplotlib.pyplot a... | 2 | 2 |
score.py | salisu14/python-tut | 5 | 36863 | #!/usr/bin/env python3
average = 0
score = int(input('Enter first score: '))
score += int(input('Enter second score: '))
score += int(input('Enter third score: '))
average = score / 3.0
average = round(average, 2)
print(f'Total Score: {score}')
print(f'Average Score: {average}')
| 4.15625 | 4 |
source/tweaks/__init__.py | mverleg/svsite | 0 | 36864 | <gh_stars>0
"""
Changes to the defaults of ``django``, ``djangocms``, etc.
""" | 1.0625 | 1 |
companies/forms.py | wsoliveira/borsocontrole | 0 | 36865 | from django.forms import ModelForm
from .models import bc_sector, bc_company, bc_company_code
from administrators.models import bc_admin_type_investiment
class SectorForm(ModelForm):
class Meta:
model = bc_sector
fields = ['name','description','is_active']
class CompanyForm(ModelForm):
class ... | 2.234375 | 2 |
docker-image/locust-tasks/fakerutil.py | eklicious/mlocust-app | 0 | 36866 | import pymongo
from bson.json_util import loads, dumps
from bson import json_util
import csv
import sys
import uuid
import os
import itertools
from faker import Faker
from collections import defaultdict
import json
import datetime
from deepmerge import Merger
import random
import re
###################################... | 2.0625 | 2 |
examples/utils.py | hadar-solver/hadar | 1 | 36867 | # Copyright (c) 2019-2020, RTE (https://www.rte-france.com)
# See AUTHORS.txt
# This Source Code Form is subject to the terms of the Apache License, version 2.0.
# If a copy of the Apache License, version 2.0 was not distributed with this file, you can obtain one at http://www.apache.org/licenses/LICENSE-2.0.
# SP... | 2.234375 | 2 |
lukkari/timerange.py | JuEeHa/lukkari | 0 | 36868 | import datetime
class Timerange:
def __init__(self, start, length):
self.start = start
self.length = length
def range(self):
end = self.start + self.length
return (self.start, end)
def __contains__(self, day):
delta = day - self.start
return datetime.timedelta(seconds = 0) <= delta and delta < self.le... | 3.53125 | 4 |
renlabs/sudoku/cli.py | swork/sudoku | 0 | 36869 | #! /usr/bin/env python3
import logging, sys, os
from . import main
logger = logging.getLogger(__name__ if not __name__ == '__main__' else os.path.basename(__file__))
if __name__ == '__main__':
logging.basicConfig()
sys.exit(main())
| 2.265625 | 2 |
Python 基础教程/1.5.1 列表.py | shao1chuan/pythonbook | 95 | 36870 | # 插入
print('插入'*15)
x = [1,2,3]
print(x)
x = x+ [4]
x.append(5)
print(x)
x.insert(3,'w')
x.extend(['a','b'])
print(x*3)
# 删除
print("删除"*15)
y = ["a","b","c","d",'e','f']
del y[2]
print(y)
y.pop(0)
print(y)
y.remove('f')
print(y)
# 列表元素访问与计数
print("列表元素访问与计数"*5)
x =[1,2,3,3,4,5]
print(x.count(3),x.index(2))
# 列表排序
pr... | 3.78125 | 4 |
custom_components/vektiva_smarwi/smarwi_control.py | wongcz/vektiva_smarwi_ha | 3 | 36871 | import aiohttp
class SmarwiControl:
"""Control class."""
def __init__(self, hosts):
"""Initialize."""
self.hosts = [x.strip() for x in hosts.split(',')]
self.title = ', '.join([x.split('.')[0] for x in self.hosts])
async def authenticate(self) -> bool:
"""Test if we can au... | 2.90625 | 3 |
add_ops.py | SoftDevX/MJDB | 0 | 36872 | from PyQt5 import QtWidgets, QtCore, QtPrintSupport
from PyQt5.QtCore import QDate, QTime, Qt, QTimer, QRectF
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtPrintSupport import QPrinter
from database import MyCursor
from PyQt5 import QtGui
from datetime import datetime, timedelta
from annulation i... | 2.171875 | 2 |
packages/tractography/tensor_gen.py | justi/m2g | 12 | 36873 | #!/usr/bin/env python
# Copyright 2015 Open Connectome Project (http://openconnecto.me)
#
# 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.390625 | 2 |
ml2/ltl/ltl_spec/ltl_spec_encoder.py | reactive-systems/ml2 | 2 | 36874 | """LTL specification encoder"""
import tensorflow as tf
from ...data.encoder import PAD_TOKEN
from ..ltl_encoder import LTLTreeEncoder
class LTLSpecTreeEncoder(LTLTreeEncoder):
def encode(self, spec):
return super().encode(spec.formula_str)
class LTLSpecGuaranteeEncoder(LTLTreeEncoder):
def __in... | 2.484375 | 2 |
pulse_lib/segments/data_classes/data_HVI_variables.py | NicoHendrickx/pulse_lib | 0 | 36875 | <filename>pulse_lib/segments/data_classes/data_HVI_variables.py
"""
data class for markers.
"""
from pulse_lib.segments.data_classes.data_generic import parent_data
import copy
class marker_HVI_variable(parent_data):
def __init__(self):
"""
init marker object
Args:
pulse_ampli... | 2.75 | 3 |
variant_coverage/collapse_bcs.py | cindyyeh/barseq | 1 | 36876 | '''
Written by <NAME>, updated 11/30/2021
This script groups barcodes by variants and counts how many reads are associated with each variant; works with maps where a barcode is being mapped to more than one gene (e.g., Ste5 and Ste7 on the same amplicon with the barcode)
First argument: path to tab-delimited barcode-va... | 3.203125 | 3 |
AutoBonsai/AutoBonsai.py | WolfgangAxel/Random-Projects | 1 | 36877 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# AutoBonsai.py
#
# Copyright 2016 keaton <<EMAIL>>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of ... | 2.765625 | 3 |
CameraApp.py | hemameh/License-Plate-Recognition | 0 | 36878 | from imutils.video import WebcamVideoStream
from FaceRecognition import *
from face_recognition import compare_faces
import cv2
SKIP_FRAME_RATIO = 2
images, greys, names = load_faces("knownfaces")
knownfaces = encodeDataset(images, greys)
ID = [1,2,3,4,5,6,7,8,9]
face_locations = []
face_names = []
proces... | 2.6875 | 3 |
tests/test_genericls.py | scsides/usgscsm | 0 | 36879 | import os
import json
import pytest
from cycsm import isd
import cycsm.csm as csm
import usgscam as cam
data_path = os.path.dirname(__file__)
class TestGenericLs:
@pytest.mark.parametrize('image, ground',[
((2500, 9216, 0), (-73589.5516508502, 562548.342040933, 2372508.44060771))
... | 2.328125 | 2 |
glacierbackup/tests/test_init.py | arkhebuz/GlacierBackup | 0 | 36880 | import pytest
import json
import os
import logging
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
from glacierbackup.command import _construct_argparse_parser
from glacierbackup.jobs import BackupJob
from glacierbackup.database import GBDatabase, GBDatabaseError... | 2.109375 | 2 |
exercicios-python/ex039.py | anavesilva/python-introduction | 0 | 36881 | <gh_stars>0
from datetime import date
ano = int(input('Ano de nascimento: '))
print('[ 1 ] Masculino [ 2 ] Feminino')
sexo = int(input('Qual o seu sexo: '))
hoje = date.today().year
idade = hoje - ano
if idade < 18 and sexo == 1:
print('Você tem hoje {} anos e deverá se alistar ao serviço militar em {} anos, no an... | 3.90625 | 4 |
ignition/utils/tests/test_enum.py | IgnitionProject/ignition | 7 | 36882 | <reponame>IgnitionProject/ignition<gh_stars>1-10
from ignition import Enum
def test_Enum ():
Colours = Enum('red', 'blue', 'green')
Weekdays = Enum('mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun')
pizza_night = Weekdays[4]
game_night = Weekdays['mon']
shirt_colour = Colours.green
assert(pizza... | 2.828125 | 3 |
map1.py | Dimitrios-Tsiaras/portofolio | 0 | 36883 | import pandas
import folium
data = pandas.read_csv("Volcanoes.txt")
lat = list(data['LAT'])
lon = list(data['LON'])
elev = list(data['ELEV'])
name = list(data["NAME"])
html = """
Volcano name:<br>
<a href="https://www.google.com/search?q=%%22%s%%22" target="_blank">%s</a><br>
Height: %s m
"""
def color_... | 3.1875 | 3 |
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/private_endpoint_connection_py3.py | limingu/azure-cli-extensions | 2 | 36884 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 1.632813 | 2 |
pdfmajor/interpreter/commands/state/PDFGraphicState/PDFColor.py | asosnovsky/pdfmajor | 23 | 36885 | <filename>pdfmajor/interpreter/commands/state/PDFGraphicState/PDFColor.py
from typing import Tuple, Optional
from .PDFColorSpace import PDFColorSpace
class PDFColor:
def __init__(self, color_space: Optional[PDFColorSpace], *values: float):
self.color_space: Optional[PDFColorSpace] = color_space
sel... | 2.765625 | 3 |
oauth2/serializers.py | tinyms/bopress | 0 | 36886 | <reponame>tinyms/bopress
from rest_framework import serializers
from oauth2.models import UserInfo, CompanyInfo, CompanyEmployee, AppCommerceLicense, AppGrantAuthorization
class OAuth2VerifySerializer(serializers.Serializer):
def create(self, validated_data):
return None
def update(self, instance, v... | 2.375 | 2 |
edm_web1/app/task/utils/contexts.py | zhouli121018/nodejsgm | 0 | 36887 | <filename>edm_web1/app/task/utils/contexts.py
# -*- coding: utf-8 -*-
#
import time
import random
from django.db import connections
from django.db.models import Q
from django.http import Http404
from django_redis import get_redis_connection
from app.core.models import Services, CustomerMailbox, CustomerDomain, Customer... | 1.734375 | 2 |
unit_tests/test_objects.py | carlos3dx/hash_code_practice | 1 | 36888 | from components.competition import Competition
from components.pizzeria import Pizzeria
class TestObjects:
def test_two_identical_pizzeria_objects(self):
p1 = Pizzeria({'p1': [1, 2, 3], 'p2': [4, 5, 6]}, 6)
p2 = Pizzeria({'p1': [1, 2, 3], 'p2': [4, 5, 6]}, 6)
assert p1 == p2
def test_... | 2.953125 | 3 |
restrictive_growth_strings.py | oversj96/PyKabe | 1 | 36889 | """restrictive_growth_strings.py: Constructs the lexicographic
restrictive growth string representation of all the way to partition a set,
given the length of the set."""
__author__ = "<NAME>"
__copyright__ = "oversj96.github.io"
def set_to_zero(working_set, index):
"""Given a set and an index, set all element... | 3.640625 | 4 |
examples/pvmldemo.py | claudio-unipv/pvml | 3 | 36890 | #!/usr/bin/env python3
import pvml
import numpy as np
import matplotlib.pyplot as plt
import argparse
from itertools import zip_longest
_NORMALIZATION = {
"none": lambda *X: (X[0] if len(X) == 1 else X),
"meanvar": pvml.meanvar_normalization,
"minmax": pvml.minmax_normalization,
"maxabs": pvml.maxabs... | 2.65625 | 3 |
sucestest.py | hugegene/Area-Under-Load | 0 | 36891 | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 11 13:46:58 2019
@author: bdgecyt
"""
import cv2
import math
from time import time
import numpy as np
import wrapper
from operator import itemgetter
boxes = []
xCount = 0
yCount = 0
iter = 0
img = 0
def on_mouse(event, x, y, flags, params):
global iter
t... | 2.34375 | 2 |
good_spot/places/migrations/0086_auto_20180813_1225.py | jasmine92122/NightClubBackend | 0 | 36892 | <reponame>jasmine92122/NightClubBackend
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2018-08-13 12:25
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('places', '0085_placetype_name_plural'),
]
o... | 1.632813 | 2 |
src/pspnet/run.py | jefequien/PSPNet-Keras | 4 | 36893 | import os
from os.path import join, isfile, isdir, dirname, basename
from os import environ, makedirs
import sys
import argparse
import numpy as np
import h5py
from scipy import misc
from keras import backend as K
import tensorflow as tf
from pspnet import PSPNet50
import utils
from utils import image_utils
from util... | 1.804688 | 2 |
tests/test_fake_dataframe_factory.py | damklis/fakedatafactory | 0 | 36894 | <reponame>damklis/fakedatafactory
import pytest
import pandas as pd
from pandas.testing import assert_frame_equal
from fakedatafactory.fakerow import fake_rows
from fakedatafactory.fakerow.fake_row_base import FakeRowBase
from fakedatafactory.fake_data_factory import (
FakeDataFactory, _FakeRowParser
)
@pytest.fi... | 2.578125 | 3 |
examples/1-1-3-segment_vs_box/plot.py | hyperpower/CarpioPlus | 0 | 36895 | <gh_stars>0
import matplotlib
import matplotlib.pyplot as plt
import os, sys
import numpy as np
import string
import math
import operator
import multiprocessing
from multiprocessing import Pool
matplotlib.rcParams['text.usetex'] = True
matplotlib.rcParams['font.family'] = 'serif'
matplotlib.rcParams['fo... | 2.09375 | 2 |
module_pytorch/OWN.py | xy1999729/OthogonalWN | 47 | 36896 | """
Orthogonal Weight Normalization: Solution to Optimization over Multiple Dependent Stiefel Manifolds in Deep Neural Networks
AAAI 2018
Authors: <NAME>
"""
import torch.nn
import torch.nn.functional as F
from torch.nn import Parameter
from torch.autograd import Variable
from typing import List
from torch.autograd.fu... | 2.453125 | 2 |
src/visions/lib/relations/string_to_datetime.py | sweersr/visions | 0 | 36897 | import pandas as pd
from visions import visions_string, visions_datetime
from visions.core.model import TypeRelation
from visions.core.model.relations import InferenceRelation
from visions.utils.coercion import test_utils
def to_datetime_year_week(series):
"""Convert a series of the format YYYY/UU (year, week) t... | 2.671875 | 3 |
thirdparty/ffmpeg/tools/python/convert.py | yashrajsingh1998/ApraPipes1 | 30 | 36898 | <gh_stars>10-100
# Copyright (c) 2019 <NAME>
#
# This file is part of FFmpeg.
#
# FFmpeg is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any late... | 1.890625 | 2 |
custom/icds/rules/util.py | kkrampa/commcare-hq | 1 | 36899 | <reponame>kkrampa/commcare-hq
from __future__ import absolute_import
from __future__ import unicode_literals
import pytz
import re
import six
from corehq.util.python_compatibility import soft_assert_type_text
from corehq.util.timezones.conversions import ServerTime
from datetime import datetime, date
def get_date(va... | 2.03125 | 2 |