id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
1671123 | <reponame>MattSkiff/cow_flow
'''This file configures the training procedure'''
proj_dir = "/home/matthew/Desktop/laptop_desktop/clones/cow_flow/data"
# device settings
import torch
import arguments as a
gpu = True
seed = 101
## Dataset Options ------
mnist = False
load_stored_dmaps = False # speeds up p... | StarcoderdataPython |
3250930 | from __future__ import absolute_import
from mock import patch
from sentry.mediators import sentry_apps
from sentry.mediators.sentry_app_installations import Creator, InstallationNotifier
from sentry.testutils import TestCase
class TestInstallationNotifier(TestCase):
def setUp(self):
super(TestInstallati... | StarcoderdataPython |
25980 | <reponame>talhakoylu/SummerInternshipBackend<gh_stars>1-10
# Generated by Django 3.2.5 on 2021-07-13 09:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('account', '0002_auto_20210712_1851'),
]
operations = [
migrations.AlterField(
... | StarcoderdataPython |
1630471 | from sklearn.decomposition import TruncatedSVD
from sklearn.decomposition import PCA
from sklearn.decomposition import LatentDirichletAllocation
import numpy as np
class Math:
def svd(self, data, k):
s = TruncatedSVD(n_components=k, n_iter=7, random_state=42)
d = s.fit(data)
components = d.components_
ev = d... | StarcoderdataPython |
69619 | <reponame>akrherz/iem-json-services
"""Models for currents API."""
# pylint: disable=no-name-in-module
from typing import List
from pydantic import BaseModel, Field
class ObHistoryDataItem(BaseModel):
"""Data Schema."""
utc_valid: str = Field(..., title="UTC Timestamp")
local_valid: str = Field(..., tit... | StarcoderdataPython |
1796386 | # -*- coding: utf-8 -*-
from logging import DEBUG, Formatter, Logger, StreamHandler, getLogger
def initialize_logging(name: str = __name__) -> Logger:
logger = getLogger(name)
logger.propagate = False
logger.setLevel(DEBUG)
handler = StreamHandler()
handler.setFormatter(
Formatter(
... | StarcoderdataPython |
176288 | <gh_stars>1-10
'''
This file should contain admin register
'''
from django.contrib import admin
from .models import (
Product,
PriceDateRange,
)
admin.site.register(Product)
admin.site.register(PriceDateRange)
# Register your models here.
| StarcoderdataPython |
29518 | PSQL_CONNECTION_PARAMS = {
'dbname': 'ifcb',
'user': '******',
'password': '******',
'host': '/var/run/postgresql/'
}
DATA_DIR = '/mnt/ifcb'
| StarcoderdataPython |
3340797 | <reponame>Prouser123/PyOS
# PyOS
# Made for Python 2.7
# programs/pwd.py
# Import Libraries
import os
# Import the base application class.
from internal.baseapp import BaseApp
class App(BaseApp):
def go(self, args):
print(self.Colors.Green("Current working directory: ") + self.Colors.Blue(os.getcwd()))
| StarcoderdataPython |
3233892 | <filename>pygraphml/tests/__init__.py
def run_all():
import nose2
nose2.discover(module='pygraphml')
__all__ = [run_all]
| StarcoderdataPython |
4813895 | <reponame>austinbeauch/log_roller
import unittest
import os
from log_roller import roller
from urllib.error import HTTPError
from ..error import NoneError
class RollerTest(unittest.TestCase):
def setUp(self):
self.file1 = 'log_1.log'
self.filebad = 'log_55.log'
self.server = 'https://web.u... | StarcoderdataPython |
3301378 | <filename>src/jflow/git.py
#!/usr/bin/python3
# -*- mode: python; coding: utf-8 -*-
import contextlib
import os
import re
import subprocess
import jflow
from jflow import run
class Error(Exception):
'''Base class for errors in the module.'''
# Full history:
# git rev-list --pretty='format:parents %P%nrefs %D%... | StarcoderdataPython |
1756465 | <reponame>brot/yesss-bill-downloader
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class YesssBillItem(scrapy.Item):
date = scrapy.Field()
date_raw = scrapy.Field()
date_formatted = scra... | StarcoderdataPython |
172268 | import tensorflow as tf
from tensorflow.keras.layers.experimental.preprocessing import (
CenterCrop,
Rescaling,
Resizing,
)
import tensorflow_io as tfio
from utils import get_frozen_params, get_params
MIN_RESIZE = {
112: 128,
128: 224,
224: 256,
256: 256,
}
class DataPreprocessor():
... | StarcoderdataPython |
1720940 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `ppanalyzer` package."""
from click.testing import CliRunner
from ppanalyzer import cli, get_app
def test_command_line_interface():
"""Test the CLI."""
runner = CliRunner()
help_result = runner.invoke(cli.main, ['--help'])
assert... | StarcoderdataPython |
3390882 | from django.conf.urls import url
from djoser import views
urlpatterns = [
url(r"^token/login/?$", views.TokenCreateView.as_view(), name="login"),
url(r"^token/logout/?$", views.TokenDestroyView.as_view(), name="logout"),
]
| StarcoderdataPython |
3283214 | <filename>bookedrooms/admin.py
from django.contrib import admin
from .models import BookedRoom
class BookRoomsAdmin(admin.ModelAdmin):
model = BookedRoom
list_display = ['id', 'start_date', 'end_date',
'user', 'room_category', 'nbr_of_rooms', 'total_cost']
readonly_fields = ('total_cos... | StarcoderdataPython |
1657876 | # Copyright (c) 2021, <NAME>
# 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 copyright notice, this
# list of conditions and the foll... | StarcoderdataPython |
1785852 | # Generated by Django 2.1.1 on 2018-11-01 19:23
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api', '0003_auto_20181009_0211'),
]
operations = [
migrations.CreateModel(
name='Points',
... | StarcoderdataPython |
1769101 | from dataiku.runnables import Runnable
import dataiku
import urllib2, sys
import requests
import json
import os
import dl_image_toolbox_utils as utils
import pandas as pd
import constants
import time
# We deactivate GPU for this script, because all the methods only need to
# fetch information about model and do not m... | StarcoderdataPython |
1784944 | <reponame>politbuero-kampagnen/onegov-cloud
import mimetypes
import shutil
import os
from collections import OrderedDict
from onegov.core.csv import convert_list_of_dicts_to_csv
from onegov.core.csv import convert_list_of_dicts_to_xlsx
from onegov.core.csv import convert_excel_to_csv
from onegov.core.csv import CSVFil... | StarcoderdataPython |
3212181 | <gh_stars>0
from keras import backend as K
from i3d_inception import Inception_Inflated3d
from i3d_generator import i3d_generator
import h5py
from keras.models import Model, load_model
from keras.layers import Reshape
from keras.layers import Dense
from keras.layers import Conv3D, Conv1D, Conv2D, Lambda
from keras.lay... | StarcoderdataPython |
1786272 | <gh_stars>1-10
# Copyright 2015 Novo Nordisk Foundation Center for Biosustainability, DTU.
# 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
# Unle... | StarcoderdataPython |
3239546 | <filename>tests/web_platform/CSS2/box_display/test_delete_block_in_inlines_middle.py
from tests.utils import W3CTestCase
class TestDeleteBlockInInlinesMiddle(W3CTestCase):
vars().update(W3CTestCase.find_tests(__file__, 'delete-block-in-inlines-middle-'))
| StarcoderdataPython |
25018 | <gh_stars>0
import numpy as np
import cv2
import matplotlib.pyplot as plt
from pathlib import Path
import glob2 as glob
import os
import sys
savedir = "./output/"
def AddWatermarkFolder(str_foldername, str_watermarkname, alpha1=1.0, alpha2=0.2):
path = str_foldername + '/*.png*'
for iter, path_name in enumera... | StarcoderdataPython |
3308184 | import os
import unittest
import numpy as np
import pandas as pd
from scripts import FilePaths
from scripts.filter_terms import FilterTerms
from scripts.terms_graph import TermsGraph
from scripts.text_processing import StemTokenizer
from scripts.tfidf_mask import TfidfMask
from scripts.tfidf_reduce import TfidfReduce... | StarcoderdataPython |
3316856 | <filename>plusseg/config/defaults.py
# Copyright (c) ShanghaiTech PLUS Lab. All Rights Reserved.
import os
from yacs.config import CfgNode as CN
_C = CN()
# -----------------------------------------------------------------------------
# INPUT
# ----------------------------------------------------------------------... | StarcoderdataPython |
4819517 | # Code for "TSM: Temporal Shift Module for Efficient Video Understanding"
# arXiv:1811.08383
# <NAME>*, <NAME>, <NAME>
# {jilin, <EMAIL>, <EMAIL>
import pdb
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
import sys
sys.path.append("..")
from archs import repvgg
class TemporalSh... | StarcoderdataPython |
1695178 | #!/usr/bin/python
#
# Copyright (c) 2016, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of con... | StarcoderdataPython |
3352760 | from bots.abstract import AbstractBot
class MMBase(AbstractBot):
def __init__(self, pair, window_size=20, test=True, test_start="20211201", start_jpy=1000):
super().__init__(window_size, test, start_jpy, test_start, pair)
self.LOT = 3.0 # 取引量
self.SPREAD_ENTRY = 0.0005
self.SPRE... | StarcoderdataPython |
3206912 | <filename>coffeenijuan/management/urls.py
from django.urls import path
from . import views
app_name = "management"
urlpatterns = [
path('management/', views.login, name='login'),
path('management/login', views.login, name='login'),
path('management/overview', views.overview, name='overview'),
path('ma... | StarcoderdataPython |
1738142 | import sys
from pathlib import Path
from poetry.factory import Factory
from poetry.utils.env import EnvManager
def run_script(env, script, args):
module, callable_ = script.split(":")
# src_in_sys_path = "sys.path.append('src'); " if self._module.is_in_src() else ""
cmd = ["python", "-c"]
cmd += [
... | StarcoderdataPython |
3309228 | <gh_stars>1-10
__author__ = '<NAME>' | StarcoderdataPython |
4828611 | <reponame>toert/django-shop-template<gh_stars>1-10
from django.shortcuts import render, redirect, get_object_or_404
from django.views.decorators.http import require_POST
from catalog.models import Product
from .session_cart import Cart
from .forms import CartAddProductForm
#from cart.forms import CartQuantityProduct
... | StarcoderdataPython |
72212 | #!/usr/bin/env python3
# SonicScrewdriver.py
# Version January 1, 2015
def addtodict(word, count, lexicon):
'''Adds an integer (count) to dictionary (lexicon) under
the key (word), or increments lexicon[word] if key present. '''
if word in lexicon:
lexicon[word] += count
else:
lexicon[word] = count
def appe... | StarcoderdataPython |
3200780 | import pandas as pd
import numpy as np
import glob
import os
import sys
ori_stdout = sys.stdout
f = open('parser_log', 'w')
sys.stdout=f
CLA_DIR = "./CLASS_WISE/"
if not os.path.exists(CLA_DIR):
os.mkdir(CLA_DIR)
file_list = glob.glob("./RAW/data.csv")
print(file_list)
total_data = pd.DataFrame()
for ff in file... | StarcoderdataPython |
193994 | <gh_stars>0
# py-motmetrics - Metrics for multiple object tracker (MOT) benchmarking.
# https://github.com/cheind/py-motmetrics/
#
# MIT License
# Copyright (c) 2017-2020 <NAME>, <NAME> and others.
# See LICENSE file for terms.
"""Obtain metrics from event logs."""
# pylint: disable=redefined-outer-name
from __futur... | StarcoderdataPython |
3332568 | """Render an overlay on a background image, and display on the
inky pHAT.
"""
import datetime
import os
import sys
from subprocess import check_output
import requests
import inkyphat
from PIL import Image, ImageDraw, ImageFont
WHITE = 0
BLACK = 1
RED = 2
WIDTH = 212
HEIGHT = 104
def dump_image():
im = Image.... | StarcoderdataPython |
3212683 | #!/usr/bin/env python
import hiyapyco
import re
# Currently the entrypoint.sh uses arguments that are ignored in this file.
# https://github.com/zerwes/hiyapyco/blob/master/examples/hiyapyco_example.py
merged_yaml = hiyapyco.load('/etc/home-assistant/default-configuration.yaml', '/config/custom-configuration.yaml', m... | StarcoderdataPython |
133718 | #!/usr/bin/env python
# Copyright 2017, 2018 Google, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... | StarcoderdataPython |
3238058 | <reponame>DamovisaOrg/azureml-v2-preview
import pytest
import json
from pytest_mock import MockFixture
from unittest.mock import Mock, patch
from azure.identity import DefaultAzureCredential
from azure.ml.constants import ONLINE_ENDPOINT_TYPE
from azure.ml._arm_deployments.online_endpoint_arm_generator import OnlineEnd... | StarcoderdataPython |
1632280 | <gh_stars>0
# AristaFlow REST Libraries
from af_process_image_renderer import RenderOptions
from af_process_image_renderer.api.process_image_renderer_api import ProcessImageRendererApi
from aristaflow.abstract_service import AbstractService
class ImageRendererService(AbstractService):
def get_process_image_insta... | StarcoderdataPython |
4807142 | #############################################
# PDNS API IP to DNS Name
#
# Author: <NAME>
# Email: <EMAIL>
# Date: 11/06/2015
#############################################
import sys
import json
import pypdns
from pdns_util import *
if __name__ == '__main__':
ip = sys.argv[1]
mt = MaltegoTransform()... | StarcoderdataPython |
4830480 | <filename>Render2018/lib/colorbar.py
import matplotlib.pyplot as plt
import matplotlib as mpl
def export_colorbar(bound_min, bound_max, output_dir):
"""
Save an image of the Inferno colorbar with numbers on it, given minimum and maximum bounds.
:param bound_min: Minimum colorbar value
:param bound_max:... | StarcoderdataPython |
3238198 | from typing import Optional, AsyncGenerator
import mimetypes
import shutil
import json
from stat import S_ISDIR
from pathlib import Path
import aiofiles
from aiofiles.os import stat as aio_stat
from asgi_webdav.constants import (
DAVPath,
DAVDepth,
DAVPropertyIdentity,
DAVPropertyPatches,
DAVProp... | StarcoderdataPython |
48772 | <reponame>BDEvan5/SuperSafety
import yaml
import csv
import os
from argparse import Namespace
import shutil
import numpy as np
from numba import njit
# Admin functions
def save_conf_dict(dictionary, save_name=None):
if save_name is None:
save_name = dictionary["agent_name"]
path = dictionary["vehic... | StarcoderdataPython |
1665801 | <filename>_modules/utils/dateparse/parse_date/tests.py
#!/usr/bin/env python
from django.utils.dateparse import parse_date
"""
https://docs.djangoproject.com/en/dev/ref/utils/#module-django.utils.dateparse
parse_date(value)
"""
print(
parse_date("2010-10-10"),
)
| StarcoderdataPython |
1710157 | import copy
import sortedcontainers
import numbers
class Intervals:
"""
Class used to represent complex intervals
This class is used to represent periods of existence of nodes and edges. Nodes and edges can exist during
not continuous periods (e.g., from time 2 to 5, and from time 7 to 8). Those inter... | StarcoderdataPython |
1731967 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
# <NAME> (UNI:rb3074)
# Columbia University, New York
# ELEN E6889, Spring 2019
#
#——————————————————————————————————————————————————————————————————————————————
from __future__ import print_function
import time
import logging
from collections import namedtuple
from ppri... | StarcoderdataPython |
3363631 | <filename>operator-pipeline-images/tests/entrypoints/test_marketplace_replication.py<gh_stars>1-10
import pytest
from typing import Any
from unittest.mock import MagicMock, patch
from operatorcert.entrypoints import marketplace_replication
@patch("operatorcert.entrypoints.marketplace_replication.setup_argparser")
@p... | StarcoderdataPython |
1639551 | #! /usr/bin/env python3
# multiplication_table.py - generates NxN multiplication table as spreadsheet
import sys
import openpyxl
from openpyxl.styles import Font, Border, PatternFill, Side, Alignment
# values used for formatting
bold = Font(bold=True)
center = Alignment(horizontal='center', vertical='center')
thick ... | StarcoderdataPython |
1765351 | <gh_stars>0
#!/usr/bin/env python
"""Rasterio command line interface"""
import functools
import json
import logging
import os.path
import pprint
import sys
import warnings
import click
import rasterio
from rasterio.rio.cli import cli
from rasterio.rio.info import info
from rasterio.rio.merge import merge
warning... | StarcoderdataPython |
134413 | <reponame>FrankMillman/AccInABox<filename>aib/init/fin_reports/tb_bf_maj.py
module_id = 'gl'
report_name = 'tb_bf_maj'
table_name = 'gl_totals'
report_type = 'bf_cf'
groups = []
groups.append([
'code', # dim
['code_maj', []], # grp_name, filter
])
include_zeros = True
# allow_select_loc_fun = True
expan... | StarcoderdataPython |
3311338 | <reponame>charlie219/CSES-Solutions<gh_stars>0
from sys import stdin, stdout
def input():
return stdin.readline().rstrip()
def b(a):
l=0
r=k
while(r>l+1):
m=(l+r)//2
if(c[m]<=a):
l=m
else:
r=m
return r
n,k=map(int,input().split())... | StarcoderdataPython |
3238479 | import numpy as np
import pandas as pd
excel_file = "../data/AtmosphericModelValues.xlsx"
tabulated_values = pd.read_excel(excel_file, engine="openpyxl")
def atmosphere_density(altitude):
z = altitude # [km] (Need to work in km due to given data format)
bins = tabulated_values["Altitude Lower Bound (km)"].v... | StarcoderdataPython |
4839809 | #*----------------------------------------------------------------------------*
#* Copyright (C) 2021 Politecnico di Torino, Italy *
#* SPDX-License-Identifier: Apache-2.0 *
#* *
... | StarcoderdataPython |
40566 | <reponame>jhwnkim/nanopores<filename>nanopores/scripts/ahemIV.py
import math, nanopores, dolfin
# @Benjamin, Gregor TODO:
# -) check permittivity and surface charge of ahem
# -) what biased voltage to use?
# some default values for parameters
### geo params [nm]
geo_name = "aHem"
domscale = 1.
l4 = 15.
l3 = 15.
R = ... | StarcoderdataPython |
3356575 | <filename>whoosh/lang/lovins.py
"""This module implements the Lovins stemming algorithm. Use the ``stem()``
function::
stemmed_word = stem(word)
"""
from whoosh.util.collections2 import defaultdict
# Conditions
def A(base):
# A No restrictions on stem
return True
def B(base):
# B Minimum stem l... | StarcoderdataPython |
3270976 | import tkinter
import sys
import getopt
import time
import threading
import os
import random
import enum
import racemap
import racecar
import racecolor
def callback(event):
""" Reacts to a user click on the window """
# switch on the status
global status
# if still initializing, ignore the click and don't do a... | StarcoderdataPython |
1719880 | import pickle
import binascii
from parallelm.mlops.mlops_exception import MLOpsException
from parallelm.mlops.stats_category import StatGraphType, StatsMode
from parallelm.mlops.stats.mlops_stat import MLOpsStat
from parallelm.mlops.stats.mlops_stat_getter import MLOpsStatGetter
from parallelm.protobuf import InfoTyp... | StarcoderdataPython |
3243759 | <gh_stars>1-10
from .. import DB_BASE as Base
from sqlalchemy import Column, Integer, Sequence, Text
class BlogInfoORM(Base):
__tablename__ = 'tb_blog_info'
__table_args__ = {'comment': '博客简介信息表'}
id = Column(Integer, Sequence("tb_blog_info_id_seq"), primary_key=True)
about_content = Column(Text, ... | StarcoderdataPython |
156171 | <filename>odoo/base-addons/website_sale_stock/models/product_template.py
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models, api
class ProductTemplate(models.Model):
_inherit = 'product.template'
inventory_availability = fields.... | StarcoderdataPython |
151393 | <filename>setup.py<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from setuptools.command.install import install
from distutils.extension import Extension
try:
from Cython.Distutils import build_ext
cython_present = True
except ImportError:
cython_pr... | StarcoderdataPython |
1678452 | import sys
import subprocess
import pkg_resources
required = {'iterative-stratification', 'pytorch-tabnet', 'umap-learn', 'scikit-learn', 'matplotlib', 'seaborn',
'https://github.com/Phlya/adjustText/archive/master.zip','pandas','numpy', 'scikit-multilearn', 'cmappy'}
installed = {pkg.key for pkg in pkg_r... | StarcoderdataPython |
3229636 | <reponame>serdtsekol1/django-modeltranslation
# -*- coding: utf-8 -*-
try:
from django.conf.urls import include, patterns, url
# Workaround for pyflakes issue #13
assert (include, patterns, url) # noqa
except ImportError: # Django 1.3 fallback
from django.conf.urls.defaults import include, patterns, ... | StarcoderdataPython |
3336416 | import discord
import os
import asyncio
import prismapy
from discord.ext import commands
from discord.utils import get
import logging
#import database
from discord.utils import find
'''
logging.basicConfig(level=logging.DEBUG)
loop = asyncio.get_event_loop()
loop.create_task(database.prepare_tables())
''... | StarcoderdataPython |
4810103 | __author__ = 'alisonbnt'
import src.base.arrayparsableentity as parsable
class HomeShellParam(parsable.ArrayParsableEntity):
def __init__(self, param_id=0, name=None):
self.id = param_id
self.name = name
def to_array(self):
return {
'id': self.id,
'name': se... | StarcoderdataPython |
4834698 | <filename>streaming_api/__init__.py
# coding: utf-8
import urllib2
import oauth2
def filter(APIKEYS, params):
consumer = oauth2.Consumer(
key=APIKEYS['CONSUMER'], secret=APIKEYS['CONSUMER_SECRET'])
token = oauth2.Token(
key=APIKEYS['ACCESS_TOKEN'], secret=APIKEYS['ACCESS_TOKEN_SECRET'])
u... | StarcoderdataPython |
1667482 | import os
import numpy as np
import keras
from keras.callbacks import EarlyStopping
from sklearn.utils import shuffle
from src.util import load_wm_model_from_file, save_wm_model_to_file, \
load_blackbox_model_from_file, save_blackbox_model_to_file, merge_histories, predict_with_uncertainty
from src.models import g... | StarcoderdataPython |
81326 |
from string import Template
my_string = Template('Data science has been called $identifier')
my_string.substitute(identifier="sexiest job of the 21st century")
job= "Datascience"
name ="sexiest job of the 21st century"
my_string2= Template('$title has been called $description')
my_string2.substitute(title=job, desc... | StarcoderdataPython |
3283263 | <filename>base64_rot13_decode.py
import argparse, base64, codecs, os, sys
__auth__ = '<EMAIL>'
def __parse_args__():
"""Parse CLI arguments.
"""
parser = argparse.ArgumentParser(description='Path to a file containing a string that is Base64 encoded and ROT13 encoded.')
parser.add_argument('-f', dest... | StarcoderdataPython |
1645883 | <gh_stars>0
import os, sys
import numpy as np
from model import *
from encoder import *
import tensorflow as tf
def split_data(data_dir, test_split=.2):
files = os.listdir(data_dir)
train_dir = os.path.join(data_dir, 'train')
os.mkdir(train_dir)
test_dir = os.path.join(data_dir, 'test')
os.mkdir(t... | StarcoderdataPython |
121719 | import imp, os, glob
import pandas as pd
from astropy.table import Table, join, unique
from find_streams_plots import *
from find_streams_analysis import *
from find_streams_analysis_functions import *
from sys import argv
imp.load_source('helper', '../tSNE_test/helper_functions.py')
from helper import move_to_dir
i... | StarcoderdataPython |
113767 | import numpy as np
import pandas as pd
from sklearn import preprocessing
def get_data():
# Read excel file
File = pd.ExcelFile('data.xlsx')
File.sheet_names
df = File.parse('D1')
# seprate data and label
# x = np.array(df.drop(['label'],1))
# y = np.array(df['label'])
# preprocessing
... | StarcoderdataPython |
1755578 | from passlib.hash import nthash as passlib_nthash, lmhash as passlib_lmhash
from ldaptor import config
def nthash(password=b""):
"""Generates nt md4 password hash for a given password."""
return passlib_nthash.hash(password[:128]).encode("ascii").upper()
def lmhash_locked(password=b""):
"""
Generat... | StarcoderdataPython |
1777297 | <filename>tests/token/test_initialization.py<gh_stars>1-10
import pytest
from ..token_classes import (
OfflineToken,
OnlineToken,
PrivateToken,
offline_token_data,
online_token_data,
test_information,
)
@pytest.mark.asyncio
async def test_online_token():
# Create a new token
online_to... | StarcoderdataPython |
86918 | import argparse, os, shutil, tempfile
from os.path import basename, exists, join
from ..common import PackageBuilder, ProfileManagement, RecipeCache, Utility
from .update import update
# The default username used when building packages
DEFAULT_USER = 'adamrehn'
def build(manager, argv):
# Our supported command-lin... | StarcoderdataPython |
3269116 | def get_user_access_token():
"""Get the secret access token of the currently-logged-in Google user, for use with the Google REST API. Requires
this app to have its own Google client ID and secret. """
pass
def get_user_email():
"""Get the email address of the currently-logged-in Google user.To log in ... | StarcoderdataPython |
3385870 | import heapq
class Stack:
'''A stack implementation using a heap
>>> a = Stack()
>>> a.push(2)
>>> a.push(1)
>>> a.push(3)
>>> a.pop()
3
>>> a.push(4)
>>> a.pop()
4
>>> a.pop(), a.pop()
(1, 2)
'''
def __init__(self):
self.heap = []
self.curval =... | StarcoderdataPython |
1727363 | <filename>scripts/dhp19/generate_DHP19/Python_Files/extract_from_aedat.py
### File created by preshma
import numpy as np
from HotPixelFilter import HotPixelFilter
from BackgroundFilter import BackgroundFilter
from maskRegionFilter import maskRegionFilter
import functools
def extract_from_aedat(aedat, events, startTime... | StarcoderdataPython |
3250943 | <reponame>GYosifov88/Python-Fundamentals
initial_loot = input().split("|")
average_gain = 0
stolen_list = []
command = input()
treasury_hunt_not_failed = True
while command != "Yohoho!":
action = command.split(' ')
current_action = action.pop(0)
if current_action == 'Loot':
for i in action:
... | StarcoderdataPython |
115964 | <filename>main.py
import sys
from pidash.pidash import PiDash
from machine import Pin
#using absolute path here to import for testing
dashinit = PiDash()
value = 0
def increasespeed(value):
return value + 1
def decreasespeed(value):
return value - 1
dashinit.sen0105.irq(trigger=Pin.IRQ_RISING, handler=da... | StarcoderdataPython |
3273989 | <filename>tests/pc/routines/lib/routines.py
import time
def senser(sensor, sensor_stream, w_time=.1):
'''
Distance sensor thread routine
'''
while 1:
# We get the value from the sensor
new_val = sensor.distance_cm()
# Append it to the stream
sensor_stream.append(new_val... | StarcoderdataPython |
65982 | # uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: _ModuleToggle.py
import dsz
import dsz.lp
import dsz.user
import dsz.script
import dsz.data
import sys
import xml.dom.minidom
import re
import os
Act... | StarcoderdataPython |
3229686 | <reponame>Scalingo/patroni
from __future__ import absolute_import
import datetime
import functools
import json
import logging
import socket
import sys
import time
from kubernetes import client as k8s_client, config as k8s_config, watch as k8s_watch
from patroni.dcs import AbstractDCS, ClusterConfig, Cluster, Failover,... | StarcoderdataPython |
1606749 | <reponame>neurospin/nipy
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
An implementation of the dimension info as desribed in
http://nifti.nimh.nih.gov/pub/dist/src/niftilib/nifti1.h
In particular, it allows one to take a (possibly 4 or higher-d... | StarcoderdataPython |
3353266 | <reponame>enthought/etsproxy
# proxy module
from __future__ import absolute_import
from envisage.ui.single_project.project_action import *
| StarcoderdataPython |
26211 | # -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 <NAME>
# Licensed under the terms of the MIT License
# (see spyderlib/__init__.py for details)
"""Debug utilities"""
import inspect
import traceback
import time
def log_time(fd):
timestr = "Logging time: %s" % time.ctime(time.time())
print >>f... | StarcoderdataPython |
62550 | <filename>sweet/common/tf_utils.py
import tensorflow as tf
import torch
def tf_check_cpu_gpu():
print(('Is your GPU available for use?\n{0}').format(
'Yes, your GPU is available: True' if tf.test.is_gpu_available() else 'No, your GPU is NOT available: False'
))
print(('\nYour devices that are ava... | StarcoderdataPython |
3225097 | <reponame>michaeleisel/rules_apple<filename>tools/xctoolrunner/xctoolrunner.py<gh_stars>0
# Lint as: python2, python3
# Copyright 2018 The Bazel 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 ... | StarcoderdataPython |
1665803 | <gh_stars>0
import os
import click
from mlcube import parse # Do not remove (it registers schemas on import)
from mlcube.common import mlcube_metadata
from mlcube.common import objects
from mlcube.common.objects import platform_config
from mlcube_singularity.singularity_run import SingularityRun
@click.group(name='... | StarcoderdataPython |
98731 | #!/bin/env python
# 2020/01/21
# Convolution Neural Network
# <NAME> <<EMAIL>>
# 07-neural_networks/04-cnn-src/CatsDogsCommon.py
import os, cv2, regex, random
ASSETS_DIR = '../04-cnn-assets/'
IMG_DIR = ASSETS_DIR + 'img/'
BATCH_SIZE = 16
IMG_W = 150
IMG_H = 150
def atoi (text):
return int (text) if text.isdig... | StarcoderdataPython |
163515 | <filename>clearstack/templates/nova_compute.py
#
# Copyright (c) 2015 Intel Corporation
#
# Author: <NAME> <<EMAIL>>
# Author: <NAME> <<EMAIL>>
# Author: <NAME> <<EMAIL>>
# Author: <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with ... | StarcoderdataPython |
3308409 | #!/bin/env python3
# coding:utf-8
class Triangle:
@staticmethod
def get_area(side_a, side_b, side_c):
if not Triangle.is_triangle_valid(side_a, side_b, side_c):
raise Exception('invalid triangle')
p = (side_a + side_b + side_c) / 2
area = pow(p * (p - side_a) * (p - sid... | StarcoderdataPython |
97607 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# This program is dedicated to the public domain under the CC0 license.
"""
Simple Bot to reply to Telegram messages.
First, a few handler functions are defined. Then, those functions are passed to
the Dispatcher and registered at their respective places.
Then, the bot is ... | StarcoderdataPython |
67011 | <filename>Proyecto2/.ipynb_checkpoints/tetriss-checkpoint.py
"""
- Al menos un ente que se pueda sin ambigüedad llamar protagonista (LISTO)
- Definiendo un estado como la colección de variables en memoria
necesarios para describir todos los entes del juego,
se requiere que se tenga un número de estados no idénticos
... | StarcoderdataPython |
94886 | <filename>shipment_redis/Redis/RedisHandler.py
import threading
import redis
from web3.auto import w3
class RedisHandler:
def __init__(self):
self.redis_client = redis.Redis(host='localhost', port=6379, db=0)
self.redis_pub_sub = redis.StrictRedis(host='localhost', port=6379)
self.subscri... | StarcoderdataPython |
17229 | <reponame>bedrin/keyboard_mouse_emulate_on_raspberry<filename>btk_server.py
#!/usr/bin/python3
from __future__ import absolute_import, print_function
from optparse import OptionParser, make_option
import os
import sys
import uuid
import dbus
import dbus.service
import dbus.mainloop.glib
import time
import socket
from ... | StarcoderdataPython |
5760 | <gh_stars>10-100
# Tool Imports
from bph.tools.windows.capturebat import BphCaptureBat as CaptureBat
# Core Imports
from bph.core.server.template import BphTemplateServer as TemplateServer
from bph.core.sample import BphSample as Sample
from bph.core.sample import BphLabFile as LabFile
from bph.core.session imp... | StarcoderdataPython |
191600 | # coding=utf-8
# Copyright 2020 The TwoBlock AI.
#
# <EMAIL>, <EMAIL>
from ctypes import *
moran = CDLL('/usr/local/moran/libmoran4dnlp.so')
moran.Moran4dnlp.restype=c_char_p
moran.Moran4dnlp.argtypes=[c_char_p, c_char_p, c_int]
moran.Moran4match.restype=c_char_p
moran.Moran4match.argtypes=[c_char_p, c_char_p, c_ch... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.