id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3377378 | <gh_stars>1-10
# AUTOGENERATED! DO NOT EDIT! File to edit: 01_image_classification.ipynb (unless otherwise specified).
__all__ = ['data']
# Cell
from fastai.vision.all import *
# Cell
data = DataBlock(blocks = (ImageBlock, CategoryBlock),
get_items = get_image_files,
get_y = parent_... | StarcoderdataPython |
1625880 | <reponame>Heyjoy/P3<filename>datafield.py<gh_stars>0
import math
# models hyperParmeter
TrainTestSplitSize = 0.2
N_EPOCH = 20
Verbose = 1
BatchSize = 64
zeroSteeringCount = 3
#GaussianNoiseStddev = 1
# Imgae Process tuning paramter
IMGPath = '../data/IMG/'
CSVPath = '../data/driving_log.csv'
ImgShape = [160, 320, 3... | StarcoderdataPython |
45432 | <reponame>pep7/GorillaBot
# Copyright (c) 2013-2016 <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,... | StarcoderdataPython |
1649956 | <reponame>jdmartinez36/azure-batch-cli-extensions
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ------------------... | StarcoderdataPython |
128922 | <reponame>Tiago-S-Ribeiro/Python-Pro-Bootcamp<filename>100_days_of_code/Intermediate+/day_37/main.py
import requests
import datetime as dt
from data import USER, TOKEN, G_ID, PXL_ENDPOINT, NEW_PIXEL_ENDPOINT, GRAPH_ENDPOINT
headers = {
"X-USER-TOKEN": TOKEN
}
today = dt.datetime.now()
#------------------- Create... | StarcoderdataPython |
3251212 | from .directory import DirectoryClient
from .organization import OrganizationClient
from .service import ServiceClient
| StarcoderdataPython |
1768653 | import discord
import secrets
import itertools
import random
import re
import os
from keepAlive import keep_alive
import requests
import json
client = discord.Client()
prefix = '&'
diceTypes = [4,6,8,10,12,20,100]
dnd5e_races = ["DragonBorn", "Dwarf", "Elf", "Gnome", "Half-Elf", "Halfing", "Half-Orc", "Human", "Tief... | StarcoderdataPython |
152736 | '''
defines all the sources necessary for building cgui.pyd
'''
import os
BUILD_BUDDYLIST_GUI = False
thisdir = os.path.dirname(os.path.abspath(__file__))
sources = '''
src/ctextutil.cpp
src/SplitImage4.cpp
src/ScrollWindow.cpp
src/skinvlist.cpp
src/pyutils.cpp
src/cwindowfx.cpp
... | StarcoderdataPython |
1691462 | from http.server import HTTPServer, SimpleHTTPRequestHandler
class MyHTTPRequestHandler(SimpleHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.end_headers()
self.wfile.write(b"hi there")
if __name__ == '__main__':
server_address = ('127.0.0.1', 8000)
httpd = HT... | StarcoderdataPython |
1684312 | #!/usr/bin/env python
"""
TAP protocol client library.
Copyright (c) 2010 <NAME> <<EMAIL>>
"""
import socket
import string
import random
import struct
import asyncore
import mc_bin_server
import mc_bin_client
from memcacheConstants import REQ_MAGIC_BYTE, RES_MAGIC_BYTE
from memcacheConstants import REQ_PKT_FMT, RE... | StarcoderdataPython |
3281548 | <gh_stars>1000+
#!/usr/bin/python3
"""
[[https://bluemaestro.com/products/product-details/bluetooth-environmental-monitor-and-logger][Bluemaestro]] temperature/humidity/pressure monitor
"""
# todo most of it belongs to DAL... but considering so few people use it I didn't bother for now
from datetime import datetime, t... | StarcoderdataPython |
68495 | import datetime
from ..dojo_test_case import DojoTestCase
from dojo.models import Test
from dojo.tools.acunetix.parser import AcunetixParser
class TestAcunetixParser(DojoTestCase):
def test_parse_file_with_one_finding(self):
testfile = open("unittests/scans/acunetix/one_finding.xml")
parser = Ac... | StarcoderdataPython |
1625657 | # This module is used to map the old Python 2 names to the new names used in
# Python 3 for the pickle module. This needed to make pickle streams
# generated with Python 2 loadable by Python 3.
# This is a copy of lib2to3.fixes.fix_imports.MAPPING. We cannot import
# lib2to3 and use the mapping defined there, becaus... | StarcoderdataPython |
4813743 | <reponame>Shea192/pytorch-lightning<gh_stars>1-10
import torch
from pytorch_lightning import Trainer
from tests.base import EvalModelTemplate
import tests.base.utils as tutils
def test_training_epoch_end_metrics_collection(tmpdir):
""" Test that progress bar metrics also get collected at the end of an epoch. ""... | StarcoderdataPython |
25897 | <reponame>nvuillam/checkov<filename>tests/cloudformation/graph_builder/test_local_graph.py
import os
from unittest import TestCase
from checkov.cloudformation.graph_builder.graph_components.block_types import BlockType
from checkov.cloudformation.graph_builder.local_graph import CloudformationLocalGraph
from checkov.c... | StarcoderdataPython |
3293553 | # -*- coding: utf-8 -*-
from argh.decorators import arg
from lain_sdk.util import warn, info
from lain_cli.utils import get_version_lists, lain_yaml, check_phase, ClusterConfig
@arg('phase', help="lain cluster phase id, can be added by lain config save")
@arg('-r', '--registry', help='registry url')
def appversion(p... | StarcoderdataPython |
3285051 | #!/usr/bin/env python
import sys
#from heapq import heappush, heappop, heapify
from random import randint, choice, seed
try:
import numpy
#import scipy.sparse.linalg as la
except ImportError:
print("numpy not found")
if sys.version_info.major>=3:
long = int
from bruhat.util import write
class Poi... | StarcoderdataPython |
89200 | <reponame>subaruclover/apis-fixed<filename>plots_fixed.py<gh_stars>0
"""
Show the results of different acc with plots
input data files: .csv files with one week data from sample data
House ID: E001 ~ E004
created by Qiong
TODO: plot the sample data (from apis-emulator/data/input/Sample) and compare it with our acc dat... | StarcoderdataPython |
1622599 | #!/usr/bin/python2
# -*- coding: utf-8 -*-
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import glob, csv, librosa, os, subprocess, time
import numpy as np
import pandas as pd
import data_vn
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
__author__ = '<EMAIL>'
# data ... | StarcoderdataPython |
164741 | from functools import partial
from . import utils
import numpy as np
import jax.numpy as jnp
import jax.random as random
from jax import grad, jit, vmap, lax, jacrev, jacfwd, jvp, vjp, hessian
#class Lattice(seed, cell_params, sim_params,
def random_c0(subkeys, odds_c, n):
"""Make random initial conditions g... | StarcoderdataPython |
3248149 | from flask import current_app, request, make_response, jsonify, abort
from api.blueprint import api
from core import crossdomain
from flask_security import auth_token_required, roles_required
from flask_login import current_user
from jsonschema import validate
from jsonschema.exceptions import ValidationError
from api... | StarcoderdataPython |
1745205 | <reponame>WeiwenXu21/FRU<gh_stars>10-100
import math
import tensorflow as tf
from tensorflow.python.util import nest
import collections
import pdb
_FRUStateTuple = collections.namedtuple("FRUStateTuple", ("state", "t"))
class FRUStateTuple(_FRUStateTuple):
"""Tuple used by FRU Cells for `state_size`, `zero_stat... | StarcoderdataPython |
1633058 | <gh_stars>10-100
################################################
## Writen by <NAME>
################################################
from utilities import *
from Co8 import *
# Define dictionaries of ordinary gems and jewelry in the game.
# Format is key : [value in gp, [list of proto numbers]]
gem_table = {
1:... | StarcoderdataPython |
1648823 | # slope
"""
x_0:
initial position
dt:
dt float
iteration:
integer
a:
accerelation
0 < a < 1
t:
dt * iteration
"""
# class slope_field(object):
# """docstring for slope_field"""
# def __init__(self, arg):
# super(slope_field, self).__init__()
# self.arg = arg
def slope(x_0, dt, iteration, a):
... | StarcoderdataPython |
1646651 | <filename>sdk/python/pulumi_azure/cognitive/outputs.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapp... | StarcoderdataPython |
4814134 | from django.apps import AppConfig
class ChatUsersConfig(AppConfig):
name = 'chat_users'
| StarcoderdataPython |
1761695 | from __future__ import print_function
import sys
import numpy as np
def main(argv):
np.random.seed(2)
numPoints = 1001
xs = np.linspace(-5, 5, numPoints)
probs = generateData(numPoints)
convProbs = convolveProbs(probs)
print(np.sum(convProbs))
plt.imshow(convProbs, interpolation = 'none')
plt.sh... | StarcoderdataPython |
1701222 | import os
os.system('docker login -u "dashy2004" -p "12345678qwerty123" repo.treescale.com')
os.system('docker build -t games-day .')
os.system('docker tag games-day repo.treescale.com/dashy2004/games-day:latest')
os.system('docker push repo.treescale.com/dashy2004/games-day:latest')
print('The build passed yay!') | StarcoderdataPython |
1759169 | import os
import sys
from alembic import command
from alembic import config
directory = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..'))
sys.path.insert(0, directory)
import settings
import data.db_session as db_session
directory = os.path.abspath(
os.path.join(os.path.dirname(__file__), '../.... | StarcoderdataPython |
1666648 | <filename>setup.py
from setuptools import setup
def readme():
with open('README.md') as f:
return f.read()
setup(
name='diffenv',
version='0.2.9',
author='<NAME>, <NAME>',
author_email='<EMAIL>, <EMAIL>',
url='http://github.com/error-central/diffenv',
description='Compare develop... | StarcoderdataPython |
4833512 | <gh_stars>0
from pathlib import Path
import cv2
import matplotlib.pyplot as plt
import numpy as np
from skimage import io, transform
from datawriter import FolderWriter, ICDAR2015Writer
from synthgen import RendererV3
import random
# Define some configuration variables:
NUM_IMG = -1 # no. of images to use for gener... | StarcoderdataPython |
47229 | import os
from flask import Flask
from flask_restful import Resource, Api
app = Flask(__name__)
api = Api(app)
class EnvironmentVariablesEndpoint(Resource):
def get(self):
return [(key, os.environ[key]) for key in os.environ.keys()]
api.add_resource(EnvironmentVariablesEndpoint, '/')
if __name__ == '... | StarcoderdataPython |
37424 | import math
import pathlib
import sys
import torch
import torch.nn as nn
PROJECT_DIR = pathlib.Path(__file__).absolute().parent.parent.parent # main directory, the parent of src
if str(PROJECT_DIR) not in sys.path:
sys.path.append(str(PROJECT_DIR))
from src.model.ConvLayer import ConvLayer
from src.m... | StarcoderdataPython |
3333357 | <filename>instascrape/structures.py
import os
import sys
import json
import logging
import traceback
from typing import *
from io import BytesIO
from collections import namedtuple, OrderedDict
import requests
from instascrape.constants import *
from instascrape.exceptions import *
from instascrape.group import *
from... | StarcoderdataPython |
1358 | # Copyright 2018 The TensorFlow 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... | StarcoderdataPython |
1646915 | <reponame>larson-group/clubb_release
import netCDF4
import numpy as np
import pylab as pl
clubb_nc = netCDF4.Dataset('cldwt/rico_silhs_zt.nc')
silhs_files = [ 'cldwt/rico_silhs_lh_zt.nc' ]
silhs_labels = [ 'cldwt' ]
silhs_sfc_nc = netCDF4.Dataset('cldwt/rico_silhs_lh_sfc.nc')
silhs_ncs = list()
for silhs_file in... | StarcoderdataPython |
1792039 | <gh_stars>0
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import pwd
import re
import sys
from subprocess import check_output, CalledProcessError
users = [user for user in pwd.getpwall() if 1000 <= user.pw_uid < 2000]
try:
lxc_cmd = ["lxc", "ls", "volatile.last_state.power=RUNNING", "-c", "n", "--format", "csv"]
... | StarcoderdataPython |
183149 | <reponame>alexa/aac-sdk
import subprocess
from pylib.common import BaseHandler
class BuilderHandler(BaseHandler):
def run( self ):
clean_packages = self.builder_configuration.find_packages( self.get_arg("pattern") )
self.log_info( "Cleaning cached builder data..." )
for next in clean_packa... | StarcoderdataPython |
3328500 | import argparse
from CoolDataLoader import CoolDataLoader
from CoolDataProcessor import *
# Training settings
parser = argparse.ArgumentParser()
parser.add_argument('--f', type=str)
args = parser.parse_args()
Loader = CoolDataLoader(args.f)
# print(Loader.get_course())
# print(Loader.get_videos())
# print(Loader.get_... | StarcoderdataPython |
24340 | #
# One-liner implementation of cPickle
#
from pickle import *
from pickle import __doc__, __version__, format_version, compatible_formats
BadPickleGet = KeyError
UnpickleableError = PicklingError
# ____________________________________________________________
# XXX some temporary dark magic to produce pickled dumps ... | StarcoderdataPython |
3257591 | """
Week 2, Day 2: Valid Perfect Square
Given a positive integer num, write a function which returns True if num is a perfect square else False.
Note:
Do not use any built-in library function such as sqrt.
Example 1:
Input: 16
Output: true
Example 2:
Input: 14
Output: false
"""
from func... | StarcoderdataPython |
1672653 | <filename>secrets.template.py
##
## SP API Developer Settings
##
# This is the first part of the LWA credentials from the developer console
# and is specific to the application you set up. This looks something like
# "amzn1.application-oa2-client.<hex id>"
client_id = None
# This is the hidden part of the LWA credent... | StarcoderdataPython |
1700709 | <filename>setup.py
from setuptools import setup, find_packages
setup(
name='currency-wallet',
version='0.1.0',
description="Track investment returns in multiple currencies through the National Bank of Poland's API.",
packages=find_packages(include=['currency_wallet']),
python_requires='>=3.6',
... | StarcoderdataPython |
105760 | <reponame>jeamick/ares-visual<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: <NAME>
import json
import importlib
import inspect
import sys
from ares.Lib.js import AresJsEncoder
factory = None
def getConfigs(libraries):
"""
:category: Factory
:rubric: JS
:type: Configur... | StarcoderdataPython |
1669620 | import pygame
import random
from inc_SpriteSheet import SpriteSheet
''' Enemy
(sprite group)
This class handles the badguys which fires lasers
'''
class Enemy(pygame.sprite.Sprite):
''' Init
This function is called automatically when we initialize the Class
'''
def __ini... | StarcoderdataPython |
100540 | """Interfaces for interacting with Pinterest users"""
import logging
import json
from datetime import datetime
from dateutil import tz
from friendlypins.board import Board
class User(object):
"""Abstraction around a Pinterest user and their associated data"""
def __init__(self, url, rest_io):
"""
... | StarcoderdataPython |
1727735 | from jinja2 import Template
# >>> template = Template('Hello {{ name }}!')
# >>> template.render(name='<NAME>')
template = ''' <div class="col-md-4 col-sm-6 portfolio-item">
<div>
<img src="img/games/jigsaw_puzzles.png" class="img-responsive" alt="">
<... | StarcoderdataPython |
3387673 | from django.apps import AppConfig
class ColdocappConfig(AppConfig):
name = 'ColDocApp'
default_auto_field = 'django.db.models.AutoField'
| StarcoderdataPython |
1774526 | <reponame>andyjohn23/python-instagram-clone
from django import forms
from .models import UserAccount, Profile
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth import authenticate, login
from django.forms.widgets import TextInput
class RegisterUserForm(UserCreationForm):
email = form... | StarcoderdataPython |
3203665 | from .na_graves_top import *
from .na_graves_jng import *
from .na_graves_mid import *
from .na_graves_bot import *
from .na_graves_sup import *
| StarcoderdataPython |
3201805 | import numpy as np
from src.features import get_dtmp_distribution_statistics, get_dtl_distribution_statistics
from src.helpers import read_video
def test_get_dtmp_distribution_statistics():
df_video = read_video(video_id='001')
feature = get_dtmp_distribution_statistics(df_video, 'left', 'ankle', np.nanmedia... | StarcoderdataPython |
1749614 | from pathlib import Path
USER_REPOS_PAGE1 = '''\
[
{
"archive_url": "https://api.github.com/repos/jwodder/advent350/{archive_format}{/ref}",
"assignees_url": "https://api.github.com/repos/jwodder/advent350/assignees{/user}",
"blobs_url": "https://api.github.com/repos/jwodder/advent350/git/b... | StarcoderdataPython |
1749065 | import datetime as dt
import blpapi
import logging
from .BbgRefDataService import BbgRefDataService
import pandas as pd
import numpy as np
from . import BbgLogger
import pytz
from tzlocal import get_localzone
logger = BbgLogger.logger
SECURITY_DATA = blpapi.Name("securityData")
SECURITY = blpapi.Name("security")
FIEL... | StarcoderdataPython |
1724575 | <reponame>welvin21/pysimt
from .base_sublayer import BaseSublayer
from .self_attention_sublayer import SelfAttentionSublayer
from .cross_attention_sublayer import CrossAttentionSublayer
from .cross_attention_sublayer_mm_flat import FlatMMCrossAttentionSublayer
from .cross_attention_sublayer_mm_hier import HierarchicalM... | StarcoderdataPython |
100834 | import FWCore.ParameterSet.Config as cms
from RecoBTag.SecondaryVertex.candidateCombinedSecondaryVertexV2Computer_cfi import *
candidateNegativeCombinedSecondaryVertexV2Computer = candidateCombinedSecondaryVertexV2Computer.clone()
candidateNegativeCombinedSecondaryVertexV2Computer.vertexFlip = True
candidateNegativeC... | StarcoderdataPython |
124563 | <filename>unsec/email_collection.py
# coding: utf8
"""email_collection.py: EmailCollection is a container for Email class """
__author__ = "<NAME> - <NAME>"
__copyright__ = "Copyright 2015, labsquare"
__license__ = "GPL3"
__email__ = "<EMAIL>"
import re
import glob
from unsec import Email, tools
imp... | StarcoderdataPython |
1763099 | <reponame>lizhaoliu-Lec/Revisiting_Deep_Metric_Learning_PyTorch
"""
The network architectures and weights are adapted and used
from the great https://github.com/Cadene/pretrained-models.pytorch.
"""
import pretrainedmodels as ptm
import torch.nn as nn
import torch.nn.functional as F
class Network(nn.Module):
def ... | StarcoderdataPython |
4836049 | <gh_stars>1-10
from setuptools import setup, find_packages
import os
package_name = "pyromocc"
package_data = {}
if os.name == 'posix':
package_data[package_name] = ['*.so']
else:
package_data[package_name] = ['*.pyd', '*.dll']
setup(name=package_name,
version='0.0.4',
author="<NAME>",
pack... | StarcoderdataPython |
1725710 | # Copyright (c) 2020 the Eclipse BaSyx Authors
#
# This program and the accompanying materials are made available under the terms of the MIT License, available in
# the LICENSE file of this project.
#
# SPDX-License-Identifier: MIT
import io
import unittest
from basyx.aas import model
from basyx.aas.adapter.xml impor... | StarcoderdataPython |
3350646 | # -*- coding: utf-8 -*-
#
# Copyright 2017 Ricequant, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | StarcoderdataPython |
191277 | <filename>flaskdeploy/test/prototype.py
from config import *
from validation import *
from utils import *
import subprocess
import getpass
import os
import click
domain = "xx.com"
usr = getpass.getuser()
loc = os.path.join(os.getcwd(), domain)
DOMAIN, USR, CUR_LOC = domain, usr, loc
cli = click.Group()
@click.comma... | StarcoderdataPython |
3290047 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from tvm import te
import numpy as np
import psutil
def schedule(attrs):
cfg, s = attrs.auto_config, attrs.scheduler
def mcpu_auto_schedule(s, output, prefix):
hyper_params = [[-1, 2, 8, 4], [-1, 1, 512, 1]]
slice_data, slice_reduce... | StarcoderdataPython |
1799457 | import os
from game.prepare import stat_library
from models import FilesConfig, LabelsConfig, Game
def main():
stat_library('/opt/game/game')
input_folder = '/opt/game/games/slack_22_02_2019/'
output_folder = '/opt/game/game/output/out-test-10/'
files = FilesConfig(
os.path.join(input_folder... | StarcoderdataPython |
185007 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: main.py
Author: huxuan
Email: i(at)huxuan.org
Description: Filter IPTV m3u playlists according to customized criteria.
"""
import argparse
from . import __version__
from .config import Config
from .constants import defaults
from .constants import h... | StarcoderdataPython |
1614415 | <reponame>alessandrostockman/dl-flatlands<gh_stars>1-10
from abc import abstractclassmethod, abstractmethod
import random
from collections import deque
import numpy as np
from fltlnd.utils import SumTree
class Buffer:
def __init__(self, buffer_size, batch_size):
self.buffer_size = buffer_size
se... | StarcoderdataPython |
3388550 | <gh_stars>0
"""
.. module: horseradish.models
:platform: Unix
:synopsis: This module contains all of the associative tables
that help define the many to many relationships established in Horseradish
:copyright: (c) 2020 by <NAME>, see AUTHORS for more
:license: Apache, see LICENSE for more details.... | StarcoderdataPython |
3233661 | <filename>modules/couchpotato.py<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import cherrypy
import htpc
import requests
from htpc.auth2 import require, member_of
import logging
import hashlib
from htpc.helpers import fix_basepath, get_image, striphttp, comp_table
import json
import os
import re
clas... | StarcoderdataPython |
1697034 | <reponame>weezel/BandEventNotifier<filename>venues/plugin_lutakko.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import lxml.html
import re
import time
from venues.abstract_venue import AbstractVenue
class Lutakko(AbstractVenue):
def __init__(self):
super().__init__()
self.url = "http://www.... | StarcoderdataPython |
1780241 | import logging
import os
import re
from pathlib import Path
class Problem:
editor = "code"
def __init__(self, pid: str):
self._pid = pid
self._logger = logging.getLogger(f"题目 {pid}")
self._path = Path(f"problems/{re.match(r'[A-Z]+', pid).group()}/{pid}")
self._path_md = self.... | StarcoderdataPython |
188252 | <filename>examples/nw/tests/test_upd_employee_salary.py
import sys, unittest
import logic_bank_utils.util as logic_bank_utils
from datetime import datetime
from decimal import Decimal
(did_fix_path, sys_env_info) = \
logic_bank_utils.add_python_path(project_dir="LogicBank", my_file=__file__)
if __name__ == '__ma... | StarcoderdataPython |
1662845 | """ Install odet first:
https://github.com/kun0906/odet
"""
import os
import pickle
import pandas as pd
from odet.pparser.parser import _pcap2flows, _get_IAT_SIZE, _get_STATS
from odet.utils.tool import dump_data, check_path
import numpy as np
""" Analyze IOT datasets (data-clean.zip: 20GB, 20210714) collecte... | StarcoderdataPython |
44735 | <reponame>digital-land/pipeline<filename>tests/unit/test_uri.py<gh_stars>1-10
from digital_land.log import IssueLog
from digital_land.datatype.uri import URIDataType
def test_uri_normalise():
uri = URIDataType()
assert uri.normalise("https://example.com/foo") == "https://example.com/foo"
assert (
... | StarcoderdataPython |
3214401 | from .fhirbase import fhirbase
class Task(fhirbase):
"""
A task to be performed.
Attributes:
resourceType: This is a Task resource
identifier: The business identifier for this task.
definitionUri: A reference to a formal or informal definition of the
task. For example... | StarcoderdataPython |
4803499 |
__version__ = '0.9.1.1'
__gui__ = True # global option to enable/disable graphics | StarcoderdataPython |
3239964 | <reponame>velocist/TS4CheatsInfo
# uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\carry\carry_elements.py
# Compiled at: 2018-05-18 03:28:16
# Size o... | StarcoderdataPython |
36426 | <filename>goodrich/python_primer/c119.py
"""
C 1.19
---------------------------------
Problem Statement : Demonstrate how to use Python’s list comprehension syntax to produce
the list [ a , b , c , ..., z ], but without having to type all 26 such
characters literally.
Author : Saurabh
"""
print([chr(x + 97) for x in ... | StarcoderdataPython |
46494 | import numpy as np
import pandas as pd
import time
mnist = pd.read_csv("../input/train.csv")
mnist.head()
y_train = mnist.label.values
x_train = mnist.drop('label',axis=1)
x_train = (x_train / 255.0).values
x_train = np.reshape(x_train,(42000,1,28,28))
x_train.shape
from keras.models import Sequential
from keras.l... | StarcoderdataPython |
1671913 | <filename>openstack_dashboard/dashboards/project/data_processing/jobs/tests.py
# 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 req... | StarcoderdataPython |
4842839 | <reponame>OpenDataServices/flatten-tool<gh_stars>10-100
"""
This file contains code that takes an instance of a JSON file as input (not a
JSON schema, for that see schema.py).
"""
import codecs
import copy
import os
import tempfile
import uuid
from collections import OrderedDict
from decimal import Decimal
from warn... | StarcoderdataPython |
3323350 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_pynab
----------------------------------
Tests for `pynab` module.
"""
import unittest
from pprint import pformat
from pynab.server import Server
from pynab.db import db_session
import pynab.parts
from pynab import log
import regex
from pynab.categories import ... | StarcoderdataPython |
1718023 | <filename>main.py<gh_stars>0
import os
import requests
from pathlib import Path
from requests.exceptions import ConnectionError
test_results = {}
#
# CHECK ENVIRONMENT VARIALBES
#
print('--> Reading the environment variables')
print(f'ENVIRONMENT: {os.environ}')
test_results['environment'] = os.environ
#
# CHEC... | StarcoderdataPython |
1765907 | import numpy as np
import pandas as pd
import tensorflow as tf
import time
import argparse
from matplotlib import pyplot as plt
from random_effect_logistic_regression_utils import generate_data, timestamp
import sys
sys.path.append('../models')
from random_effect_logistic_regression import random_effect_logistic_regre... | StarcoderdataPython |
3357980 | from datetime import datetime
from pathlib import Path
from pony.orm import Database, Optional, PrimaryKey, Required, Set, db_session
from PhotoPhixer.common.config import SysConfig
def db_connection(config: SysConfig) -> Database:
"""
This routine must be used to create and manage data in database.
:p... | StarcoderdataPython |
47149 | <filename>lists.py
# Set number of participants
num_dyads = 4
num_participants = num_dyads*2
# Create lists for iterations
participants = list(range(num_participants))
dyads = list(range(num_dyads)) | StarcoderdataPython |
3266848 | <reponame>omaskery/classdict
from .toplevel import to_dict, from_dict, can_consume_dict, can_become_dict
from .errors import *
class FieldType(object):
def __init__(self, expected_type=None, required=False):
self.required = required
self.type = expected_type
self._name = None
def s... | StarcoderdataPython |
111132 | #!/usr/bin/env python
from M2Crypto import X509
import binascii
import hashlib
import ssl
import sys
def main(argv):
if len(argv) != 1 and len(argv) != 2:
print "Usage: pin.py [<certificate_path> | <host> <port>]"
return
if (len(argv) == 1):
cert = X509.load_cert(argv[0])
e... | StarcoderdataPython |
4090 | <gh_stars>1-10
"""viewer application which allows to interactively view spatio-temporal gap filling results"""
import os
import argparse
from datetime import datetime, timedelta
from tkinter import Canvas, Tk, Button, RAISED, DISABLED, SUNKEN, NORMAL
import numpy as np
from PIL import Image, ImageTk
import probgf.media... | StarcoderdataPython |
3203779 | #!/usr/bin/python
from functools import wraps
def log(fun):
@wraps(fun)
def do_log(*args, **kwargs):
print(f'{fun.__name__} was called')
return fun(*args, **kwargs)
return do_log
@log
def power(x):
return x * x
res = power(4)
print(res)
| StarcoderdataPython |
1772652 | <filename>Abbot/script.py
def inv_me(num, den):
ans = []
ans.append(num // den)
num = num % den
reducer = 0
while True:
reducer += 1
num, den = den * reducer, num
ans.append(num // den)
num = num % den
if num == 0:
break
return bytes(ans)
def inv_you(num, den):
ans = []
ans.append(num // den)
nu... | StarcoderdataPython |
3292376 | class UnknownError(Exception):
pass
class ImageCheckError(Exception):
pass
class ImageAuthenticationError(ImageCheckError):
pass
class ImageNameError(ImageCheckError):
pass
| StarcoderdataPython |
1782690 | from .base import *
import django_heroku
import dj_database_url
SECRET_KEY = config('SECRET_KEY')
DEBUG = config('DEBUG', cast=bool)
# Honor the 'X-Forwarded-Proto' header for request.is_secure()
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
ALLOWED_HOSTS = ['https://learnwithanarul.herokuapp.com/',... | StarcoderdataPython |
1676499 | <reponame>fqrouter/fquni
import signal
import socket
import logging
import os
import time
import argparse
import dpkt.ip
LOGGER = logging.getLogger(__name__)
udp_socket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM)
udp_socket.setblocking(False)
SO_MARK = 36
udp_socket.setsockopt(socket.SOL_SOCKET, S... | StarcoderdataPython |
158137 | from defusedcsv import csv
import importlib
import logging
import os
import re
from pathlib import Path
from tempfile import mkstemp
from urllib.parse import urlparse
import pypandoc
from django.apps import apps
from django.conf import settings
from django.http import Http404, HttpResponse, HttpResponseBadRequest
from... | StarcoderdataPython |
1775322 | '''AlexNet for CIFAR10. FC layers are removed. Paddings are adjusted.
Without BN, the start learning rate should be 0.01
(c) <NAME>
'''
import torch.nn as nn
import torch.nn.functional as F
from torchsso.utils.accumulator import TensorAccumulator
__all__ = ['alexnet', 'alexnet_mcdropout']
class AlexNet(nn.Module):... | StarcoderdataPython |
134151 | <reponame>jhonatanlteodoro/ecommerce-django
"""
Django settings for djangoecommerce project.
Generated by 'django-admin startproject' using Django 1.11.
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.djan... | StarcoderdataPython |
1774386 | class Solution:
def findSubstring(self, s: str, words: List[str]) -> List[int]:
if not words:
return []
nwords = len(words)
counter = collections.Counter(words)
ans = []
m = len(words[0])
total_len = nwords * m
for i in range(len(s) - total_len + 1... | StarcoderdataPython |
4814205 | <reponame>Random-Coders/trash-sorter-flask<gh_stars>1-10
"""
Imports
"""
# Flask imports
from flask import Flask
# Create Flask app
app = Flask(__name__, template_folder='templates')
# Add Configurations to app
app.config.from_pyfile('config.py', silent=False)
from trash import views
| StarcoderdataPython |
4830817 | <reponame>tobykirk/PyBaMM
from .base_porosity import BaseModel
from .constant_porosity import Constant
from .reaction_driven_porosity import ReactionDriven
| StarcoderdataPython |
4832525 | """Init file for Supervisor Security RESTful API."""
import logging
from typing import Any, Dict
from aiohttp import web
import voluptuous as vol
from ..const import ATTR_CONTENT_TRUST, ATTR_FORCE_SECURITY, ATTR_PWNED
from ..coresys import CoreSysAttributes
from .utils import api_process, api_validate
_LOGGER: loggi... | StarcoderdataPython |
4800427 | <filename>h/indexer/__init__.py
from h.indexer.reindexer import reindex
__all__ = ("reindex",)
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.