id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1770968 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) Copyright 2020 <NAME>. All Rights Reserved
from __future__ import print_function
from __future__ import division
import click
import zerorpc
import time
import yaml
from loguru import logger as log
from PIL import Image
from traintrack.server import TrackerServer
fr... | StarcoderdataPython |
66232 | <gh_stars>0
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""See README.md for package documentation."""
from setuptools import setup
from io import open
from os import path
from calendar_widget import __version__
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.md'), encoding='utf-8') as ... | StarcoderdataPython |
130439 | import fisher
import numpy as np
def print_2x2_table(table, row_labels, col_labels, fmt="%d"):
"""
Prints a table used for Fisher's exact test. Adds row, column, and grand
totals.
:param table: The four cells of a 2x2 table: [r1c1, r1c2, r2c1, r2c2]
:param row_labels: A length-2 list of row names
... | StarcoderdataPython |
163493 | import pandas as pd
# Load dataset https://storage.googleapis.com/dqlab-dataset/LO4/global_air_quality_4000rows.csv
gaq = pd.read_csv('https://storage.googleapis.com/dqlab-dataset/LO4/global_air_quality_4000rows.csv')
# Cetak 5 data teratas
print('Sebelum diubah dalam format datetime:\n', gaq.head())
# Ubah menjadi dat... | StarcoderdataPython |
1793095 | <reponame>AvTe/Data-Structure-in-Python-Dr.-R-Nageswara-Rao-Book-program-<filename>Deque..py
# deque Operation
from collections import deque
# create an emtpy deque
d = deque()
choice=0
while choice<7:
print('DEQUE OPERATION')
print('1 Add element at front')
print('2 Remove element at front... | StarcoderdataPython |
3362552 | # Generated by Django 2.2.8 on 2020-02-14 07:30
import django.contrib.gis.db.models.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('datasets', '0037_auto_20200211_1929'),
('boundaries', '0020_ward_name'),
... | StarcoderdataPython |
1622699 | """Variáveis que caracterizam o banco de dados"""
import os
__all__ = [
'f_names_train', 'f_names_test', 'ch_names', 'e_dict', 'e_classes',
'n_runs', 'base_folder', 'epoch_train_loc', 'epoch_test_loc', 'raw_folder', 'raw_fif_folder',
'csp_folder', 'features_test_folder', 'features_train_folder', 'originals... | StarcoderdataPython |
1746274 | <filename>backend/document/entrypoints/app.py
"""This module provides the FastAPI API definition."""
import os
import pathlib
from collections.abc import Iterable, Sequence
from typing import Any
from document.config import settings
from document.domain import document_generator, exceptions, model, resource_lookup
fr... | StarcoderdataPython |
59302 | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^(?P<site_settings_pk>\d+)/special-page/add/$',
views.special_page_add, name='special-page-add'),
url(r'^(?P<site_settings_pk>\d+)/special-page/'
r'(?P<pk>\d+)/update/$',
views.special_page_edit, name='special-p... | StarcoderdataPython |
1691569 | <reponame>mdavezac/bempp<filename>python/bempp/visualization.py
# Copyright (C) 2011-2012 by the BEM++ Authors
#
# 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... | StarcoderdataPython |
36560 | <filename>src/Algorithms/VotingClassifier.py
# External Modules
import numpy as np
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.model_selection import train_test_split
from sklearn.model_selection import GridSearchCV
from sklearn.ensemble import VotingClassifier
from sklearn.metrics import accur... | StarcoderdataPython |
3223068 | #!/usr/bin/python
"""
(C) Copyright 2021 Intel Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
"""
from logging import getLogger
from ClusterShell.NodeSet import NodeSet
class TelemetryUtils():
# pylint: disable=too-many-nested-blocks
"""Defines a object used to verify telemetry information."""
... | StarcoderdataPython |
1693002 | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by <NAME> (<EMAIL>)
# ------------------------------------------------------------------------------
from __future__ import absolute_import
from __future__ import divis... | StarcoderdataPython |
45506 | # TODO: figure out how to put this in the app/ folder and still use serverless
# This line: `handler: main.handler`
# How do we specify a path here, as per uvicorn?
import os
from enum import Enum
from typing import Optional
from pydantic import BaseModel
from fastapi import FastAPI, Query
# for lambda; see https://... | StarcoderdataPython |
33819 | <filename>sound_play/scripts/test/test_sound_client.py
#!/usr/bin/env python
import unittest
import rospy
import rostest
from sound_play.libsoundplay import SoundClient
class TestCase(unittest.TestCase):
def test_soundclient_constructor(self):
s = SoundClient()
self.assertIsNotNone(s)
if __name_... | StarcoderdataPython |
1605370 | import os
import zipfile
import logging
import boto3
import wget
logger = logging.getLogger()
logger.setLevel(logging.INFO)
S3_BUCKET_NAME = "movie-data-platform.mpd"
TEMP_PATH = "/tmp/"
MOVIE_LENS_PATH = "movie_lens/"
RAW_ZONE_PATH = "raw_zone/"
MOVIE_LENS_URL_PREFIX = "https://files.grouplens.org/datasets/movielens... | StarcoderdataPython |
1636259 | <reponame>PeoplesMomentum/mxv
"""
Django settings for mxv project on Heroku. For more info, see:
https://github.com/heroku/heroku-django-template
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoprojec... | StarcoderdataPython |
25517 | <gh_stars>1-10
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.gridlayout import GridLayout
from kivy.uix.screenmanager import ScreenManager, Screen, FadeTransition
import zapador.constantes as cons
from zapador.metodos import pre_run
from zapador.clases import *
from kivy.factory import Factory
... | StarcoderdataPython |
1752146 | <filename>python/tinyusdz/Usd/__init__.py
from . import Stage
| StarcoderdataPython |
7116 | # This file is part of the CERN Indico plugins.
# Copyright (C) 2014 - 2021 CERN
#
# The CERN Indico plugins are free software; you can redistribute
# them and/or modify them under the terms of the MIT License; see
# the LICENSE file for more details.
import dateutil.parser
import pytz
from flask import flash, request... | StarcoderdataPython |
1601851 | <gh_stars>0
# Copyright (c) 2016 Iotic Labs Ltd. 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
#
# https://github.com/Iotic-Labs/py-IoticAgent/blob/master/LICENSE
#... | StarcoderdataPython |
1792095 | <filename>ping2mqtt/logging.py
import sys
from loguru import logger
from .settings import general_settings
__all__ = ("logger",)
LoggerFormat = "<green>{time:YY-MM-DD HH:mm:ss.SSS}</green> | " \
"<level>{level: <8}</level> | " \
"<level>{message}</level>"
logger.remove()
logger.add(
... | StarcoderdataPython |
1651963 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Copyright (c) Merchise Autrement [~º/~] and Contributors
# All rights reserved.
#
# This is free software; you can do what the LICENCE file allows you to.
#
from __future__ import (div... | StarcoderdataPython |
3244654 | """Dataset class template
This module provides a template for users to implement custom datasets.
You can specify '--dataset_mode template' to use this dataset.
The class name should be consistent with both the filename and its dataset_mode option.
The filename should be <dataset_mode>_dataset.py
The class name should... | StarcoderdataPython |
27541 | # -*- coding: utf-8 -*-
"""
Created on Sun Jul 5 06:34:04 2015
@author: tanay
"""
from lasagne.layers import InputLayer, DropoutLayer, DenseLayer
from lasagne.updates import nesterov_momentum
from lasagne.objectives import binary_crossentropy
from nolearn.lasagne import NeuralNet
import theano
from theano import tens... | StarcoderdataPython |
3253020 | <gh_stars>0
def makeKDTree(points, dim = 0):
if not points:
return None
elif len(points) == 1:
return tuple(points)
points.sort(key = lambda p: p[dim])
medianIndex = len(points) // 2
median = points[medianIndex][dim]
nextDim = (dim + 1) % len(points[medianIndex])
left = points[:medianIndex]
righ... | StarcoderdataPython |
1733190 | <filename>armstrong/apps/embeds/admin_forms.py<gh_stars>1-10
from functools import wraps
from django.core.cache import cache
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as _
from django.core.exceptions import ValidationError
from django.contrib.formtools.preview import F... | StarcoderdataPython |
4836717 | # Copyright (C) 2018 and later: Unicode, Inc. and others.
# License & terms of use: http://www.unicode.org/copyright.html
# Python 2/3 Compatibility (ICU-20299)
# TODO(ICU-20301): Remove this.
from __future__ import print_function
from abc import abstractmethod
from collections import defaultdict
import re
import sys... | StarcoderdataPython |
3368522 | from gitmanager import *
def test_is_same_commit():
assert is_same_commit("HEAD", "HEAD")
assert not is_same_commit("HEAD", "HEAD~")
| StarcoderdataPython |
19703 | import os
import yaml
import copy
import logging
from pathlib import Path
import torch
from torch.nn import *
from torch.optim import *
import torch.distributed as dist
from torch.optim.lr_scheduler import *
from torch.nn.parallel import DistributedDataParallel
from utils.metrics import *
from models import _get_mode... | StarcoderdataPython |
4825041 | """ philoseismos: engineering seismologist's toolbox.
This file defines a TextualFileHeader object.
author: <NAME>
e-mail: <EMAIL> """
class TextualFileHeader:
""" This object represents a textual file header of a SEG-Y file. """
def __init__(self):
""" Create a new TFH object. """
self._c... | StarcoderdataPython |
27057 | <filename>iCount/tests/test_externals.py
# pylint: disable=missing-docstring, protected-access
import warnings
import unittest
import iCount.externals.cutadapt as cutadapt
import iCount.externals.star as star
from iCount.tests.utils import make_fasta_file, make_fastq_file, get_temp_dir, \
get_temp_file_name, mak... | StarcoderdataPython |
4805903 | import os
import logging
import re
from cog.utils import str2bool
rel = lambda *x: os.path.join(os.path.abspath(os.path.dirname(__file__)), *x)
ESGF_CONF_DIR = os.getenv('ESGF_CONF_DIR', rel(''))
'''
SITE SPECIFIC CONFIGURATION
These parameters are read from file 'cog_settings.cfg'
located in directory COG_CONFIG_... | StarcoderdataPython |
4806901 | <filename>libs/datasets/data_source.py
import pathlib
from typing import List
from typing import Optional
from typing import Union
import structlog
from covidactnow.datapublic import common_df
from covidactnow.datapublic.common_fields import CommonFields
from covidactnow.datapublic.common_fields import PdFields
from ... | StarcoderdataPython |
3330393 | <filename>easy_lmfit/easy_lmfit.py<gh_stars>1-10
import numpy as np
import scipy
import inspect
import lmfit
from lmfit import *
from lmfit.models import *
from matplotlib import pyplot as plt
import warnings
import re
import asteval
def get_model_params(fit_func):
if inspect.isclass(fit_func):
module_name... | StarcoderdataPython |
167660 | <gh_stars>0
"""Models used by django-watson."""
from __future__ import unicode_literals
import uuid
from django.db import models
from django.db.models.fields.related import RelatedField
from django.contrib.contenttypes.models import ContentType
from django.utils.encoding import force_str
from django.utils.functional... | StarcoderdataPython |
160893 | """Views for this awesome app."""
from django.shortcuts import render
from django.urls import reverse_lazy
from django.http import Http404
from django.contrib.auth.models import User
from django.views.generic import TemplateView, CreateView
from imager_images.models import Photo, Album
from imager_profile.models import... | StarcoderdataPython |
1773585 | import sys
from PyQt5.QtWidgets import QApplication, \
QWidget, QPushButton, QAction, QLineEdit, \
QMessageBox, QMainWindow, QHBoxLayout, QDialog, \
QVBoxLayout, QGridLayout, QGroupBox, QFormLayout, QRadioButton, QMenu, QMenuBar, \
QTreeWidget, QTreeWidgetItem, QTextEdit, QFrame, QTabWidget, QLabe... | StarcoderdataPython |
3256233 | <gh_stars>0
from django.apps import AppConfig
class AwardsAppConfig(AppConfig):
name = 'awards_app'
| StarcoderdataPython |
3208756 | VERSION = '0.5.3'
| StarcoderdataPython |
3351375 | """https://leetcode.com/problems/missing-number/
Constraints:
- n == nums.length
- 1 ≤ n ≤ 104
- 0 ≤ nums[i] ≤ n
- All the numbers of nums are unique.
Examples:
>>> Solution().missingNumber([])
0
See Also:
- pytudes/_2021/educative/grokking_the_coding_interview/bitwise_xor/_0__find_missin... | StarcoderdataPython |
1717067 | # -*- coding: utf-8 -*-
from alive_progress import alive_bar
import pandas as pd
from logging import getLogger
from tws_equities.data_files import get_japan_indices
from tws_equities.helpers import read_json_file
from tws_equities.helpers import save_data_as_json
from tws_equities.helpers import make_dirs
from tws_e... | StarcoderdataPython |
3340264 | # Copyright © 2019 <NAME>.
# Import the base board class.
from battleships.objects.Board import Board
# Import the engine.
import engine
class ShipBoard(Board):
"""
Board object that renders all the ships from the player.
"""
def __init__(self, parent):
"""
Class constructor.
... | StarcoderdataPython |
1659039 | <reponame>gogomillan/holbertonschool-higher_level_programming
#!/usr/bin/python3
"""
Module for Rectable class.
"""
BaseGeometry = __import__("7-base_geometry").BaseGeometry
class Rectangle(BaseGeometry):
"""
Class Rectangle
"""
def __init__(self, width, height):
"""
Returns an insta... | StarcoderdataPython |
1740589 | <gh_stars>0
import numpy as np
import h5py
#
def normalization(data):
_range = np.max(data) - np.min(data)
return (data - np.min(data)) / _range
def onehot(data_y):
# one-hot encoding sleep stages
data_y=[data_y]
temp_y = []
for i in range(len(data_y)):
temp_ = []
f... | StarcoderdataPython |
63429 |
"""Flexible code for histogramming per-snp and per-replica statistics for selected SNPs in selected replicas in
selected scenarios and/or demographies."""
from Operations.Shari_Operations.localize.Scenario import GetScenarios, GetSelectionScenarios
from Operations.MiscUtil import Dict, compile_expr, dbg, Histogrammer... | StarcoderdataPython |
151138 | import os
import sys
sys.path.append(os.path.dirname(__name__))
from app import app
from settings import DEFAULT_WEB_SERVER
app.run(host=DEFAULT_WEB_SERVER['host'], port=DEFAULT_WEB_SERVER['port'], debug=True)
| StarcoderdataPython |
1760925 | """test for CharArrowKeysInput"""
import os
import unittest
from mock import patch, Mock
try:
from ui import CharArrowKeysInput
except ImportError:
print("Absolute imports failed, trying relative imports")
os.sys.path.append(os.path.dirname(os.path.abspath('.')))
# Store original __import__
orig_i... | StarcoderdataPython |
32365 | from decimal import Decimal
from unittest.mock import patch
from django.test import TestCase
from django.urls import reverse
from django.contrib import auth
from main.models import Product, User, Address
from main.forms import UserCreationForm
class TestPage(TestCase):
def test_home_page_works(self):
re... | StarcoderdataPython |
3250609 | import os
import sys
import shutil
import unittest
import tensorflow as tf
import tensorflow.contrib.slim.nets as nets
from tensorflow.contrib import layers
import hiddenlayer as hl
# Hide GPUs. Not needed for this test.
os.environ["CUDA_VISIBLE_DEVICES"] = ""
# Create output directory in project root
ROOT_DIR = os.p... | StarcoderdataPython |
1789133 | from UE4Parse.BinaryReader import BinaryStream
from UE4Parse.Assets.Objects.FText import FText
class TextProperty:
position: int
Value = None
def __init__(self, reader: BinaryStream) -> None:
self.position = reader.base_stream.tell()
self.Value = FText(reader)
def GetValue(self):
... | StarcoderdataPython |
1759236 | import requests
import json
import os
if 'RITO_SLACK_TOKEN' not in os.environ:
print("To use Rito's slack functions, first create a Slack app on your workspace following these instructions: https://api.slack.com/messaging/sending#getting_started")
print("Your app needs the permissions channel:read, chat:write,... | StarcoderdataPython |
1625602 | import requests
from settings import PORT
from dbmodules.base import CoreDBServer
from dbmodules.user import UserTable
from dbmodules.order import OrderTable
import logging
def pe_api(url, data=None, headers=None):
try:
ret = requests.post(url, headers=headers, data=data)
# print(ret.request.heade... | StarcoderdataPython |
156700 | #!/usr/bin/env python
# coding: utf-8
# ### Modules ###
# In[1]:
import pandas as pd
import requests
from splinter import Browser
from bs4 import BeautifulSoup as bs
from webdriver_manager.chrome import ChromeDriverManager
# ### Setting Chrome Path ###
# In[2]:
def scrape():
# browser = init_browser()
e... | StarcoderdataPython |
59122 | <reponame>oliveirahelena/codeflix-catalog-api<filename>src/infrastructure/db/repo/video_repository.py
import uuid
from typing import Set, Union
from sqlalchemy.orm import Session
from src.domain.entities import CastMember, Category, Genre, Video
from src.infrastructure.db.models import orm
from .repository import SQ... | StarcoderdataPython |
178881 | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from . import verilog
__intrinsics__ = ('set_header', 'get_header',
'set_global_offset', 'set_global_addrs',
'set_global_addr_map', 'write_global_addr_map', 'load_global_ad... | StarcoderdataPython |
3390006 | from django_filters import rest_framework as filters
from core.models import Ad
class AdFilter(filters.FilterSet):
class Meta:
model = Ad
fields = ['category']
| StarcoderdataPython |
1706538 | <filename>setup.py
"""Packaging settings."""
from dhandaulat import __version__
from setuptools import Command, find_packages, setup
setup(
name='dhandaulat',
version=__version__,
description='A Currency converter command line program in Python.',
url='https://github.com/Shivang-Bhandari/DhanDaulat',... | StarcoderdataPython |
1756534 | """empty message
Revision ID: <KEY>
Revises: <PASSWORD>
Create Date: 2020-06-16 19:37:25.877004
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto ... | StarcoderdataPython |
1752898 | <reponame>JNKielmann/cotect<gh_stars>10-100
from cotect_endpoints.schema import User, CaseReport, CasePlace, CaseSymptom, CaseContact
from datetime import date
from cotect_endpoints.db_handler import GraphHandler
# add neo4j logging
from logging import getLogger, StreamHandler, DEBUG
# ```python
# from firebase_admin... | StarcoderdataPython |
3307678 | <gh_stars>0
# -*- coding: utf-8 -*-
# Copyright (c) 2018-2021 <NAME>
# api.wwdt.me is released under the terms of the Apache License 2.0
"""Locations Models"""
from typing import List, Optional
from pydantic import BaseModel, conint, Field
# region Location Models
class Location(BaseModel):
"""Location Informati... | StarcoderdataPython |
4835134 | <filename>FrameApp/falconApp/src/models/user.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
@author: rainsty
@file: user.py
@time: 2019-12-30 16:14:29
@description:
"""
from . import DBBase, Column, Integer, String
class User(DBBase):
__tablename__ = 'user'
id = Column('id', Integer, primary_key=True... | StarcoderdataPython |
166371 | <gh_stars>0
import pandas as pd
import re
//checked = input[(input['_raw'].str.contains(name, case=False))]
names = ['name1','name2']
for name in names:
infile = name + '.csv'
outfile = 'success-' + name + '.csv'
input = pd.read_csv(infile, sep=',')
checked = input
if not checked.empty:
success = checked[(che... | StarcoderdataPython |
4837062 | <reponame>bintulab/storm-analysis<filename>storm_analysis/diagnostics/slurm/analyze_data.py
#!/usr/bin/env python
"""
Analyze SLURM test data using Multiplane. We don't actually use
SLURM, instead we just analyze each movie sequentially.
Hazen 09/18
"""
import glob
import os
import time
import storm_analysis.multi_pl... | StarcoderdataPython |
3323769 | <gh_stars>1-10
""" MobileNet V3
A PyTorch impl of MobileNet-V3, compatible with TF weights from official impl.
Paper: Searching for MobileNetV3 - https://arxiv.org/abs/1905.02244
Hacked together by / Copyright 2020 <NAME>
"""
import torch.nn as nn
from src.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, I... | StarcoderdataPython |
3333893 | # The MIT License (MIT)
# Copyright (c) 2021-present foxwhite25
#
# 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, ... | StarcoderdataPython |
96851 | <reponame>anna-hope/python-firestore
# Copyright 2017 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
#
# Un... | StarcoderdataPython |
1726656 | <filename>Aulas/aula016.py
lanche = ('Hamburguer', 'Suco','Pizza','Pudim')
#print(lanche)
for comida in lanche:
print(f'Eu vou comer {comida}')
print('Comi pra caramba!')
#for cont in range (0, len(lanche)):
# print(f'Eu vou comer {lanche[cont]} na posição {cont}')
| StarcoderdataPython |
127614 | <filename>examples/synchronous/getting_started.py
from hiddb.synchronous import HIDDB
hiddb = HIDDB("<key>", "<secret>")
# Create a database via dashboard and insert the database_id here
database_id = "<database_id>"
# Create a collection named "wordvectors"
hiddb.create_collection(database_id=database_id, collecti... | StarcoderdataPython |
3298675 | <reponame>anishsingh42/CodeChef
t = int(input())
while t:
N = list(map(int, input().split()))
N.remove(len(N)-1)
print(max(N))
t = t-1 | StarcoderdataPython |
135831 | from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Game(models.Model): #Overall Game Object
name = models.CharField(max_length=200) #name of the game
start_time = models.DateTimeField() #time to start
end_time = models.DateTimeField() #time game ends
... | StarcoderdataPython |
3223969 | #!/sw/bin/python3.3
#! E:\Python33\python
#Read FASTA files from current directory, generate output txt file with values for features.
#30.6.2013 . Edited order of features generated, and bigrams from absolute to relative freq. + added length
#import Bio
#added features not yet put in featuregen classic
import... | StarcoderdataPython |
3244957 | <gh_stars>1-10
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from steerable.SCFpyr_NumPy import SCFpyr_NumPy
import steerable.utils as utils
import cv2
import torch
import torchvision
# img_size=256
img=cv2.imread("./assets/lena.jpg",0)
#... | StarcoderdataPython |
72540 | <filename>src/engineV2.py
escapeProtect = ""
def parseTag(line, skip=0):
skipNext = skip
split = line.replace("\:", "")
split = line.split(":")
for i in range(len(split)-1):
split[i] = split[i].replace("", ":")
split[i] = split[i].replace("\(", "")
split[0] = split[0].replace... | StarcoderdataPython |
3372898 | # -*- coding: utf-8 -*-
"""
Created on Wed Aug 24 17:23:10 2016
fun with compression
@author: mike
"""
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from sklearn import metrics
from scipy import ndimage
def meandist2points(image, kpoints):
length = np.max(np.shape(im... | StarcoderdataPython |
1709971 | # -*- coding: utf-8 -*-
import sys
import os
from os.path import join, dirname, abspath, exists
sys_path = dirname(dirname(abspath(__file__)))
parent_sys_path = dirname(sys_path)
if sys_path not in sys.path:
sys.path.insert(0, sys_path)
if parent_sys_path not in sys.path:
sys.path.insert(0, parent_sys_path)
... | StarcoderdataPython |
1678339 | import unittest
from src.CoordinateMatcher import CoordinateMatcher
class MyTestCase(unittest.TestCase):
def test_basics(self):
matcher = CoordinateMatcher('data/equivalence_table.csv')
input = {1: 105.43, 2: 48.97}
matcher.match_json_input(input)
def test_jsonfy(self):
matc... | StarcoderdataPython |
53148 | import os
import sys
import random
"""
Notes:
- Excellent attempt
"""
def main():
x = random.choices(range(5), k=20)
x0 = x.count(0)
x1 = x.count(1)
x2 = x.count(2)
x3 = x.count(3)
x4 = x.count(4)
print(f'x = {x}')
print(f'no. of zeroes = {x0}, no. of ones = {x1}, no. of twos = {x2}, ... | StarcoderdataPython |
179537 | """
Collection of Data Science helper functions
"""
import pandas as pd
import numpy as np
from sklearn.metrics import confusion_matrix
from sklearn.utils.multiclass import unique_labels
import seaborn as sns
def confusion_plot(y_true, y_pred, cmap='viridis'):
"""
Plots a confusion matrix using the Seaborn ... | StarcoderdataPython |
1753354 | <reponame>dlist-top/client-py
from datetime import datetime
class Timestamp(datetime):
@classmethod
def parse(cls, unix):
return datetime.utcfromtimestamp(unix / 1000)
| StarcoderdataPython |
172443 | # coding=utf-8
from setproctitle import setproctitle
from utils import SensorConsumerBase
import datetime
import os
import sys
import json
class Door(SensorConsumerBase):
def __init__(self, redis_host, redis_port):
SensorConsumerBase.__init__(self, redis_host=redis_host, redis_port=redis_port)
s... | StarcoderdataPython |
75488 | <filename>Lista02/Q06.py
#!/usr/bin/env python3
#-*- encoding: UTF-8 -*-
def main():
salario = float(input("Salário-hora: R$ "))
tempo = int(input("Quantidade de horas trabalhadas: "))
ir = (salario * tempo) * (11/100)
inss = (salario * tempo)* (8/100)
sindicato = (salario * tempo) * (5/100)
pr... | StarcoderdataPython |
3258532 | <reponame>Wealize/apminsight-site24x7-py
class DbMetric:
def __init__(self):
self.opn = ''
self.obj = ''
self.component = ''
self.errorct = 0
self.count = 0
self.time = 0
self.minrt = None
self.maxrt = None
def accumulate(self, dbtracker):
... | StarcoderdataPython |
1770754 | <filename>Forest-Type-Cover-Prediction/code.py<gh_stars>0
# --------------
import pandas as pd
from sklearn import preprocessing
#path : File path
# Code starts here
# read the dataset
dataset= pd.read_csv(path)
print(dataset.head())
dataset.drop(columns=['Id'],axis=1,inplace=True)
print(dataset.describe())
# lo... | StarcoderdataPython |
3271324 | <reponame>prodProject/WorkkerAndConsumerServer<gh_stars>0
# start
# get count
# done
from enum import Enum
from CommonCode.convertJSONTOPb import ConvertJSONToPb
from CommonCode.convertPbToJSON import ConvertPbToJSON
from CommonCode.queryExecutor import QueryExecuter
from Counter.workerCounter import WorkerCounter
from... | StarcoderdataPython |
115819 | from django.contrib import admin
from .models import Contact
class ContactAdmin(admin.ModelAdmin):
list_display = ('id', 'email_address', 'subject', 'created_on')
list_display_links = ('id', 'email_address')
search_fields = ('name_first', 'name_last', 'email_address')
list_per_page = 25
adm... | StarcoderdataPython |
1716095 | # -*- coding: utf-8 -*-
"""Pizza test."""
import unittest
from os import unlink
from main import read_input
from pizza_cell import Ingredient
input_file = 'test.in'
input_text = b'''3 5 1 6
TTTTT
TMMMT
TTTTT
'''
class PizzaTestCase(unittest.TestCase):
pizza = None
def setUp(self):
"""setUp test.
... | StarcoderdataPython |
1693952 | #!/usr/bin/python
from boto3.session import Session
import sys
import os
import uuid
import time
def get_env(name):
if name in os.environ:
return os.environ[name]
return None
aws_args = {
'aws_access_key_id': get_env('AWS_ACCESS_KEY'),
'aws_secret_access_key': get_env('AWS_SECRET_KEY'),
... | StarcoderdataPython |
3285538 | <reponame>craymichael/ArgValidation<gh_stars>0
# ======================================================================================================================
# Copyright 2016 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# th... | StarcoderdataPython |
1641715 | import numpy as np
from flipper25d.config import *
from flipper25d.util import *
from flipper25d.cspace.cspace import *
from flipper25d.vis.vis import rot_vector
import pdb
from scipy.misc import imsave
import sys
import os
'''
we use the left side S2 as the pivot
right side S2 can be uniquely defined ... | StarcoderdataPython |
1638880 | <filename>app/model/draw_statistics.py
# -*- coding: utf-8 -*-
from sqlalchemy import Column, ForeignKey
from sqlalchemy import String, Integer
from sqlalchemy.orm import relationship
from app.model import Base
class DrawStatistics(Base):
__tablename__ = 'draw_statistics'
holo_twitter_draw_id = Column(Inte... | StarcoderdataPython |
3343897 | <filename>ois_api_client/v3_0/dto/QueryInvoiceCheckResponse.py
from dataclasses import dataclass
from .BasicOnlineInvoiceResponse import BasicOnlineInvoiceResponse
@dataclass
class QueryInvoiceCheckResponse(BasicOnlineInvoiceResponse):
"""Response type of the POST /queryInvoiceCheck REST operation
:param inv... | StarcoderdataPython |
3302533 | import quickfix as fix
class Message(fix.Message):
def __init__(self):
fix.Message.__init__(self)
self.getHeader().setField( fix.BeginString("FIXT.1.1") )
class Heartbeat(Message):
def __init__(self):
Message.__init__(self)
self.getHeader().setField( fix.MsgType("0") )
class TestRequest(Message):
def __in... | StarcoderdataPython |
117546 | <reponame>clemenshage/grslra
import numpy as np
import grslra
from grslra.visualization import plot_lpnorm
from grslra.scaling import Scaling
from matplotlib import pyplot as plt
from grslra.grst import grst
from sys import argv
PROFILE = 0
if PROFILE:
import cProfile
m = 500
n = 5000
k = 5
omegasquared = 1e-5
... | StarcoderdataPython |
3203263 | <filename>migrations/versions/710c83b4682f_.py
"""empty message
Revision ID: 710c83b4682f
Revises:
Create Date: 2017-11-22 07:26:30.882578
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = None
branch_labels = None
depends_on = None
def... | StarcoderdataPython |
4819809 | <filename>demo2/advance.py
#!/usr/bin/env python
#coding:utf-8
'''
Created on 2017年5月5日
@author: 唐斌
'''
from collections import Iterable
import os
def demo1():
'''切片'''
a = [1, 'as', 2, 'd', 4, 'fg']
print(a[2:4])
print(a[-1::-1])
print(a)
'''迭代'''
''''判断对象是否可迭代'''
flag = isinstanc... | StarcoderdataPython |
56406 | import unittest
from forestgame.colour import colour_to_hex
class ToHexTest(unittest.TestCase):
def test_convert_solid_black(self):
hex_code = colour_to_hex((0, 0, 0))
self.assertEqual(hex_code, "#000000")
def test_convert_solid_whex_codeite(self):
hex_code = colour_to_hex((255, 255, 255))
self.a... | StarcoderdataPython |
1744721 | <filename>flink-ai-flow/ai_flow/test/endpoint/test_client.py
#
# 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 t... | StarcoderdataPython |
1709670 | <gh_stars>1-10
from .filetype import check_file_type
| StarcoderdataPython |
4825004 | <filename>src/pipeline_reader/objects.py
class Pipeline:
def __init__(self):
self.stages = []
self.options = []
def __str__(self):
return f'Pipeline(stages="{self.stages}", options="{self.options}")'
def __repr__(self):
return self.__str__()
class Stage:
def __init__(s... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.