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 |
|---|---|---|---|---|---|---|
trade_remedies_caseworker/cases/views.py | uktrade/trade-remedies-caseworker | 1 | 10100 | import itertools
import json
import logging
import re
from django.views.generic import TemplateView
from django.http import HttpResponse
from django.views import View
from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin
from django.views.decorators.csrf import csrf_exempt
from django.short... | 1.4375 | 1 |
mmdet/models/emod_ops/ar_module.py | zhenglab/EMOD | 2 | 10101 | <reponame>zhenglab/EMOD
import torch
from torch import nn
from mmcv.cnn.utils import constant_init, kaiming_init
class SimAttention(nn.Module):
def __init__(self, in_channels):
super(SimAttention, self).__init__()
self.conv_attn = nn.Conv2d(in_channels, 1, kernel_size=1)
self.softm... | 2.5625 | 3 |
prayer_times_v2.py | danish09/request_api | 0 | 10102 | import json
import requests
from datetime import datetime
from playsound import playsound
tday=datetime.today().strftime('%Y-%m-%d')
right_now=datetime.today().strftime('%I-%M-%p')
response = requests.get("https://www.londonprayertimes.com/api/times/?format=json&key=0239f686-4423-408e-9a0c-7968a403d197&year=&mont... | 3.171875 | 3 |
pokemon/pokemon_tests/test_serializers.py | pessman/pokemon_utils | 1 | 10103 | <reponame>pessman/pokemon_utils<gh_stars>1-10
import pytest
from django.test import TestCase
from rest_framework import serializers as drf_serializers
from pokemon import models, serializers
@pytest.mark.django_db
class StatsSerializer(TestCase):
"""
Test Module for StatsSerializer
"""
def setUp(se... | 2.40625 | 2 |
sqlpuzzle/_common/argsparser.py | Dundee/python-sqlpuzzle | 8 | 10104 | <reponame>Dundee/python-sqlpuzzle<filename>sqlpuzzle/_common/argsparser.py
from sqlpuzzle.exceptions import InvalidArgumentException
__all__ = ('parse_args',)
# pylint: disable=dangerous-default-value,keyword-arg-before-vararg
def parse_args(options={}, *args, **kwds):
"""
Parser of arguments.
dict opti... | 2.953125 | 3 |
reviewboard/webapi/tests/test_review_screenshot_comment.py | ParikhKadam/reviewboard | 921 | 10105 | <filename>reviewboard/webapi/tests/test_review_screenshot_comment.py<gh_stars>100-1000
from __future__ import unicode_literals
from django.contrib.auth.models import User
from djblets.webapi.errors import PERMISSION_DENIED
from reviewboard.reviews.models import ScreenshotComment
from reviewboard.webapi.resources impo... | 2.140625 | 2 |
qbapi/app.py | dimddev/qb | 0 | 10106 | <filename>qbapi/app.py
"""
Command line tool
"""
import asyncio
from qbapi.request import create_request
from qbapi.services.clients import Producer, Consumer
async def spider(user_data: tuple) -> None:
"""spider
:param user_data:
:type user_data: tuple
:rtype: None
"""
producer_queue = asy... | 2.796875 | 3 |
test/test_literal.py | hrnciar/rdflib | 0 | 10107 | import unittest
import datetime
import rdflib # needed for eval(repr(...)) below
from rdflib.term import Literal, URIRef, _XSD_DOUBLE, bind, _XSD_BOOLEAN
from rdflib.namespace import XSD
def uformat(s):
return s.replace("u'", "'")
class TestLiteral(unittest.TestCase):
def setUp(self):
pass
de... | 2.828125 | 3 |
src/messages/text/ruling.py | rkulyn/telegram-dutch-taxbot | 2 | 10108 | import telegram
from emoji import emojize
from .base import TextMessageBase
class RulingHelpTextMessage(TextMessageBase):
"""
Ruling help message.
Taken from:
https://www.iamexpat.nl/expat-info/taxation/30-percent-ruling/requirements
"""
def get_text(self):
message = emojize(
... | 2.90625 | 3 |
extras/20190910/code/dummy_11a/resnet18_unet_softmax_01/train.py | pyaf/severstal-steel-defect-detection | 0 | 10109 | import os
os.environ['CUDA_VISIBLE_DEVICES']='0'
from common import *
from dataset import *
from model import *
def valid_augment(image, mask, infor):
return image, mask, infor
def train_augment(image, mask, infor):
u=np.random.choice(3)
if u==0:
pass
elif u==1:
image, mask = do_... | 2.5 | 2 |
city_coord_download.py | Yuchen971/Chinese-city-level-geojson | 0 | 10110 | <gh_stars>0
import requests
import os
def get_json(save_dir, adcode):
# 获取当前地图轮廓
base_url = 'https://geo.datav.aliyun.com/areas/bound/' + str(adcode) + '.json'
full_url = 'https://geo.datav.aliyun.com/areas/bound/' + str(adcode) + '_full.json'
base_r = requests.get(base_url)
if base_r.status_code ==... | 2.84375 | 3 |
myproject/core/clusterAnalysis.py | xiaoxiansheng19/data_analysis | 0 | 10111 | <filename>myproject/core/clusterAnalysis.py
# from sklearn.cluster import DBSCAN,KMeans
#
#
# def run(data,radius=300):
# res={}
# # 默认参数 epsilon=0.001, min_samples=200
# epsilon = radius / 100000
# # epsilon = 0.003
# min_samples = 100
# db = DBSCAN(eps=epsilon, min_samples=min_samples)
# #... | 3.171875 | 3 |
verticapy/tests/vDataFrame/test_vDF_create.py | sitingren/VerticaPy | 0 | 10112 | # (c) Copyright [2018-2021] Micro Focus or one of its affiliates.
# 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 applicabl... | 2.046875 | 2 |
Solutions/beta/beta_is_it_an_isogram.py | citrok25/Codewars-1 | 46 | 10113 | import re
from collections import Counter
def is_isogram(word):
if not isinstance(word, str) or word == '': return False
word = {j for i,j in Counter(
re.sub('[^a-z]', '', word.lower())
).most_common()
... | 3.71875 | 4 |
p23_Merge_k_Sorted_Lists.py | bzhou26/leetcode_sol | 0 | 10114 | <reponame>bzhou26/leetcode_sol<filename>p23_Merge_k_Sorted_Lists.py
'''
- Leetcode problem: 23
- Difficulty: Hard
- Brief problem description:
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
Example:
Input:
[
1->4->5,
1->3->4,
2->6
]
Output: 1->1->2->3->4->4... | 3.734375 | 4 |
flocx_ui/content/flocx/views.py | whitel/flocx-ui | 0 | 10115 | from django.views import generic
class IndexView(generic.TemplateView):
template_name = 'project/flocx/index.html' | 1.25 | 1 |
wificontrol/utils/networkstranslate.py | patrislav1/pywificontrol | 1 | 10116 | # Written by <NAME> and <NAME> <<EMAIL>>
#
# Copyright (c) 2016, Emlid Limited
# All rights reserved.
#
# Redistribution and use in source and binary forms,
# with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyrig... | 1.296875 | 1 |
src/LaminariaCore.py | MrKelpy/IFXG | 0 | 10117 | <reponame>MrKelpy/IFXG
# -*- coding: utf-8 -*-
"""
This module is distributed as part of the Laminaria Core (Python Version).
Get the Source Code in GitHub:
https://github.com/MrKelpy/LaminariaCore
The LaminariaCore is Open Source and distributed under the
MIT License
"""
# Built-in Imports
import datetime
import ran... | 2.796875 | 3 |
examples/api/default_value.py | clamdad/atom | 222 | 10118 | <filename>examples/api/default_value.py
# --------------------------------------------------------------------------------------
# Copyright (c) 2013-2021, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
... | 4.03125 | 4 |
linux-distro/package/nuxleus/Source/Vendor/Microsoft/IronPython-2.0.1/Lib/Kamaelia/Codec/YUV4MPEG.py | mdavid/nuxleus | 1 | 10119 | #!/usr/bin/env python
#
# Copyright (C) 2007 British Broadcasting Corporation and Kamaelia Contributors(1)
# All Rights Reserved.
#
# You may only modify and redistribute this under the terms of any of the
# following licenses(2): Mozilla Public License, V1.1, GNU General
# Public License, V2.0, GNU Lesser General ... | 1.4375 | 1 |
project/cli/event.py | DanielGrams/gsevp | 1 | 10120 | import click
from flask.cli import AppGroup
from project import app, db
from project.dateutils import berlin_tz
from project.services.event import (
get_recurring_events,
update_event_dates_with_recurrence_rule,
)
event_cli = AppGroup("event")
@event_cli.command("update-recurring-dates")
def update_recurrin... | 2.328125 | 2 |
test/functional/examples/test_examples.py | ymn1k/testplan | 0 | 10121 | import os
import re
import sys
import subprocess
import pytest
from testplan.common.utils.path import change_directory
import platform
ON_WINDOWS = platform.system() == 'Windows'
KNOWN_EXCEPTIONS = [
"TclError: Can't find a usable init\.tcl in the following directories:", # Matplotlib module improperly installe... | 2.140625 | 2 |
peco/template/template.py | Tikubonn/peco | 0 | 10122 | <reponame>Tikubonn/peco
from io import StringIO
class Template:
"""
this has information that parsed source code.
you can get rendered text with .render() and .render_string()
"""
def __init__(self, sentencenode, scope):
self.sentencenode = sentencenode
self.scope = scope
d... | 2.921875 | 3 |
mtp_api/apps/credit/tests/test_views/test_credit_list/test_security_credit_list/test_credit_list_with_blank_string_filters.py | ministryofjustice/mtp-api | 5 | 10123 | <reponame>ministryofjustice/mtp-api<gh_stars>1-10
from core import getattr_path
from rest_framework import status
from credit.tests.test_views.test_credit_list.test_security_credit_list import SecurityCreditListTestCase
class CreditListWithBlankStringFiltersTestCase(SecurityCreditListTestCase):
def assertAllResp... | 2.265625 | 2 |
vipermonkey/core/filetype.py | lap1nou/ViperMonkey | 874 | 10124 | <reponame>lap1nou/ViperMonkey<filename>vipermonkey/core/filetype.py
"""
Check for Office file types
ViperMonkey is a specialized engine to parse, analyze and interpret Microsoft
VBA macros (Visual Basic for Applications), mainly for malware analysis.
Author: <NAME> - http://www.decalage.info
License: BSD, see source ... | 1.671875 | 2 |
packs/kubernetes/tests/test_third_party_resource.py | userlocalhost2000/st2contrib | 164 | 10125 | <gh_stars>100-1000
from st2tests.base import BaseSensorTestCase
from third_party_resource import ThirdPartyResource
class ThirdPartyResourceTestCase(BaseSensorTestCase):
sensor_cls = ThirdPartyResource
def test_k8s_object_to_st2_trigger_bad_object(self):
k8s_obj = {
'type': 'kanye',
... | 2.15625 | 2 |
PrometheusScrapper/scrapper.py | masterchef/webscraper | 0 | 10126 | import datetime
import getpass
import logging
import os
import pathlib
import platform
import re
import smtplib
import sys
from contextlib import contextmanager
from email.message import EmailMessage
from functools import wraps
import azure.functions as func
import click
import gspread
import pandas as pd
from apsched... | 1.945313 | 2 |
MrWorldwide.py | AnonymousHacker1279/MrWorldwide | 0 | 10127 | <filename>MrWorldwide.py
from PyQt6.QtWidgets import QApplication, QWidget, QFileDialog
import PyQt6.QtCore as QtCore
import PyQt6.QtGui as QtGui
import sys, time, json, requests, traceback, configparser, os
import MrWorldwideUI, ConfigurationUI, UpdateManagerUI
version = "v1.0.0"
class LangTypes:
ENGLISH = "English... | 2.359375 | 2 |
tools/az_cli.py | google/cloud-forensics-utls | 0 | 10128 | # -*- coding: utf-8 -*-
# Copyright 2020 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | 2.0625 | 2 |
bbio/bbio.py | timgates42/PyBBIO | 102 | 10129 | <filename>bbio/bbio.py
"""
PyBBIO - bbio.py
Copyright (c) 2012-2015 - <NAME> <<EMAIL>>
Released under the MIT license
https://github.com/graycatlabs/PyBBIO
"""
import sys, atexit
from .platform import platform_init, platform_cleanup
from .common import ADDITIONAL_CLEANUP, util_init
def bbio_init():
""" Pre-run... | 2.6875 | 3 |
app/models/endeavors.py | theLaborInVain/kdm-manager-api | 2 | 10130 | <gh_stars>1-10
"""
The Endeavors asset collection has a number of irregular assets. Be careful
writing any custom code here.
"""
from app.assets import endeavors
from app import models
class Assets(models.AssetCollection):
def __init__(self, *args, **kwargs):
self.root_module = endeavors
... | 1.789063 | 2 |
interface/inter5.py | CeciliaDornelas/Python | 0 | 10131 | <reponame>CeciliaDornelas/Python<gh_stars>0
import sys
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtWidgets import QMainWindow, QLabel, QGridLayout, QWidget
from PyQt5.QtCore import QSize
class HelloWindow(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.setMinimumSize(QSize(2... | 3.421875 | 3 |
setup.py | notwa/scipybiteopt | 0 | 10132 | <filename>setup.py
#!/usr/bin/env python
import os
import sys
import numpy
from setuptools import setup, Extension
#include markdown description in pip page
this_directory = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.... | 1.640625 | 2 |
qiskit_experiments/data_processing/__init__.py | yoshida-ryuhei/qiskit-experiments | 0 | 10133 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... | 3.046875 | 3 |
models/pointnet2_sem_seg_msg_haptic.py | yufeiwang63/Pointnet_Pointnet2_pytorch | 0 | 10134 | import torch.nn as nn
import torch.nn.functional as F
from haptic.Pointnet_Pointnet2_pytorch.models.pointnet2_utils import PointNetSetAbstractionMsg,PointNetFeaturePropagation
class get_shared_model(nn.Module):
def __init__(self, use_batch_norm, num_classes, num_input_channel=7):
super(get_shared_model, s... | 2.046875 | 2 |
backend/src/notifications/admin.py | YujithIsura/request-management | 3 | 10135 | <reponame>YujithIsura/request-management
from django.contrib import admin
from .models import Notification
admin.site.register(Notification) | 1.164063 | 1 |
HoverSlam.py | GiantWaffleCode/WafflePython | 13 | 10136 | import krpc
import time
import math
from simple_pid import PID
conn = krpc.connect(name="UI Test")
vessel = conn.space_center.active_vessel
kerbin_frame = vessel.orbit.body.reference_frame
orb_frame = vessel.orbital_reference_frame
srf_frame = vessel.surface_reference_frame
surface_gravity = vessel.orbit.body.surface_... | 2.34375 | 2 |
tests/unit_tests/cx_core/integration/integration_test.py | clach04/controllerx | 204 | 10137 | <gh_stars>100-1000
from cx_core import integration as integration_module
from cx_core.controller import Controller
def test_get_integrations(fake_controller: Controller):
integrations = integration_module.get_integrations(fake_controller, {})
inteagration_names = {i.name for i in integrations}
assert inte... | 2.0625 | 2 |
asystem-adoc/src/main/template/python/script_util.py | ggear/asystem_archive | 0 | 10138 | <reponame>ggear/asystem_archive
###############################################################################
#
# Python script utilities as included from the cloudera-framework-assembly,
# do not edit directly
#
###############################################################################
import os
import re
de... | 1.6875 | 2 |
datapackage_pipelines/web/server.py | gperonato/datapackage-pipelines | 109 | 10139 | import datetime
import os
from io import BytesIO
import logging
from functools import wraps
from copy import deepcopy
from collections import Counter
import slugify
import yaml
import mistune
import requests
from flask import \
Blueprint, Flask, render_template, abort, send_file, make_response
from flask_cors imp... | 2.15625 | 2 |
MoveSim/code/models/losses.py | tobinsouth/privacy-preserving-synthetic-mobility-data | 0 | 10140 | <gh_stars>0
# coding: utf-8
import numpy as np
import torch.nn as nn
class distance_loss(nn.Module):
def __init__(self):
with open('../data/raw/Cellular_Baselocation_baidu') as f:
gpss = f.readlines()
self.X = []
self.Y = []
for gps in gpss:
x, y = float(gp... | 2.265625 | 2 |
board/game.py | petthauk/chess_ml | 0 | 10141 | import pygame as pg
from pygame.locals import *
import sys
import board.chess_board as board
w = 60 * 8
h = 60 * 8
class Game:
"""
Class to setup and start a game
"""
def __init__(self):
self.b = board.Board(w, h)
def get_board(self):
"""
Returns board
:return: B... | 3.546875 | 4 |
pix2pix/Dataset_util.py | Atharva-Phatak/Season-Tranfer | 2 | 10142 | #importing libraries
import torch
import torch.utils.data as data
import os
import random
from PIL import Image
class CreateDataset(data.Dataset):
def __init__(self , imagedir , subfolder='train' , direction = 'AtoB' , flip = False , transform = None ,resize_scale = None , crop_size = None):
... | 2.546875 | 3 |
crslab/system/C2CRS_System.py | Zyh716/WSDM2022-C2CRS | 4 | 10143 | <filename>crslab/system/C2CRS_System.py
# @Time : 2022/1/1
# @Author : <NAME>
# @email : <EMAIL>
import os
from math import floor
import torch
from loguru import logger
from typing import List, Dict
from copy import copy, deepcopy
import pickle
import os
import numpy
import ipdb
from crslab.config import... | 2.15625 | 2 |
morepath/__init__.py | hugovk/morepath | 314 | 10144 | # flake8: noqa
"""This is the main public API of Morepath.
Additional public APIs can be imported from the :mod:`morepath.error`
and :mod:`morepath.pdbsupport` modules. For custom directive
implementations that interact with core directives for grouping or
subclassing purposes, or that need to use one of the Morepath
... | 1.1875 | 1 |
src/AuShadha/demographics/email_and_fax/dijit_fields_constants.py | GosthMan/AuShadha | 46 | 10145 | EMAIL_AND_FAX_FORM_CONSTANTS = {
} | 1.117188 | 1 |
marketDataRetrieval.py | amertx/Monte-Carlo-Simulation | 0 | 10146 | #Prediction model using an instance of the Monte Carlo simulation and Brownian Motion equation
#import of libraries
import numpy as np
import pandas as pd
from pandas_datareader import data as wb
import matplotlib.pyplot as plt
from scipy.stats import norm
#ticker selection
def mainFunction(tradingSymbol):
data ... | 3.375 | 3 |
HelloDeepSpeed/train_bert_ds.py | mrwyattii/DeepSpeedExamples | 0 | 10147 | <gh_stars>0
"""
Modified version of train_bert.py that adds DeepSpeed
"""
import os
import datetime
import json
import pathlib
import re
import string
from functools import partial
from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, TypeVar, Union
import random
import datasets
import fire
import ... | 2.15625 | 2 |
programming/leetcode/linkedLists/PalindromeLinkedList/PalindromeLinkedList.py | vamsitallapudi/Coderefer-Python-Projects | 1 | 10148 | <gh_stars>1-10
# Given a singly linked list, determine if it is a palindrome.
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def isPalindrome(self, head: ListNode) -> bool:
fast = slow = head
#... | 3.8125 | 4 |
__init__.py | CloudCIX/rolly | 6 | 10149 | <reponame>CloudCIX/rolly
"""
Rocky is a CLI based provisioning and management tool for CloudCIX Cloud software.
Rocky is designed to operate in an out of band (OOB) network, serarated from other CloudCIX networks.
Rocky's purpose is to facilitate monitoring, testing, debug and recovery
"""
__version__ = '0.3.5'
| 0.796875 | 1 |
calculator.py | harshitbansal373/Python-Games | 0 | 10150 | <reponame>harshitbansal373/Python-Games
from tkinter import *
import time
root=Tk()
root.title('Calculator')
root.config(bg='wheat')
def display(x):
global s
s=s+x
text.set(s)
def solve():
global s
try:
s=str(eval(text.get()))
except Exception as e:
text.set(e)
s=''
else:
text.set(s)
de... | 3.671875 | 4 |
src/Main.py | OlavH96/Master | 0 | 10151 | <gh_stars>0
import glob
import os
import keras
import tensorflow as tf
from keras.models import load_model
from keras.callbacks import ModelCheckpoint
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import src.util.Files as Files
from src.util.ImageLoader import load_images_generator, resize... | 2.046875 | 2 |
daproli/manipulation.py | ermshaua/daproli | 0 | 10152 | from .utils import _get_return_type
def windowed(data, size, step=1, ret_type=None):
'''
dp.windowed applies a window function to a collection of data items.
Parameters
-----------
:param data: an iterable collection of data
:param size: the window size
:param step: the window step
:p... | 3.625 | 4 |
ambari-server/src/test/python/stacks/2.3/ATLAS/test_metadata_server.py | gcxtx/ambari | 1 | 10153 | #!/usr/bin/env python
'''
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License")... | 1.726563 | 2 |
Udacity P3 Additional Files/model.py | sayeayed/Udacity-Project4 | 0 | 10154 | import os
import csv
import numpy as np
from sklearn.utils import shuffle
## Read in frame data
samples = []
with open('/../opt/carnd_p3/data/driving_log.csv') as csvfile: #open the log file
reader = csv.reader(csvfile) #as a readable csv
for line in reader:
samples.append(line) #add each line of th... | 3.03125 | 3 |
utils/wavelengthfit_prim.py | GeminiDRSoftware/GHOSTDR | 1 | 10155 | #!/usr/bin/env python3
""" A script containing the basic principles of the extraction primitive inner
workings"""
from __future__ import division, print_function
from ghostdr import polyfit
import numpy as pn
# Firstly, let's find all the needed files
fitsdir='/Users/mireland/data/ghost/cal_frames/'
#Define the f... | 2.453125 | 2 |
time_management/test/kronos_test.py | AyushRawal/time-management | 1 | 10156 | import unittest
import datetime
import kronos
string_format_time = "%Y-%m-%d %H:%M:%S"
date_time_str = "2020-07-19 18:14:21"
class KronosTest(unittest.TestCase):
def test_get_day_of_week(self):
for i in range(len(kronos.week_days)):
date = kronos.get_date_time_from_string(f"2020-08-{10 + i} 1... | 3.390625 | 3 |
mfc/mfc.py | FuelCellUAV/FC_datalogger | 0 | 10157 | ##!/usr/bin/env python3
# Mass Flow Controller Arduino driver
# Copyright (C) 2015 <NAME>, <NAME>
#
# 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 3 of the Licens... | 2.171875 | 2 |
odm/dialects/postgresql/green.py | quantmind/pulsar-odm | 16 | 10158 | from asyncio import Future
from greenlet import getcurrent
import psycopg2
from psycopg2 import * # noqa
from psycopg2 import extensions, OperationalError
__version__ = psycopg2.__version__
def psycopg2_wait_callback(conn):
"""A wait callback to allow greenlet to work with Psycopg.
The caller must be from... | 2.71875 | 3 |
test/test_replica_set_connection.py | h4ck3rm1k3/mongo-python-driver | 1 | 10159 | # Copyright 2011-2012 10gen, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 1.960938 | 2 |
jqi/cmd.py | jan-g/jqi | 3 | 10160 | import argparse_helper as argparse
import config_dir
import sys
from .editor import Editor
def main(*args):
if len(args) > 0:
args = [args]
parser = argparse.ArgumentParser()
parser.add_argument("-f", dest="cfg_file", help="query save name")
parser.add_argument("-x", default=False, action="st... | 2.609375 | 3 |
setup.py | ASKBOT/python-import-utils | 1 | 10161 | <reponame>ASKBOT/python-import-utils
import ez_setup
ez_setup.use_setuptools()
from setuptools import setup, find_packages
import import_utils
setup(
name = "import-utils",
version = import_utils.__version__,
description = 'A module that supports simple programmatic module imports',
packages = find_pa... | 1.429688 | 1 |
visual_dynamics/policies/random_offset_camera_target_policy.py | alexlee-gk/visual_dynamics | 30 | 10162 | import numpy as np
from visual_dynamics.policies import CameraTargetPolicy
class RandomOffsetCameraTargetPolicy(CameraTargetPolicy):
def __init__(self, env, target_env, camera_node_name, agent_node_name, target_node_name,
height=12.0, radius=16.0, angle=(-np.pi/4, np.pi/4), tightness=0.1, hra_in... | 2.328125 | 2 |
Day3/Day3.py | ErAgOn-AmAnSiRoHi/Advent-of-Code-2021 | 0 | 10163 | with open("inputday3.txt") as f:
data = [x for x in f.read().split()]
gamma = ""
epsilon = ""
for b in range(0, len(data[0])):
one = 0
zero = 0
for c in range(0, len(data)):
if data[c][b] == '0':
zero += 1
else:
one += 1
if zero > one:
... | 3.28125 | 3 |
keras2pytorch_dataset.py | MPCAICDM/MPCA | 0 | 10164 | <gh_stars>0
from __future__ import print_function
from PIL import Image
import os
import os.path
import numpy as np
import sys
from misc import AverageMeter
from eval_accuracy import simple_accuracy
if sys.version_info[0] == 2:
import cPickle as pickle
else:
import pickle
import torch.utils.data as data
import... | 2.328125 | 2 |
mir/tools/mir_repo_utils.py | fenrir-z/ymir-cmd | 1 | 10165 | import json
import logging
import os
from typing import Optional
from mir import scm
from mir.tools import mir_storage
def mir_check_repo_dvc_dirty(mir_root: str = ".") -> bool:
names = [name for name in mir_storage.get_all_mir_paths() if os.path.isfile(os.path.join(mir_root, name))]
if names:
dvc_cm... | 2.21875 | 2 |
utils/edit_utils.py | ermekaitygulov/STIT | 6 | 10166 | <reponame>ermekaitygulov/STIT
import argparse
import math
import os
import pickle
from typing import List
import cv2
import numpy as np
import torch
from PIL import Image, ImageDraw, ImageFont
import configs.paths_config
from configs import paths_config
from training.networks import SynthesisBlock
def add_texts_to_... | 2.46875 | 2 |
conll_df/conll_df.py | interrogator/conll-df | 27 | 10167 | <filename>conll_df/conll_df.py
import pandas as pd
# UD 1.0
CONLL_COLUMNS = ['i', 'w', 'l', 'p', 'n', 'm', 'g', 'f', 'd', 'c']
# UD 2.0
CONLL_COLUMNS_V2 = ['i', 'w', 'l', 'x', 'p', 'm', 'g', 'f', 'e', 'o']
# possible morphological attributes
MORPH_ATTS = ['type',
'animacy',
#'gender',
... | 2.953125 | 3 |
scripts/postgres_to_lmdb_bars_60m.py | alexanu/atpy | 24 | 10168 | <filename>scripts/postgres_to_lmdb_bars_60m.py
#!/bin/python3
import argparse
import datetime
import functools
import logging
import os
import psycopg2
from dateutil.relativedelta import relativedelta
from atpy.data.cache.lmdb_cache import *
from atpy.data.cache.postgres_cache import BarsInPeriodProvider
from atpy.d... | 2.171875 | 2 |
src/download_pdf.py | luccanunes/class-url-automation | 1 | 10169 | <reponame>luccanunes/class-url-automation<filename>src/download_pdf.py
def download_pdf(URL):
from selenium import webdriver
from time import sleep
URL = URL
options = webdriver.ChromeOptions()
options.add_experimental_option('prefs', {
# Change default directory for downloads
"down... | 3.203125 | 3 |
datadog_checks_dev/datadog_checks/dev/tooling/commands/env/__init__.py | vbarbaresi/integrations-core | 1 | 10170 | <reponame>vbarbaresi/integrations-core
# (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import click
from ..console import CONTEXT_SETTINGS
from .check import check_run
from .ls import ls
from .prune import prune
from .reload import reload_env
from .she... | 1.453125 | 1 |
sdk/python/pulumi_azure_nextgen/marketplace/private_store_offer.py | pulumi/pulumi-azure-nextgen | 31 | 10171 | <filename>sdk/python/pulumi_azure_nextgen/marketplace/private_store_offer.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any... | 1.726563 | 2 |
examples/custom_shape/stages.py | oksumoron/locust | 18,336 | 10172 | <reponame>oksumoron/locust<filename>examples/custom_shape/stages.py
from locust import HttpUser, TaskSet, task, constant
from locust import LoadTestShape
class UserTasks(TaskSet):
@task
def get_root(self):
self.client.get("/")
class WebsiteUser(HttpUser):
wait_time = constant(0.5)
tasks = [U... | 2.671875 | 3 |
db/seed_ids.py | xtuyaowu/jtyd_python_spider | 7 | 10173 | # coding:utf-8
from sqlalchemy import text
from db.basic_db import db_session
from db.models import SeedIds
from decorators.decorator import db_commit_decorator
def get_seed():
"""
Get all user id to be crawled
:return: user ids
"""
return db_session.query(SeedIds).filter(text('status=0')).all()
d... | 2.515625 | 3 |
tobler/area_weighted/area_interpolate.py | sjsrey/tobler | 1 | 10174 | """
Area Weighted Interpolation
"""
import numpy as np
import geopandas as gpd
from ._vectorized_raster_interpolation import _fast_append_profile_in_gdf
import warnings
from scipy.sparse import dok_matrix, diags, coo_matrix
import pandas as pd
from tobler.util.util import _check_crs, _nan_check, _inf_check, _check_p... | 2.453125 | 2 |
cave/com.raytheon.viz.gfe/python/autotest/VTEC_GHG_FFA_TestScript.py | srcarter3/awips2 | 0 | 10175 | ##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to ... | 0.8125 | 1 |
main.py | hasanzadeh99/mapna_test_2021 | 0 | 10176 | import time
old_input_value = False
flag_falling_edge = None
start = None
flag_output_mask = False
DELAY_CONST = 10 # delay time from falling edge ... .
output = None
def response_function():
global old_input_value, flag_falling_edge, start, flag_output_mask, output
if flag_falling... | 3.40625 | 3 |
ansiblemetrics/playbook/num_deprecated_modules.py | radon-h2020/AnsibleMetrics | 1 | 10177 | <filename>ansiblemetrics/playbook/num_deprecated_modules.py
from ansiblemetrics.ansible_modules import DEPRECATED_MODULES_LIST
from ansiblemetrics.ansible_metric import AnsibleMetric
class NumDeprecatedModules(AnsibleMetric):
""" This class measures the number of times tasks use deprecated modules."""
def co... | 2.546875 | 3 |
app/api/v1/validators/validators.py | GraceKiarie/iReporter | 1 | 10178 | """ This module does validation for data input in incidents """
import re
class Validate():
"""
methods for validatin incidents input data
"""
def valid_email(self, email):
self.vemail = re.match(
r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)", email)
if not self.vem... | 3.578125 | 4 |
bin/find_latest_versions.py | ebreton/ghost-in-a-shell | 2 | 10179 | <reponame>ebreton/ghost-in-a-shell
#!/usr/bin/python
from distutils.version import LooseVersion
import argparse
import logging
import requests
import re
session = requests.Session()
# authorization token
TOKEN_URL = "https://auth.docker.io/token?service=registry.docker.io&scope=repository:%s:pull"
# find all tags
T... | 2.375 | 2 |
tests/conftest.py | badarsebard/terraform-pytest | 0 | 10180 | from .terraform import TerraformManager
import pytest
from _pytest.tmpdir import TempPathFactory
@pytest.fixture(scope='session')
def tfenv(tmp_path_factory: TempPathFactory):
env_vars = {
}
with TerraformManager(path_factory=tmp_path_factory, env_vars=env_vars) as deployment:
yield deplo... | 1.71875 | 2 |
pelicanconf.py | myrle-krantz/treasurer-site | 1 | 10181 | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
# vim: encoding=utf-8
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to yo... | 1.53125 | 2 |
TurtleArt/taturtle.py | sugar-activities/4585-activity | 0 | 10182 | # -*- coding: utf-8 -*-
#Copyright (c) 2010,12 <NAME>
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, ... | 2.203125 | 2 |
django_backend/group.py | holg/django_backend | 0 | 10183 | try:
from django.forms.utils import pretty_name
except ImportError:
from django.forms.forms import pretty_name
from django.template import Context
from django.template.loader import render_to_string
from .compat import context_flatten
class Group(list):
"""
A simplistic representation of backends tha... | 2.078125 | 2 |
src/eodc_openeo_bindings/map_comparison_processes.py | eodcgmbh/eodc-openeo-bindings | 0 | 10184 | <filename>src/eodc_openeo_bindings/map_comparison_processes.py
"""
"""
from eodc_openeo_bindings.map_utils import map_default
def map_lt(process):
"""
"""
param_dict = {'y': 'float'}
return map_default(process, 'lt', 'apply', param_dict)
def map_lte(process):
"""
"""
param_dict = ... | 2.578125 | 3 |
scripts/flow_tests/__init__.py | rombie/contrail-test | 5 | 10185 | <reponame>rombie/contrail-test<gh_stars>1-10
"""FLOW RELATED SYSTEM TEST CASES."""
| 0.867188 | 1 |
server/main.py | KejiaQiang/Spicy_pot_search | 1 | 10186 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from flask import Flask, request, abort, render_template
from datetime import timedelta
import pymysql
from search import start_search, decorate
page_dir = "E:/WEBPAGES_RAW"
app = Flask(__name__)
app.config['DEBUG'] = True
app.config['SEND_FILE_MAX_AGE_DEFAULT'] ... | 2.34375 | 2 |
examples/3d/subduction/viz/plot_dispwarp.py | cehanagan/pylith | 93 | 10187 | <filename>examples/3d/subduction/viz/plot_dispwarp.py
#!/usr/bin/env pvpython
# -*- Python -*- (syntax highlighting)
# ----------------------------------------------------------------------
#
# <NAME>, U.S. Geological Survey
# <NAME>, GNS Science
# <NAME>, University at Buffalo
#
# This code was developed as part of th... | 2.265625 | 2 |
src/spaceone/inventory/manager/rds_manager.py | jean1042/plugin-aws-cloud-services | 4 | 10188 | from spaceone.inventory.libs.manager import AWSManager
# todo: __init__에서 한번에 명세 할수 있게 바꾸기
# 지금은 로케이터에서 글로벌에서 값을 가져오는 로직 때문에 별도 파일이 없으면 에러 발생
class RDSConnectorManager(AWSManager):
connector_name = 'RDSConnector'
| 1.484375 | 1 |
script/upload-checksums.py | fireball-x/atom-shell | 4 | 10189 | <filename>script/upload-checksums.py<gh_stars>1-10
#!/usr/bin/env python
import argparse
import hashlib
import os
import tempfile
from lib.config import s3_config
from lib.util import download, rm_rf, s3put
DIST_URL = 'https://atom.io/download/atom-shell/'
def main():
args = parse_args()
url = DIST_URL + arg... | 2.625 | 3 |
pythoncode/kmeansimage.py | loganpadon/PokemonOneShot | 0 | 10190 | <gh_stars>0
# import the necessary packages
from sklearn.cluster import KMeans
import skimage
import matplotlib.pyplot as plt
import argparse
import cv2
def mean_image(image,clt):
image2=image
for x in range(len(image2)):
classes=clt.predict(image2[x])
for y in range(len(classes)):
image2[x,y]=clt... | 2.96875 | 3 |
tests/encode.py | EddieBreeg/C_b64 | 0 | 10191 | <gh_stars>0
from sys import argv
from base64 import b64encode
with open("data", 'rb') as fIn:
b = fIn.read()
print(b64encode(b).decode()) | 2.3125 | 2 |
src/json_sort/lib.py | cdumay/json-sort | 3 | 10192 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
.. codeauthor:: <NAME> <<EMAIL>>
"""
import logging
import sys, os, json
from cdumay_rest_client.client import RESTClient
from cdumay_rest_client.exceptions import NotFound, HTTPException
class NoSuchFile(NotFound):
"""NoSuchFile"""
def oncritical(exc):
"... | 2.40625 | 2 |
test/test_create_dataset.py | gregstarr/ttools | 0 | 10193 | import numpy as np
import pytest
import apexpy
import tempfile
import os
import h5py
from ttools import create_dataset, config, io, utils
map_periods = [np.timedelta64(10, 'm'), np.timedelta64(30, 'm'), np.timedelta64(1, 'h'), np.timedelta64(2, 'h')]
@pytest.fixture
def times():
yield np.datetime64('2010-01-01T... | 1.867188 | 2 |
docs_src/options/callback/tutorial001.py | madkinsz/typer | 7,615 | 10194 | import typer
def name_callback(value: str):
if value != "Camila":
raise typer.BadParameter("Only Camila is allowed")
return value
def main(name: str = typer.Option(..., callback=name_callback)):
typer.echo(f"Hello {name}")
if __name__ == "__main__":
typer.run(main)
| 2.8125 | 3 |
qft-client-py2.py | bocajspear1/qft | 0 | 10195 | <reponame>bocajspear1/qft<gh_stars>0
import socket
import threading
from time import sleep
from threading import Thread
import json
import sys
def display_test(address, port,text_result, test):
if (text_result == "QFT_SUCCESS" and test == True) or (text_result != "QFT_SUCCESS" and test == False):
... | 2.75 | 3 |
mdemanipulation/src/mdeoperation.py | modelia/ai-for-model-manipulation | 0 | 10196 | <gh_stars>0
#!/usr/bin/env python2
import math
import os
import random
import sys
import time
import logging
import argparse
import numpy as np
from six.moves import xrange
import json
import torch
import torch.nn as nn
import torch.optim as optim
from torch import cuda
from torch.autograd import Variable
from torch... | 2.015625 | 2 |
barbican/common/resources.py | stanzikratel/barbican-2 | 0 | 10197 | <gh_stars>0
# Copyright (c) 2013-2014 Rackspace, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 1.945313 | 2 |
7/prime.py | redfast00/euler | 0 | 10198 | from math import sqrt
def stream_primes(num):
primes = []
candidate = 2
for i in range(num):
prime = next_prime(primes, candidate)
primes.append(prime)
candidate = prime + 1
yield prime
def next_prime(primes, candidate):
while True:
for prime in primes:
... | 3.703125 | 4 |
app/utils.py | HealYouDown/flo-league | 0 | 10199 | <gh_stars>0
import datetime
from app.models import Log
from flask_login import current_user
from app.extensions import db
# https://stackoverflow.com/questions/6558535/find-the-date-for-the-first-monday-after-a-given-date
def next_weekday(
d: datetime.datetime = datetime.datetime.utcnow(),
weekday: int = 0,
)... | 2.4375 | 2 |