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 |
|---|---|---|---|---|---|---|
data_processing/process_xls.py | luisroel91/libdib_assesment | 0 | 8300 | import pandas as pd
# Define our header
col_names = [
"year",
"num_males_with_income",
"male_median_income_curr_dollars",
"male_median_income_2019_dollars",
"num_females_with_income",
"female_median_income_curr_dollars",
"female_median_income_2019_dollars",
]
# Load Asian census data XLS, ... | 3.234375 | 3 |
Section_1/Exercise_16.py | Szymon-Budziak/WDI_exercises_solutions | 0 | 8301 | """
Dany jest ciąg określony wzorem: A[n+1] = (A[n] % 2) ∗ (3 ∗ A[n] + 1) + (1 − A[n] % 2) ∗ A[n] / 2.
Startując z dowolnej liczby naturalnej > 1 ciąg ten osiąga wartość 1. Napisać program, który
znajdzie wyraz początkowy z przedziału 2-10000 dla którego wartość 1 jest osiągalna po największej
liczbie kroków.
"""
a0 = ... | 3.03125 | 3 |
SysPy_ver/funcs/_var_declaration.py | evlog/SysPy | 4 | 8302 | <filename>SysPy_ver/funcs/_var_declaration.py
"""
*****************************************************************************
*
H E A D E R I N F O R M A T I O N *
... | 1.5625 | 2 |
Giraffe/Functions.py | MaggieIllustrations/softuni-github-programming | 0 | 8303 | def say_hi(name,age):
print("Hello " + name + ", you are " + age)
say_hi("Mike", "35")
def cube(num): # function
return num*num*num
result = cube(4) # variable
print(result)
| 3.515625 | 4 |
airspace_surgery.py | wipfli/airspaces | 1 | 8304 | <gh_stars>1-10
import glob
import json
path_in = './airspaces/'
path_out = './airspaces_processed/'
filenames = [path.split('/')[-1] for path in glob.glob(path_in + '*')]
remove = {
'france_fr.geojson': [
314327,
314187,
314360,
314359,
314362,
314361,
3143... | 2.140625 | 2 |
AndroidSpider/spider_main.py | lidenghong1/SmallReptileTraining | 1 | 8305 | from AndroidSpider import url_manager, html_downloader, html_parser, html_output
'''
爬取百度百科 Android 关键词相关词及简介并输出为一个HTML tab网页
Extra module:
BeautifulSoup
'''
class SpiderMain(object):
def __init__(self):
self.urls = url_manager.UrlManager()
self.downloader = html_downloader.HtmlDownLoader()
... | 2.96875 | 3 |
trompace/mutations/__init__.py | trompamusic/ce-queries-template | 1 | 8306 | MUTATION = '''mutation {{
{mutation}
}}'''
def _verify_additional_type(additionaltype):
"""Check that the input to additionaltype is a list of strings.
If it is empty, raise ValueError
If it is a string, convert it to a list of strings."""
if additionaltype is None:
return None
if isins... | 2.8125 | 3 |
Web_App/infrastructure/infra.py | CapitalOneDevExchangeHackathon/Financial-Fitness | 0 | 8307 | import boto
import boto3
from config import Config
dynamodb = boto3.resource('dynamodb',
aws_access_key_id=Config.AWS_KEY,
aws_secret_access_key=Config.AWS_SECRET_KEY,
region_name=Config.REGION)
table = dynamodb.Table('user_details')
tables... | 2.5625 | 3 |
numberTheory/natural.py | ndarwin314/symbolicPy | 0 | 8308 | <reponame>ndarwin314/symbolicPy<filename>numberTheory/natural.py
# TODO: implement algorithms in c++ or something to make them fast
| 1.476563 | 1 |
SelfTests.py | TeaPackCZ/RobotZed | 0 | 8309 | <filename>SelfTests.py
import os
import unittest
from Logger import Logger
class TestLogger(unittest.TestCase):
def test_file_handling(self):
testLog = Logger("testLog")
## Check if program can create and open file
self.assertTrue(testLog.opened)
returns = testLog.close()
##... | 3.25 | 3 |
manga_py/parser.py | Abijithkrishna/manga-py | 0 | 8310 | from logging import warning
from requests import get
from .info import Info
from .provider import Provider
from .providers import get_provider
class Parser:
def __init__(self, args: dict):
self.params = args
def init_provider(
self,
chapter_progress: callable = None,
... | 2.34375 | 2 |
src/villages/migrations/0008_auto_20161228_2209.py | pwelzel/bornhack-website | 0 | 8311 | <filename>src/villages/migrations/0008_auto_20161228_2209.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-28 22:09
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('villages', '0007_village_camp'),
... | 1.453125 | 1 |
customers/views.py | sindhumadhadi09/CustomerMgmt | 0 | 8312 | <reponame>sindhumadhadi09/CustomerMgmt
from django.shortcuts import get_object_or_404, render
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.views import generic
from django.utils import timezone
from .models import Customer
class IndexView(generic.ListView):
template_nam... | 2.21875 | 2 |
salt/ext/tornado/test/import_test.py | yuriks/salt | 1 | 8313 | # flake8: noqa
# pylint: skip-file
from __future__ import absolute_import, division, print_function
from salt.ext.tornado.test.util import unittest
class ImportTest(unittest.TestCase):
def test_import_everything(self):
# Some of our modules are not otherwise tested. Import them
# all (unless they... | 2.125 | 2 |
butterfree/configs/db/metastore_config.py | fossabot/butterfree | 0 | 8314 | """Holds configurations to read and write with Spark to AWS S3."""
import os
from typing import Any, Dict, List, Optional
from pyspark.sql import DataFrame
from butterfree.configs import environment
from butterfree.configs.db import AbstractWriteConfig
from butterfree.dataframe_service import extract_partition_value... | 2.703125 | 3 |
examples/2-objects.py | johanngan/special_relativity | 4 | 8315 | #!/usr/bin/env python3
import sys
sys.path.append('..')
import specrel.geom as geom
import specrel.spacetime.physical as phy
import specrel.visualize as vis
# Shared parameters
include_grid = True
include_legend = True
tlim = (0, 2)
xlim = (-2, 2)
# A stationary point object
stationary = phy.MovingObject(0, draw_opt... | 2.203125 | 2 |
firmware/modulator.py | mfkiwl/OpenXcvr | 14 | 8316 | from baremetal import *
from math import pi, sin, cos
import sys
from scale import scale
from settings import *
from ssb import ssb_polar
def modulator(clk, audio, audio_stb, settings):
audio_bits = audio.subtype.bits
#AM modulation
am_mag = Unsigned(12).constant(0) + audio + 2048
am_phase = Signe... | 2.234375 | 2 |
tests/sentry/auth/test_helper.py | pierredup/sentry | 0 | 8317 | from __future__ import absolute_import
from six.moves.urllib.parse import urlencode
from django.test import RequestFactory
from django.contrib.auth.models import AnonymousUser
from sentry.auth.helper import handle_new_user
from sentry.models import AuthProvider, InviteStatus, OrganizationMember
from sentry.testutils ... | 2 | 2 |
groundstation/broadcast_events/__init__.py | richo/groundstation | 26 | 8318 | <reponame>richo/groundstation
from broadcast_ping import BroadcastPing
EVENT_TYPES = {
"PING": BroadcastPing,
}
class UnknownBroadcastEvent(Exception):
pass
def new_broadcast_event(data):
event_type, payload = data.split(" ", 1)
if event_type not in EVENT_TYPES:
raise UnknownBroadcastEven... | 2.53125 | 3 |
mbta_python/__init__.py | dougzor/mbta_python | 0 | 8319 | import datetime
import requests
from mbta_python.models import Stop, Direction, Schedule, Mode, \
TripSchedule, Alert, StopWithMode, Prediction
HOST = "http://realtime.mbta.com/developer/api/v2"
def datetime_to_epoch(dt):
epoch = datetime.datetime.utcfromtimestamp(0)
return int((dt - epoch).total_second... | 2.84375 | 3 |
density_model_torch_custom.py | piotrwinkler/breast_density_classifier | 0 | 8320 | <reponame>piotrwinkler/breast_density_classifier<gh_stars>0
import argparse
import glob
import os
import numpy as np
import torch
from sklearn.metrics import accuracy_score
import models_torch as models
import utils
EXPERIMENT_DATA_DIR = "/tmp/mgr"
def inference(parameters, verbose=True) -> int:
# resolve de... | 2.21875 | 2 |
esmvaltool/diag_scripts/ensclus/ens_anom.py | yifatdzigan/ESMValTool | 148 | 8321 | """Computation of ensemble anomalies based on a desired value."""
import os
import numpy as np
from scipy import stats
# User-defined packages
from read_netcdf import read_iris, save_n_2d_fields
from sel_season_area import sel_area, sel_season
def ens_anom(filenames, dir_output, name_outputs, varname, numens, seaso... | 2.96875 | 3 |
pytition/petition/models.py | Te-k/Pytition | 0 | 8322 | <filename>pytition/petition/models.py
from django.db import models
from django.utils.html import mark_safe, strip_tags
from django.utils.text import slugify
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_lazy
from django.core.exceptions import ValidationError
from djang... | 2.0625 | 2 |
bin/socialhistory.py | JohnShullTopDev/generating-traning-data-for-healthcare-machine-learningcare- | 1 | 8323 | import csv
from testdata import SOCIALHISTORY_FILE
from testdata import rndDate
from patient import Patient
SMOKINGCODES = {
'428041000124106': 'Current some day smoker',
'266919005' : 'Never smoker',
'449868002' : 'Current every day smoker',
'266927001' : 'Unknown if ever smoked',
'... | 3.0625 | 3 |
Python X/Dictionaries in python.py | nirobio/puzzles | 0 | 8324 | {
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"# dictionaries, look-up tables & key-value pairs\n",
"# d = {} OR d = dict()\n",
"# e.g. d = {\"George\": 24, \"Tom\": 32}\n",
"\n",
"d = {}\n",
"\n"
]
},
{
"cell_typ... | 1.953125 | 2 |
lib/spack/spack/test/cache_fetch.py | LiamBindle/spack | 2,360 | 8325 | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import pytest
from llnl.util.filesystem import mkdirp, touch
import spack.config
from spack.fetch_strategy im... | 2.015625 | 2 |
temp_range_sql.py | hanhanwu/Hanhan-Spark-Python | 45 | 8326 | <reponame>hanhanwu/Hanhan-Spark-Python
__author__ = 'hanhanw'
import sys
from pyspark import SparkConf, SparkContext
from pyspark.sql.context import SQLContext
from pyspark.sql.types import StructType, StructField, StringType, DoubleType
conf = SparkConf().setAppName("temp range sql")
sc = SparkContext(conf=conf)
sq... | 2.796875 | 3 |
container/pyf/graphqltypes/Event.py | Pompino/react-components-23KB | 2 | 8327 | from typing_extensions import Required
#from sqlalchemy.sql.sqltypes import Boolean
from graphene import ObjectType, String, Field, ID, List, DateTime, Mutation, Boolean, Int
from models.EventsRelated.EventModel import EventModel
from graphqltypes.Utils import extractSession
class EventType(ObjectType):
id = ID(... | 2.171875 | 2 |
desktop/core/ext-py/openpyxl-2.3.0-b2/openpyxl/drawing/shape.py | kokosing/hue | 3 | 8328 | <filename>desktop/core/ext-py/openpyxl-2.3.0-b2/openpyxl/drawing/shape.py
from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
from openpyxl.styles.colors import Color, BLACK, WHITE
from openpyxl.utils.units import (
pixels_to_EMU,
EMU_to_pixels,
short_color,
)
from openpyxl.compat i... | 2.296875 | 2 |
scripts/VCF/FILTER/subset_vcf.py | elowy01/igsr_analysis | 3 | 8329 |
from VcfQC import VcfQC
from ReseqTrackDB import File
from ReseqTrackDB import ReseqTrackDB
import argparse
import os
import logging
import datetime
#get command line arguments
parser = argparse.ArgumentParser(description='Script to subset a VCF by excluding the variants within the regions defined by a BED file')
... | 2.640625 | 3 |
controllers/restart.py | Acidburn0zzz/helloworld | 0 | 8330 | <reponame>Acidburn0zzz/helloworld
import os
from base import BaseHandler
class RestartHandler(BaseHandler):
def get(self):
if not self.authenticate(superuser=True):
return
os.system('touch ' + self.application.settings["restart_path"])
self.redirect(self.get_argument("next"))
| 2.484375 | 2 |
nova/tests/unit/conductor/tasks/test_migrate.py | badock/nova-tidb | 0 | 8331 | <gh_stars>0
# 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, sof... | 1.664063 | 2 |
CH7_GitCmdAndCtrl/modules/environment.py | maxmac12/BlackHatPython | 0 | 8332 | import os
def run(**kwargs):
print("[*] In environment module.")
return str(os.environ) | 1.90625 | 2 |
diskcatalog/core/views.py | rywjhzd/Cataloging-and-Visualizing-Cradles-of-Planet-Formation | 0 | 8333 | from django.shortcuts import render
from .models import Disk
import os
def index(request):
context = {}
disk_list = Disk.objects.all()
context['disk_list'] = disk_list
return render(request, 'index.html', context)
#def index(request):
# module_dir = os.path.dirname(__file__)
# file_path = os.p... | 2.03125 | 2 |
misc/python/materialize/checks/insert_select.py | guswynn/materialize | 0 | 8334 | <reponame>guswynn/materialize<filename>misc/python/materialize/checks/insert_select.py
# Copyright Materialize, Inc. and contributors. All rights reserved.
#
# Use of this software is governed by the Business Source License
# included in the LICENSE file at the root of this repository.
#
# As of the Change Date specifi... | 2.125 | 2 |
mojoco trivial/mujocoSim/UR5/simple_example/Mujoco_py_example.py | garlicbutter/Jonathan-Tom | 2 | 8335 | <filename>mojoco trivial/mujocoSim/UR5/simple_example/Mujoco_py_example.py
import numpy as np
import mujoco_py as mj
from mujoco_py_renderer import SimulationError, XMLError, MujocoPyRenderer
from mujoco_py import (MjSim, load_model_from_xml,functions,
load_model_from_path, MjSimState,
... | 2.03125 | 2 |
evaluation/wordpress/pull_docker_images_from_private_registry.py | seveirbian/gear-old | 0 | 8336 | import sys
# package need to be installed, pip install docker
import docker
import time
import yaml
import os
import xlwt
auto = False
private_registry = "192.168.3.11:9999/"
# result
result = [["tag", "finishTime", "size", "data"], ]
class Puller:
def __init__(self, images):
self.images_to_pull = i... | 2.46875 | 2 |
jiminy/envs/vnc_wog.py | sibeshkar/jiminy | 3 | 8337 | <reponame>sibeshkar/jiminy<filename>jiminy/envs/vnc_wog.py
from jiminy.envs import vnc_env
from jiminy.spaces import VNCActionSpace
class WorldOfGooEnv(vnc_env.VNCEnv):
def __init__(self):
super(WorldOfGooEnv, self).__init__()
# TODO: set action space screen shape to match
# HACK: empty ke... | 2.078125 | 2 |
fedml_api/standalone/federated_sgan/fedssgan_api.py | arj119/FedML | 0 | 8338 | <filename>fedml_api/standalone/federated_sgan/fedssgan_api.py<gh_stars>0
import copy
import logging
import random
from typing import List, Tuple
import numpy as np
import torch
import wandb
from torch.utils.data import ConcatDataset
from fedml_api.standalone.fedavg.my_model_trainer import MyModelTrainer
from fedml_ap... | 2.078125 | 2 |
pytorch-word2vec-master/csv.py | arjun-sai-krishnan/tamil-morpho-embeddings | 2 | 8339 | <filename>pytorch-word2vec-master/csv.py<gh_stars>1-10
#!/usr/bin/env python3
import argparse
from collections import Counter
import pdb
import pickle
import re
import sys
import time
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch import optim
import torch.nn.func... | 2.453125 | 2 |
Ogrenciler/Varol/buyuksayi.py | ProEgitim/Python-Dersleri-BEM | 1 | 8340 | sayi1 = int(input("1. Sayı: "))
sayi2 = int(input("2. Sayı: "))
sayi3 = int(input("3. Sayı: "))
sayi4 = int(input("4. Sayı: "))
sayi5 = int(input("5. Sayı: "))
sayilar=[];
sayilar.append(sayi1)
sayilar.append(sayi2)
sayilar.append(sayi3)
sayilar.append(sayi4)
sayilar.append(sayi5)
sayilar.sort()
print("En büyük sayimiz... | 3.640625 | 4 |
baselines/deepq/build_graph_mfec.py | MouseHu/emdqn | 0 | 8341 | <gh_stars>0
"""Deep Q learning graph
The functions in this file can are used to create the following functions:
======= act ========
Function to chose an action given an observation
Parameters
----------
observation: object
Observation that can be feed into the output of make_obs_ph
stoc... | 2.875 | 3 |
tests/test_prior.py | frodre/LMR | 17 | 8342 | <filename>tests/test_prior.py
import sys
sys.path.append('../')
import LMR_config as cfg
import LMR_prior
import numpy as np
import pytest
def test_prior_seed():
cfg_obj = cfg.Config(**{'core':{'seed': 2}})
prior_cfg = cfg_obj.prior
prior_source = '20cr'
datadir_prior = 'data'
datafile_prior = '... | 2.15625 | 2 |
src/salgan_dhf1k/train_bce.py | juanjo3ns/SalGAN2 | 0 | 8343 | <gh_stars>0
import os
from dataloader.datasetDHF1K import DHF1K
from torch.utils.data import DataLoader
from utils.salgan_utils import save_model, get_lr_optimizer
from utils.sendTelegram import send
from utils.printer import param_print
from utils.salgan_generator import create_model, add_bn
from evaluation.fast_eval... | 1.914063 | 2 |
dragontail/content/models/basicpage.py | tracon/dragontail | 0 | 8344 | <filename>dragontail/content/models/basicpage.py<gh_stars>0
# encoding: utf-8
from django.db import models
from wagtail.wagtailcore.models import Page
from wagtail.wagtailcore.fields import StreamField
from wagtail.wagtailcore import blocks
from wagtail.wagtailadmin.edit_handlers import FieldPanel, StreamFieldPanel... | 1.945313 | 2 |
infapy/v3/agentService.py | infapy/infapy | 0 | 8345 | # Copyright (c) 2021-Present (<NAME>)
# 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 writ... | 2.078125 | 2 |
home_application/views.py | pengwow/test-demo | 0 | 8346 | <reponame>pengwow/test-demo
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云(BlueKing) available.
Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance w... | 1.9375 | 2 |
Chapter 6/09 - The built-in multiprocessing module/basic_multiprocessing.py | moseskim/Expert-Python-Programming-Fourth-Edition | 0 | 8347 | <filename>Chapter 6/09 - The built-in multiprocessing module/basic_multiprocessing.py
"""
"멀티프로세싱"절 예시
`multiprocessing` 모듈을 이용해 새로운 프로세스들을
생성하는 방법을 설명한다.
"""
from multiprocessing import Process
import os
def work(identifier):
print(f'Hey, I am the process ' f'{identifier}, pid: {os.getpid()}')
def main():
... | 3.796875 | 4 |
sweeper/cloud/localhost/manager.py | dominoFire/sweeper | 0 | 8348 | <reponame>dominoFire/sweeper
__author__ = '@dominofire'
import os
from sweeper.cloud import resource_config_combinations
from sweeper.cloud.localhost import resource_config_factory as config_factory
from sweeper.resource import Resource
def possible_configs(num):
configs = config_factory.list_configs()
comb... | 2.109375 | 2 |
tfx/orchestration/experimental/core/service_jobs_test.py | BACtaki/tfx | 1,813 | 8349 | # Copyright 2021 Google LLC. 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 applicable law or a... | 1.898438 | 2 |
dragonn/models.py | kundajelab/dragonn | 251 | 8350 | <gh_stars>100-1000
from __future__ import absolute_import, division, print_function
import matplotlib
import numpy as np
import os
import subprocess
import sys
import tempfile
matplotlib.use('pdf')
import matplotlib.pyplot as plt
from abc import abstractmethod, ABCMeta
from dragonn.metrics import ClassificationResult
f... | 2.328125 | 2 |
src/mpass/mpass/migrations/0001_initial.py | haltu/velmu-mpass-demo | 0 | 8351 | <reponame>haltu/velmu-mpass-demo<gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-03-20 08:34
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import parler.models
class Migration(migrations.Migration):
initial = True
... | 1.710938 | 2 |
dgt/inference/forward_inference.py | fractalego/dgt | 3 | 8352 | <filename>dgt/inference/forward_inference.py
import logging
import random
from dgt.graph.graph_matcher import GraphWeightedMatch
from dgt.utils import graph_iterations
_logger = logging.getLogger(__name__)
def find_weight_between(s, first, last):
try:
start = s.index(first) + len(first)
end = s.... | 2.25 | 2 |
serverPythonClient/client.py | ikekilinc/dnnSuperBinoculars | 0 | 8353 | <filename>serverPythonClient/client.py
import argparse
import cv2
import common
# from .utils.cropAtCenter import cropImageCenter
# from cropAtCenter import cropImageCenter
from gabriel_client.websocket_client import WebsocketClient
from gabriel_client.opencv_adapter import OpencvAdapter
DEFAULT_SERVER_HOST = '172.1... | 2.640625 | 3 |
src/DeepCard.API/batch.py | SharsDela/BankCardRecognize | 7 | 8354 | from api import get_result
import os
import shutil
from glob import glob
from PIL import Image
if __name__ == '__main__':
image_files = glob('./test_images/*.*')
result_dir = './test_results'
if os.path.exists(result_dir):
shutil.rmtree(result_dir)
os.mkdir(result_dir)
txt_file = os.path.j... | 2.671875 | 3 |
CIM14/ENTSOE/Equipment/Core/Curve.py | MaximeBaudette/PyCIM | 58 | 8355 | # Copyright (C) 2010-2011 <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, publish, distrib... | 1.84375 | 2 |
fluent/syntax/errors.py | unclenachoduh/python-fluent | 0 | 8356 | from __future__ import unicode_literals
class ParseError(Exception):
def __init__(self, code, *args):
self.code = code
self.args = args
self.message = get_error_message(code, args)
def get_error_message(code, args):
if code == 'E00001':
return 'Generic error'
if code == '... | 2.96875 | 3 |
tests/test_mag.py | jdddog/mag-archiver | 0 | 8357 | # Copyright 2020 Curtin University
#
# 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 writi... | 2.078125 | 2 |
twitterinfrastructure/CH-Data-Public.py | jacob-heglund/socialsensing-jh | 0 | 8358 | '''
Created on Mar 22, 2018
Edited on Jan 11, 2019
@author: npvance2
@author: curtisd2
Variables that will need to be edited/personalized:
monitorID in Variables() (line 27)
projectStartDate in Variables() (line 28)
projectEndDate in Variables() (line 29)
authToken in getAuthToken() (... | 2.609375 | 3 |
roles/slurm/files/startnode.py | danhnguyen48/slurm-elastic-computing | 0 | 8359 | #! /opt/cloud_sdk/bin/python
import asyncio
import logging
import subprocess
import sys
import citc_cloud
def handle_exception(exc_type, exc_value, exc_traceback):
if issubclass(exc_type, KeyboardInterrupt):
sys.__excepthook__(exc_type, exc_value, exc_traceback)
return
log.critical("Uncaugh... | 1.882813 | 2 |
tests/pyre/components/component_class_registration_model.py | BryanRiel/pyre | 0 | 8360 | <filename>tests/pyre/components/component_class_registration_model.py<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# <NAME>
# orthologue
# (c) 1998-2018 all rights reserved
#
"""
Verify that component registration interacts correctly with the pyre configurator model
"""
# access
# print(" -- importing... | 2.359375 | 2 |
tests/unit/transport/plugins/asyncssh/test_asyncssh_transport.py | carlmontanari/nssh | 1 | 8361 | import asyncio
from io import BytesIO
import pytest
from asyncssh.connection import SSHClientConnection
from asyncssh.stream import SSHReader
from scrapli.exceptions import ScrapliConnectionNotOpened, ScrapliTimeout
class DumbContainer:
def __init__(self):
self.preferred_auth = ()
def __getattr__(s... | 1.984375 | 2 |
apps/ignite/views.py | Mozilla-GitHub-Standards/93f18f14efcf5fdfc0e04f9bf247f66baf46663f37b1d2087ab8d850abc90803 | 2 | 8362 | <filename>apps/ignite/views.py
from django.shortcuts import get_object_or_404
import jingo
import waffle
from django.contrib.auth.models import User
from challenges.models import Submission, Category
from projects.models import Project
from blogs.models import BlogEntry
from events.models import Event
def splash(req... | 1.90625 | 2 |
dataPresenter.py | thebouv/IUS-Hacktoberfest | 3 | 8363 | from plotly.subplots import make_subplots
import plotly.graph_objects as go
import plotly.io as pio
from dataProcessor import parseLabels, parseLangs
import plotly.io as pio
import os
years = parseLabels()
langs = parseLangs()
#make the plotly results
fig = make_subplots(
rows=1, cols=2,
specs=[[{"type": "x... | 2.75 | 3 |
bdlb/diabetic_retinopathy_diagnosis/benchmark.py | Sairam954/bdl-benchmarks | 666 | 8364 | # Copyright 2019 BDL Benchmarks Authors. 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 applica... | 1.851563 | 2 |
db/redis_db.py | Lifeistrange/WeiboSpider | 1 | 8365 | <reponame>Lifeistrange/WeiboSpider
# coding:utf-8
import datetime
import json
import re
import redis
from config.conf import get_redis_args
redis_args = get_redis_args()
class Cookies(object):
rd_con = redis.StrictRedis(host=redis_args.get('host'), port=redis_args.get('port'),
pas... | 2.109375 | 2 |
vivisect/storage/mpfile.py | vEpiphyte/vivisect | 0 | 8366 | import base64
import logging
import msgpack
logger = logging.getLogger(__name__)
loadargs = {'use_list': False, 'raw': False}
if msgpack.version < (1, 0, 0):
loadargs['encoding'] = 'utf-8'
else:
loadargs['strict_map_key'] = False
VSIG = b'MSGVIV'.ljust(8, b'\x00')
def vivEventsAppendFile(filename, events)... | 2.140625 | 2 |
pytest_pgsql/plugin.py | mathiasose/pytest-pgsql | 0 | 8367 | <filename>pytest_pgsql/plugin.py
"""This forms the core of the pytest plugin."""
import pytest
import testing.postgresql
from pytest_pgsql import database
from pytest_pgsql import ext
def pytest_addoption(parser):
"""Add configuration options for pytest_pgsql."""
parser.addoption(
'--pg-extensions',... | 2.28125 | 2 |
power_data_to_sat_passes/date_utils.py | abrahamneben/orbcomm_beam_mapping | 1 | 8368 | # written by abraham on aug 24
def dyear2date(dyear):
year = int(dyear)
month_lengths = [31,28,31,30,31,30,31,31,30,31,30,31]
days_before_months = [0,31,59,90,120,151,181,212,243,273,304,334]
days_into_year_f = (dyear-year)*365
days_into_year_i = int(days_into_year_f)
for i in range(12):
if days_before_mo... | 3.640625 | 4 |
app/base/count_lines.py | sourcery-ai-bot/personal-expenses-accounting | 5 | 8369 | import glob
from os import walk
exclude_folders = [
'node_modules',
'ios',
'android',
'__pycache__'
]
exclude_files = [
'json',
'txt',
'traineddata',
'lstmf',
'yml',
'md'
'log',
'env',
'gitignore',
'dockerignore'
]
# get all files in directory
dirr = '/home/vik... | 3.03125 | 3 |
data/contacts.py | rgurevych/python_for_testers | 0 | 8370 |
from models.contact import Contact
testdata = [Contact(first_name="Firstname", last_name="Lastname", mobile_phone="+12345678",
work_phone="12345", home_phone="67890", fax="55443322", email_1="<EMAIL>",
email_2="<EMAIL>", email_3="<EMAIL>",
... | 2.03125 | 2 |
charmhelpers/contrib/charmsupport/nrpe.py | nobuto-m/charm-helpers | 0 | 8371 | <filename>charmhelpers/contrib/charmsupport/nrpe.py<gh_stars>0
# Copyright 2014-2015 Canonical Limited.
#
# 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/LIC... | 1.6875 | 2 |
venv/Lib/site-packages/proglog/proglog.py | mintzer/pupillometry-rf-back | 83 | 8372 | """Implements the generic progress logger class, and the ProgressBar class.
"""
from tqdm import tqdm, tqdm_notebook
from collections import OrderedDict
import time
SETTINGS = {
'notebook': False
}
def notebook(turn='on'):
SETTINGS['notebook'] = True if (turn == 'on') else False
def troncate_string(s, max_l... | 3.1875 | 3 |
gdsfactory/tests/test_component_from_yaml_bezier.py | jorgepadilla19/gdsfactory | 42 | 8373 | <reponame>jorgepadilla19/gdsfactory
import gdsfactory as gf
from gdsfactory.component import Component
yaml = """
name:
test_component_yaml_without_cell
instances:
mmi:
component: mmi1x2
bend:
component: bend_s
connections:
bend,o1: mmi,o2
"""
def test_component_from_yaml_without_cell(... | 2.5 | 2 |
cats/types.py | AdamBrianBright/cats-python | 2 | 8374 | <filename>cats/types.py
from pathlib import Path
from types import GeneratorType
from typing import AsyncIterable, Iterable, TypeAlias
import ujson
from cats.errors import MalformedHeadersError
try:
from django.db.models import QuerySet, Model
except ImportError:
QuerySet = type('QuerySet', (list,), {})
... | 2.390625 | 2 |
raven/utils/urlparse.py | MyCollege/raven | 0 | 8375 | <gh_stars>0
from __future__ import absolute_import
try:
import urlparse as _urlparse
except ImportError:
from urllib import parse as _urlparse
def register_scheme(scheme):
for method in filter(lambda s: s.startswith('uses_'), dir(_urlparse)):
uses = getattr(_urlparse, method)
if scheme n... | 2.15625 | 2 |
setup.py | stjordanis/MONeT-1 | 161 | 8376 | <filename>setup.py
import setuptools
setuptools.setup(
name="monet_memory_optimized_training",
version="0.0.1",
description="Memory Optimized Network Training Framework",
url="https://github.com/philkr/lowrank_conv",
packages=setuptools.find_packages(include = ['monet', 'monet.*', 'models', 'checkm... | 1.234375 | 1 |
Tests/Methods/Machine/test_Magnet_Type_11_meth.py | Superomeg4/pyleecan | 2 | 8377 | # -*- coding: utf-8 -*-
"""
@date Created on Thu Dec 18 13:56:33 2014
@copyright (C) 2014-2015 EOMYS ENGINEERING.
@author pierre_b
"""
from unittest import TestCase
from ddt import ddt, data
from pyleecan.Classes.Arc1 import Arc1
from pyleecan.Classes.Segment import Segment
from pyleecan.Classes.MagnetType11 import... | 2.015625 | 2 |
tomo_encoders/tasks/void_mapping.py | arshadzahangirchowdhury/TomoEncoders | 0 | 8378 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
"""
from operator import mod
from tomo_encoders.misc.voxel_processing import modified_autocontrast, TimerGPU
from tomo_encoders.reconstruction.recon import recon_patches_3d
import cupy as cp
import numpy as np
from skimage.filters import threshold_otsu
from tomo_en... | 2.09375 | 2 |
handypackages/subscribe/migrations/0001_initial.py | roundium/handypackages | 1 | 8379 | # Generated by Django 2.2.1 on 2019-06-22 11:03
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='SubscribeModel',
fields=[
('id', models.Aut... | 1.804688 | 2 |
TuShare/view/sh_margins.py | lwh2015/TuShare | 1 | 8380 | # -*- coding: UTF-8 -*-
import json
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
import tushare as ts
from .publiceClass import DateEncoder
@csrf_exempt
def sh_margins(request):
try:
start = request.POST.get('start','')#选填
end = request.POST.get('end','... | 2.0625 | 2 |
intermediate/classes/camera.py | robertob45/learning-python | 0 | 8381 | class Camera:
"""docstring for ."""
def __init__(self, brand, sensor, lens, battery):
self.brand = brand
self.sensor = sensor
self.lens = lens
self.battery = battery
def __str__(self):
return self.brand + ' ' + self.sensor + ' ' + self.lens + ' ' + self.battery
... | 3.75 | 4 |
dbaas/tsuru/tests/test_service_add.py | didindinn/database-as-a-service | 0 | 8382 | <filename>dbaas/tsuru/tests/test_service_add.py
from mock import patch, MagicMock
from django.contrib.auth.models import User
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.utils.datastructures import MultiValueDictKeyError
from account.models import Role, Team, Organization... | 2.3125 | 2 |
Main/migrations/0072_auto_20210506_0016.py | Muhammet-Yildiz/Ecommerce_Website-HepsiOrada | 10 | 8383 | # Generated by Django 3.1.4 on 2021-05-05 21:16
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('Main', '0071_auto_20210506_0004'),
]
operations = [
migrations.RemoveField(
model_name='product',
name='chooseColor',
... | 1.53125 | 2 |
1.py | zweed4u/dailycodingproblem | 0 | 8384 | #!/usr/bin/python3
"""
Good morning! Here's your coding interview problem for today.
This problem was recently asked by Google.
Given a list of numbers and a number k, return whether any two numbers from the list add up to k.
For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17.
Bonus: Can ... | 3.890625 | 4 |
gryphon/data/template_scaffolding/template/setup.py | ow-gryphon/gryphon | 0 | 8385 | import json
import setuptools
with open("template/README.md", "r") as fh:
long_description = fh.read()
with open('requirements.txt') as fr:
requirements = fr.read().strip().split('\n')
with open('metadata.json') as fr:
metadata = json.load(fr)
setuptools.setup(
name="", # Name of the repository
... | 1.820313 | 2 |
train_base3.py | Mhaiyang/iccv | 2 | 8386 | """
@Time : 201/21/19 10:41
@Author : TaylorMei
@Email : <EMAIL>
@Project : iccv
@File : train_base3.py
@Function:
"""
import datetime
import os
import torch
from torch import nn
from torch import optim
from torch.autograd import Variable
from torch.backends import cudnn
from torch.utils.data import... | 1.75 | 2 |
tests/test_comment.py | uwase-diane/min_pitch | 1 | 8387 | import unittest
from app.models import Comment, Pitch
from app import db
class TestPitchComment(unittest.TestCase):
def setUp(self):
self.new_pitch = Pitch(post = "doit", category='Quotes')
self.new_comment = Comment(comment = "good comment", pitch=self.new_pitch)
def test_instance(se... | 3.25 | 3 |
teacher/views.py | itteamforslp/safelife_project | 0 | 8388 | from django.shortcuts import render
from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import csrf_exempt
from django.template import loader
from django.db import connection
from django.http import HttpResponseRedirect
import datetime
from dj... | 2.0625 | 2 |
botstory/middlewares/text/text_test.py | botstory/bot-story | 5 | 8389 | import logging
import pytest
import re
from . import text
from ... import matchers
from ...utils import answer, SimpleTrigger
logger = logging.getLogger(__name__)
@pytest.mark.asyncio
async def test_should_run_story_on_equal_message():
trigger = SimpleTrigger()
with answer.Talk() as talk:
story = ta... | 2.234375 | 2 |
pywikibot/site/_datasite.py | xqt/pwb | 0 | 8390 | <gh_stars>0
"""Objects representing API interface to Wikibase site."""
#
# (C) Pywikibot team, 2012-2022
#
# Distributed under the terms of the MIT license.
#
import datetime
import json
import uuid
from contextlib import suppress
from typing import Optional
from warnings import warn
import pywikibot
from pywikibot.da... | 2.140625 | 2 |
app.py | MisaelVillaverde/fourier-calculator | 0 | 8391 | from flask import Flask
from flask import render_template, request
from flask import jsonify
import requests
import json
app = Flask(__name__)
@app.route("/symbo",methods=['POST'])
def symbo():
#import pdb; pdb.set_trace()
session = requests.session()
token = session.get("https://es.symbolab.com/solver/s... | 2.921875 | 3 |
my_code/Chapter_2.py | kalona/Spark-The-Definitive-Guide | 2 | 8392 | from pyspark.sql import SparkSession
# spark = SparkSession.builder.master("local[*]").getOrCreate()
spark = SparkSession.builder.getOrCreate()
file_path = "C:\home_work\local_github\Spark-The-Definitive-Guide\data\/flight-data\csv\/2015-summary.csv"
# COMMAND ----------
# COMMAND ----------
flightData2015 = spa... | 3.21875 | 3 |
tests/test_intake_postgres.py | ContinuumIO/intake-postgres | 2 | 8393 | import os
import pickle
import pytest
import pandas as pd
from shapely import wkt
from intake_postgres import PostgresSource
from intake import open_catalog
from .util import verify_datasource_interface
TEST_DATA_DIR = 'tests'
TEST_DATA = [
('sample1', 'sample1.csv'),
('sample2_1', 'sample2_1.csv'),
('sa... | 2.0625 | 2 |
Module_3/testImage.py | dks1018/CoffeeShopCoding | 0 | 8394 | # file = open('C:\\Users\\dks10\\OneDrive\\Desktop\\Projects\\Code\\Python\\PythonCrypto\\Module_3\\eye.png', 'rb')
file = open('encrypt_eye.png', 'rb')
image = file.read()
file.close()
image = bytearray(image)
key = 48
for index, value in enumerate(image):
image[index] = value^key
file = open('2eye.png','wb')
... | 2.921875 | 3 |
ledfxcontroller/effects/temporal.py | Aircoookie/LedFx | 17 | 8395 | <reponame>Aircoookie/LedFx
import time
import logging
from ledfxcontroller.effects import Effect
from threading import Thread
import voluptuous as vol
_LOGGER = logging.getLogger(__name__)
DEFAULT_RATE = 1.0 / 60.0
@Effect.no_registration
class TemporalEffect(Effect):
_thread_active = False
_thread = None
... | 2.6875 | 3 |
07/c/3 - Square Census.py | Surferlul/csc-python-solutions | 0 | 8396 | <gh_stars>0
n=int(input())
c = 1
while c**2 < n:
print(c**2)
c += 1
| 3.140625 | 3 |
utils.py | LuChang-CS/sherbet | 2 | 8397 | import numpy as np
class DataGenerator:
def __init__(self, inputs, shuffle=True, batch_size=32):
assert len(inputs) > 0
self.inputs = inputs
self.idx = np.arange(len(inputs[0]))
self.shuffle = shuffle
self.batch_size = batch_size
self.on_epoch_end()
def data_le... | 2.765625 | 3 |
Version1_STI.py | sudhanshu55/Speech_to_Image | 0 | 8398 | from nltk.tokenize import sent_tokenize, word_tokenize
from nltk.corpus import stopwords
import speech_recognition as sr
import nltk
from google_images_download import google_images_download
response = google_images_download.googleimagesdownload()
r = sr.Recognizer()
with sr.Microphone() as source:
print("Say some... | 3.296875 | 3 |
src/models.py | jonathanlloyd/scratchstack-httpserver | 0 | 8399 | <gh_stars>0
from dataclasses import dataclass
@dataclass
class Request:
method: str
path: str
headers: dict
body: bytes
@dataclass
class Response:
status_code: int
reason_phrase: str
headers: dict
body: bytes
| 2.34375 | 2 |