id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
1605407 | <reponame>Physu/variousTest1
import numpy as np
import mayavi.mlab as mlab
import torch
from visual_utils import visualize_utils as V
pointcloud = np.fromfile(str("000008.bin"), dtype=np.float32, count=-1).reshape([-1, 4])
print(pointcloud.shape)
x = pointcloud[:, 0] # x position of point
y = pointcloud[:, 1] # y p... | StarcoderdataPython |
3256092 | <reponame>hmbui/rogue2yaml
# Convert a PyRogue class to YAML
import sys
import os
import shutil
import json
import traceback
from pydoc import locate, ErrorDuringImport
import rogue2yaml
from rogue2yaml.arg_parser import ArgParser
from version import CPSW_YAML_SCHEMA_VERSION
from rogue2yaml.converter_logging impor... | StarcoderdataPython |
3309067 | from django.db import models
class Blog(models.Model):
title = models.CharField(max_length=140)
content = models.TextField()
posted_date = models.DateTimeField(auto_now_add=True)
| StarcoderdataPython |
1779407 | import re
from lib import cameraDriver as cam
from lib import motionsensorDriver as motion
from lib import drawTheTableauLib as dtlib
from lib import drawTheTableauDriver as dtdriver
from lib import lcdDriver as lcd
from lib import interfaceMobile as im
import datetime as dt
import time as t
import os
def get_ip() :
... | StarcoderdataPython |
3356004 | # Escreva um programa em Python que leia um número inteiro
# qualquer e peça para o usuário escolher qual será a base
# de conversão: 1 para binário, 2 para octal e 3 para hexadecimal.
num = int(input("Digite um número inteiro para conversão: "))
base = int(input("Para qual base deseja converter:\n1 - Binário\n2 - Oct... | StarcoderdataPython |
28607 | import numpy
from fdm.geometry import create_close_point_finder
def create_weights_distributor(close_point_finder):
def distribute(point, value):
close_points = close_point_finder(point)
distance_sum = sum(close_points.values())
return dict(
{p: (1. - distance/distance_sum)*va... | StarcoderdataPython |
1676524 | # ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.1.1
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
import os, sys
os.getcwd()
# #!pip install azure-storag... | StarcoderdataPython |
3301458 | import numpy as np
import mvpose.geometry.geometry as gm
from mvpose.geometry.camera import ProjectiveCamera
from pak.datasets.UMPM import UMPM
def get(root, video_name, user, pwd):
""" Gets the data of the given UMPM video transformed
to the mvpose standard
:param root: data root for all pak datasets... | StarcoderdataPython |
154426 | <reponame>elisabettai/osparc-simcore
import re
from typing import Optional
from models_library.basic_regex import UUID_RE
from models_library.projects import ProjectID
def compose_workcopy_project_tag_name(workcopy_project_id: ProjectID) -> str:
return f"project:{workcopy_project_id}"
def parse_workcopy_projec... | StarcoderdataPython |
181026 | <reponame>charliechocho/py-crash-course
bibycles = ['monark','crecent','sjösala','scott','giant']
for i in bibycles:
print(i)
| StarcoderdataPython |
3276944 | from django.conf.urls import url
from targets import views
app_name = 'targets'
urlpatterns = [
url(r'^topic/(?P<topic_name_slug>[\w\-]+)/$',views.show_topic,name='show_topic'),
]
| StarcoderdataPython |
153970 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
stocks_correlation.providers.quandl
This module define the normalized columns
of the DataFrame the providers return
"""
DATAFRAME_COLUMNS = ['date', 'open', 'high', 'low', 'close']
CORREL_COMPUTE_COLUMNS = DATAFRAME_COLUMNS[1:]
def filter_dates(df, start_date, end_date):
... | StarcoderdataPython |
4803500 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from setuptools import setup
import codecs
def read(rel_path):
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, rel_path), 'r') as fp:
return fp.read()
def get_version(rel_path):
for line in... | StarcoderdataPython |
3299259 | import os
import zipfile
def zipdir(path, dest, pattern=None):
with zipfile.ZipFile(dest, 'w', zipfile.ZIP_DEFLATED) as zf:
for root, dirs, files in os.walk(path):
for file in files:
fp = os.path.join(root, file)
if not pattern or pattern(fp):
... | StarcoderdataPython |
3338220 | <reponame>somia/pycassa
__version_info__ = (0, 1)
__version__ = '.'.join([str(v) for v in __version_info__])
from pycassa.columnfamily import *
from pycassa.columnfamilymap import *
from pycassa.types import *
from pycassa.connection import *
from cassandra.ttypes import ConsistencyLevel, InvalidRequestException, \
... | StarcoderdataPython |
96779 | from django.http import request
from django.shortcuts import render, redirect
from django.contrib.auth import authenticate, login, logout
# "python.analysis.extraPaths": ["C:/Users/adity/Desktop/Aditya/webdev/dbms/Home/views.py"]
from django.contrib import messages
from django.contrib.auth.models import User
# from rep... | StarcoderdataPython |
1711595 | <gh_stars>0
from housepaint.pigments import BG, FG, Style
from housepaint.paint import paint
from housepaint.premixed import success, warning, error, wild
| StarcoderdataPython |
1711775 | """hxlm.core.io Input/Output
Author: 2021, <NAME> (Etica.AI) <<EMAIL>>
License: Public Domain / BSD Zero Clause License
SPDX-License-Identifier: Unlicense OR 0BSD
"""
# __all__ = [
# 'get_language_identifiers',
# 'get_metadata',
# 'transpose'
# ]
# from hxlm.core.hdp.project import ( # noqa
# projec... | StarcoderdataPython |
3391314 | # Copyright 2015, Google Inc.
# 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 conditions and the f... | StarcoderdataPython |
196987 | <filename>fhir/resources/tests/test_substance.py
# -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/StructureDefinition/Substance
Release: R4
Version: 4.0.1
Build ID: 9346c8cc45
Last updated: 2019-11-01T09:29:23.356+11:00
"""
from pydantic.validators import bytes_validator # noqa: F401
from .. import fhirtypes ... | StarcoderdataPython |
1734844 | <reponame>rubenaprikyan/aim<filename>performance_tests/conftest.py
import boto3
import os
import shutil
import tarfile
import time
from pathlib import Path
from aim.web.utils import exec_cmd
from aim.cli.up.utils import build_db_upgrade_command
from aim.web.configs import AIM_ENV_MODE_KEY
TEST_REPO_PATH = '.aim-perfo... | StarcoderdataPython |
1600120 | <reponame>AjSat/hqp_l1<filename>world_simulator.py
#Simulator file, running either a physics engine or a simple integrator model for velocity control of a robot
#This file is meant to be used for verifying the performance of algorithms in simulation.
#The class should have robot related variables that are updated conti... | StarcoderdataPython |
3241547 | <reponame>alysivji/sivtools
"""Implementation of Python list using Linked List"""
from collections import abc
import numbers
class Node(object):
"""
Node that holds data and a link to the next node
"""
def __init__(self, data, next_=None):
self.data = data
self.next_ = next_
def... | StarcoderdataPython |
145361 | <reponame>Guo-Xiaoqing/ThresholdNet
# ----------------------------------------
# Written by <NAME>
# ----------------------------------------
import torch
import torch.nn as nn
from net.deeplabv3plus import deeplabv3plus
from net.fcn import FCN8s
from net.unetplusplus import NestedUNet
from net.SegNet import SegNet
d... | StarcoderdataPython |
3208261 | import numpy as np
import matplotlib.pyplot as plt
from gdal import Open as OpenGdal
#-------------------------------------------------------------------------------
fn0 = '../data/SVDNB_npp_20150101-20151231_75N060W_{}_v10_c201701311200.avg_rade9.tif'
# vcm - viirs cloud mask
# vcm-orm = outlier removed
# vcm-ntl =... | StarcoderdataPython |
1746713 | <gh_stars>100-1000
import json
import os
import sqlite3
import tempfile
import pandas
import pytest
from great_expectations.core import ExpectationSuiteValidationResult, \
ExpectationValidationResult, ExpectationConfiguration
from great_expectations.data_context import BaseDataContext
from great_expectations.data_... | StarcoderdataPython |
3243743 | <reponame>redzhepdx/IWC-Net<gh_stars>1-10
from capsule_layers import *
import tensorflow as tf
import numpy as np
import cv2
def cap_U_encoder(input, K):
x = tf.reshape(input, shape=[-1, 224, 224, 3])
conv1 = tf.layers.conv2d(x, 16, 5, 1, padding="same", kernel_initializer=tf.truncated_n... | StarcoderdataPython |
3331309 | <reponame>kyeeh/holbertonschool-machine_learning<gh_stars>0
#!/usr/bin/env python3
if __name__ == '__main__':
import numpy as np
intersection = __import__('1-intersection').intersection
P = np.linspace(0, 1, 11)
Pr = np.ones(11) / 11 # this prior assumes that everything is equally as likely
print(... | StarcoderdataPython |
155522 | <reponame>otaviopace/ananas
#!/usr/bin/env python3
import os
import shutil
import subprocess
import threading
class qemu:
def __init__(self, src_image, dst_image):
self._src_image = src_image
self._dst_image = dst_image
self._mount_dir = '/mnt'
# prepares a disk image for a given test
# XXX we should do all... | StarcoderdataPython |
14361 | <reponame>tschoergez/container-service-extension
from __future__ import absolute_import
# flake8: noqa
# import apis into api package
from container_service_extension.pksclient.api.cluster_api import ClusterApi
from container_service_extension.pksclient.api.plans_api import PlansApi
from container_service_extension.p... | StarcoderdataPython |
62858 | <gh_stars>0
#!/usr/bin/python
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
html = """
<!DOCTYPE html>
<html>
<head>
<title>Light Level's</title>
<style type="text/css">
strong, #a{
padding-right: 20em;
}
*{
text-align:center;
}
</style>
</head>
<body>
<h1>Li... | StarcoderdataPython |
67083 | """timeflux.nodes.sequence: generate a sequence"""
from timeflux.core.node import Node
class Sequence(Node):
def __init__(self):
"""Generate a sequence"""
self._current = 0
def update(self):
self.o.set([self._current])
self._current += 1
| StarcoderdataPython |
1714023 | <gh_stars>0
# Code by <NAME>
# ----------------------------------------------------------------
# PROBLEM STATEMENT
# Import the z table as a data structure in python. Create some 5 demo examples to find the area under the curve and report the answer from the z-table.
# -------------------------------------------... | StarcoderdataPython |
3375024 | <gh_stars>0
# Copyright 2019 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | StarcoderdataPython |
85928 | <reponame>cimeister/neural-transducer
import argparse
import os
from collections import defaultdict
import numpy as np
from tqdm import tqdm
def maybe_mkdir(filename):
"""
maybe mkdir
"""
path = os.path.dirname(filename)
if not os.path.isdir(path):
try:
os.makedirs(path)
... | StarcoderdataPython |
68999 | # Copyright 2015-2016 Cisco Systems, 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 ... | StarcoderdataPython |
176213 | <gh_stars>10-100
# -*- coding: utf-8 -*-
r"""Chopper class for Time of Flight instrument
"""
import numpy as np
from .exceptions import ChopperError
class Chopper(object):
r"""Class defining a chopper object for using Time of Flight spectrometer
resolution calculations.
Parameters
----------
di... | StarcoderdataPython |
167007 | #!/usr/bin/env python3
#This sample demonstrates digital port read and write.
#Install IoT HAT 3 library with "pip3 install turta-iothat3"
from time import sleep
from turta_iothat3 import Turta_Digital
#Initialize
#Set left digital port as output, right digital port as input
digital = Turta_Digital.DigitalPort(False... | StarcoderdataPython |
3229828 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.StaffInfo import StaffInfo
class KoubeiMarketingDataEnterpriseStaffinfoUploadModel(object):
def __init__(self):
self._batch_id = None
self._ente... | StarcoderdataPython |
1630348 | #!/usr/bin/env python
"""NBConvert is a utility for conversion of IPYNB files.
Commandline interface for the NBConvert conversion utility. Read the
readme.rst for usage information
"""
#-----------------------------------------------------------------------------
#Copyright (c) 2013, the IPython Development Team.
#
#... | StarcoderdataPython |
1728178 | from keras.layers import Input, Dense, LSTM, Embedding, Dropout
from keras.layers.merge import add
from keras.models import Model
from keras.utils import plot_model
from nltk.translate.bleu_score import corpus_bleu
from DataUtils import generate_desc
# define the captioning model
def define_model(vocab_size, max_len... | StarcoderdataPython |
3210202 | #!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
import os
# Creating four arrays with 20 elements each
linear = np.arange(1, 20)
square = linear ** 2
log = np.log(linear)
random = np.random.randint(0, 100, 20)
# The figsize parameter allows us to configure the figure size in inches
fig, axe... | StarcoderdataPython |
1722336 | # Generated by Django 3.0.7 on 2020-06-25 00:15
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('annotator', '0007_annotation_editing'),
]
operations = [
migrations.RemoveField(
model_name='annotation',
name='editing',
... | StarcoderdataPython |
20067 | <filename>internal/handlers/singapore.py
import settings
import handlers.base_handler
import csv
class CartogramHandler(handlers.base_handler.BaseCartogramHandler):
def get_name(self):
return "Singapore (by Region)"
def get_gen_file(self):
return "{}/singapore_map_processedmap.json".format(se... | StarcoderdataPython |
3293948 | <filename>problem118_google_square.py
'''
This problem was asked by Google.
Given a sorted list of integers, square the elements and give the output in sorted order.
For example, given [-9, -2, 0, 2, 3], return [0, 4, 4, 9, 81].
'''
import unittest
import bisect
def square_in_list(arr):
res = []
for x in a... | StarcoderdataPython |
3399734 | <filename>madgraph/madweight/blob_solution.py<gh_stars>1-10
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
import six
from six.moves import range
try:
import madgraph.madweight.particle_class as particle_class
import madgraph.various.misc as misc
except Impor... | StarcoderdataPython |
3256229 | <reponame>hannahmfan/covid-prediction
import pystan
import pandas as pd
import numpy as np
import pandas as pd
import datetime
from datetime import date
from heapq import nlargest
import os
os.environ['STAN_NUM_THREADS'] = "4"
################################################################
############# Util c... | StarcoderdataPython |
1725136 | from __future__ import absolute_import, print_function
import os
import os.path
from libpebble2.communication.transports.websocket import WebsocketTransport, MessageTargetPhone
from libpebble2.communication.transports.websocket.protocol import (
WebSocketInstallBundle, WebSocketInstallStatus)
from libpebble2.ex... | StarcoderdataPython |
3293591 | <reponame>manulera/Pomber
import os
import sys
import numpy as np
def subsection_colfile(filename,which):
array = np.genfromtxt(filename, delimiter=',', dtype=str)
array = array[:,:-1]
return array[:,which]
def copyfolder_idx(ori,dest,idx):
if not os.path.isdir(ori):
return
bname = os.pat... | StarcoderdataPython |
40020 | import unittest
import warnings
from parse_python_indentation import parse_indentation
good_output = [
{'key': 'green:',
'offspring': [
{'key': 'follow', 'offspring': []},
{'key': 'blue', 'offspring': []},
{'key': 'yellow', 'offspring': []},
{'key': 'fishing', 'offspring': []},
{'key': 'sn... | StarcoderdataPython |
98310 | <gh_stars>100-1000
latest_block_redis_key = "latest_block_from_chain"
latest_block_hash_redis_key = "latest_blockhash_from_chain"
most_recent_indexed_block_redis_key = "most_recently_indexed_block_from_db"
most_recent_indexed_block_hash_redis_key = "most_recently_indexed_block_hash_from_db"
most_recent_indexed_ipld_blo... | StarcoderdataPython |
120811 | <gh_stars>0
def roundUp(number:float)->int:
split = [int(i) for i in str(number).split(".")]
if split[1] >0:
return split[0]+1
return split[0]
## Program Start ##
n, k = [int(i) for i in input().strip().split(" ")][-2:]
scores = sorted([int(i) for i in input().strip().split(" ")])
min_days = roun... | StarcoderdataPython |
4823822 | from .hdfpath import parse
| StarcoderdataPython |
1648695 | <gh_stars>1000+
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2021 4Paradigm
#
# 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
#
# ... | StarcoderdataPython |
48409 | <filename>notification/migrations/0001_initial.py
# -*- coding: utf-8 -*-
from django.conf import settings
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
migrations.... | StarcoderdataPython |
1750678 | <reponame>Thomas9292/nasa-background<filename>nasa_background.py
from datetime import datetime
import click
from tools import background, nasa_api
from tools.utils import parse_str_to_date
@click.group()
def nasa_background():
pass
@nasa_background.command()
@click.option("--date",
default=None,... | StarcoderdataPython |
3241711 | <filename>lib/core/api2object/alliance.py
__author__ = 'mriegel'
from gge_proxy_manager.models import Alliance
from lib.cache import cache
from lib.core import DATA_IMPORT_LOCK_TIME
import logging
logger = logging.getLogger(__name__)
def import_alliance(oi, kingdom):
response = import_alliance_(oi, kingdom)
... | StarcoderdataPython |
1784920 | from selenium import webdriver
webpage = webdriver.Chrome()
webpage.get("https://facebook.com")
email = webpage.find_element_by_id("email")
email.send_keys("<EMAIL>")
password = webpage.find_element_by_id("pass")
password.send_keys("password")
login = webpage.find_element_by_id("u_0_b")
login.click() | StarcoderdataPython |
71343 | <reponame>rehee/try_discuz
# -*- coding: utf-8 -*-
"""
flaskbb.core.exceptions
~~~~~~~~~~~~~~~~~~~~~~~
Exceptions raised by flaskbb.core,
forms the root of all exceptions in
FlaskBB.
:copyright: (c) 2014-2018 the FlaskBB Team
:license: BSD, see LICENSE for more details
"""
class BaseFlas... | StarcoderdataPython |
3385076 | # -*- coding: utf-8 -*-
""" Line Shape
description:
content:
- bresenhams_line
reference:
1. http://www.roguebasin.com/index.php?title=Bresenham%27s_Line_Algorithm
author: Shin-Fu (<NAME>
latest update: 2019/05/10
"""
def bresenhams_line(start, end, isList=False):
if isList:
line =... | StarcoderdataPython |
4825378 | <reponame>Brown-University-Library/chamber
import logging
from lxml import etree as ET
from tidylib import tidy_document
from ._filetypehandler_abstract import Abstract_FileHandler
class XML_FileHandler(Abstract_FileHandler):
"""Default FileHandler. If nothing else matches, we assume the file is XML/HTML
a... | StarcoderdataPython |
1765611 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
UP TO DATE CURRENT VERSION AT https://github.com/thejoltjoker/camera-offload
---
camera_offload.py
A script for offloading files from a memory card etc.
"""
import os
import hashlib
import xxhash
import logging
import datetime
import shutil
import math
import argparse
i... | StarcoderdataPython |
121213 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from datetime import date
from dateutil import rrule
from decimal import Decimal as D
import mock
from django.test import TestCase
from ralph_sc... | StarcoderdataPython |
1724490 | '''
Created on Jan 26, 2018
@author: enerve
'''
from __future__ import division
import logging
import math
import numpy as np
class GaussianPlugInClassifier(object):
def __init__(self, X, Y, num_classes=2):
self.X = X
self.Y = Y
self.num_classes = num_classes
self.logger = l... | StarcoderdataPython |
3377224 | <reponame>Natsurii/nicabot-monkee
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Nekozilla is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ver... | StarcoderdataPython |
3308304 | import sys
sys.path.append("../utils/")
import click
import numpy as np
from pathlib import Path
from mets import parse_mets, get_pdf_pages_of_book
from transcriptions import get_bounding_boxes_from_transcription
from pdfs import extract_images
from jinja2 import Environment, FileSystemLoader
from kraken.serialization ... | StarcoderdataPython |
184732 | from .dataset import *
from .ptc_dataset import *
from .pair_dataset import *
__all__ = ["Dataloader", "PtcDataset", "PairDataset"]
| StarcoderdataPython |
1765009 | <gh_stars>1-10
interface_entry="testbuilder.interface.selenium.interface.SeleniumInterface" | StarcoderdataPython |
99618 | from collections import defaultdict
import numpy as np
import pandas as pd
from scipy.stats import chi2_contingency, fisher_exact, f_oneway
from .simulations import classifier_posterior_probabilities
from .utils.crosstabs import (crosstab_bayes_factor,
crosstab_ztest,
... | StarcoderdataPython |
3254141 | <gh_stars>0
# aplay -Dhw:1,0 /usr/share/sounds/alsa/Rear_Center.wav
# set volume
# alsamixer
import time
import os
import subprocess
import threading
is_in_pi = os.environ.get('IN_PI') is not None
def find_rsc_file(name, rscDirs):
for dir in rscDirs:
if not os.path.exists(dir):
continue
... | StarcoderdataPython |
3256078 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
data = []
with open('facebook.txt', 'r') as f:
for line in f:
data.append(line.replace('\n', '').split(','))
plt.xlabel('age')
plt.ylabel('count')
plt.title('facebook user age distribution')
del data[1][0]
classes = ['18-22', '23-27', '28+']
... | StarcoderdataPython |
3287414 | <reponame>gcramerb/TransferLearning-Sensors<filename>experiments/noTransfer.py
import sys, argparse
sys.path.insert(0, '../')
# import geomloss
from pytorch_lightning import Trainer
from pytorch_lightning.loggers import WandbLogger
from train.trainerClf import networkLight
from dataProcessing.dataModule import Sing... | StarcoderdataPython |
3262032 | #!/usr/bin/env python3
import subprocess
tag = "reservoir/cqrswriter"
subprocess.run(["docker", "build", "-t", tag, "."])
| StarcoderdataPython |
1658744 | # https://leetcode.com/explore/featured/card/january-leetcoding-challenge-2021/579/week-1-january-1st-january-7th/3589/
from typing import List
class Solution:
def can_form_array(self, arr: List[int], pieces: List[List[int]]) \
-> bool:
# idea: start searching from beginning of arr
... | StarcoderdataPython |
155051 | <reponame>vektorelpython24proje/temelbilgiler
import random as rnd
liste = [i for i in range(1000)]
def luckies(liste,count):
for i in range(count):
yield rnd.choice(liste)
for item in luckies(liste,3):
print(item)
print(rnd.sample(liste,3))
| StarcoderdataPython |
82121 | from math import inf
from rest_framework.authtoken.models import Token
from rest_framework.decorators import action
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework.viewsets import GenericViewSet, ViewSet
from rest_framework.viewsets import mixins
from rest_fram... | StarcoderdataPython |
3304789 | <gh_stars>1-10
"""
_GetHLTConfig_
Oracle implementation of GetHLTConfig
Returns HLT configuration (process name and stream
to dataset to trigger mapping) for a given HLT key.
"""
from WMCore.Database.DBFormatter import DBFormatter
class GetHLTConfig(DBFormatter):
def execute(self, hltkey, conn = None, transac... | StarcoderdataPython |
3216630 | <filename>gamla/functional_async.py<gh_stars>0
import asyncio
import inspect
from typing import Any, AsyncGenerator, Awaitable, Callable, Dict, Iterable
import toolz
from toolz import curried
from gamla import functional
async def to_awaitable(value):
if inspect.isawaitable(value):
return await value
... | StarcoderdataPython |
97847 | <gh_stars>1-10
# Retweet bot for Twitter, using Python and Tweepy.
# License: MIT License.
import tweepy
import dateparser
import pickle
from RetweetObject import RetweetObject
from RetweetStore import RetweetStore
from RetweetGuard import RetweetGuard
from time import sleep
# Import in your Twitter application keys,... | StarcoderdataPython |
1609084 | <gh_stars>1-10
# Copyright (C) 2018 <NAME>
#
# SPDX-License-Identifier: MIT
"""This module contains a collection of functions related to
geographical data.
"""
from calendar import c
from .utils import sorted_by_key # noqa
from collections import defaultdict
from haversine import haversine
from collections import Cou... | StarcoderdataPython |
3331385 | # 4. Счетчик значений. Допустим, что файл с серией имен
# (в виде строковых значений) называется my_name.txt и существует на диске
# компьютера. Напишите программу, которая показывает количество хранящихся в
# файле имен. (Подсказка: откройте файл и прочитайте каждую хранящуюся в нем
# строку . Примените переменну... | StarcoderdataPython |
56031 | """
####################
Create a low hydro scenario
Date applied: 2021-07-29
Description:
This script adds a scenario to the database for low hydro power.
The worst year for hydro is 2015. As such we use those values for every year unless a plant is missing
in 2015 in which case we use the lowest value in the other y... | StarcoderdataPython |
3305643 | <reponame>GTHSRobotics/OpenCV-Experiements
import cv2
import numpy
raw = cv2.imread("images/jewels/001.jpg")
raw = cv2.resize(raw,(800,600))
def DetectBlue(blueIn):
hsv = cv2.cvtColor(blueIn, cv2.COLOR_BGR2HSV)
lower = numpy.array([80, 55, 40])
upper = numpy.array([115, 255, 230])
mask = cv2.inRange... | StarcoderdataPython |
1625185 | <reponame>Jhsmit/PyHDX-paper
from functions.logging import write_log
from functions.base import settings_dict, data_dict, states, input_data_dir, current_dir
from pyhdx.batch_processing import load_from_yaml
from pyhdx.fileIO import csv_to_protein, save_fitresult
from pyhdx.fitting import fit_gibbs_global
import time
... | StarcoderdataPython |
3313200 | ##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# TH... | StarcoderdataPython |
1603435 | <reponame>joinnector/rewardpythonsdk
# client
from joinnector.client.delegate_client import DelegateClient
from joinnector.wrapper.security_wrapper import sucurity_wrapper
from joinnector.wrapper.logging_wrapper import logging_wrapper
from joinnector.wrapper.request_wrapper import request_wrapper
# service
from joinn... | StarcoderdataPython |
3385400 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# pip
import numpy as np
import xarray as xr
# tk
from .util.time_operations import npdt64todatetime
# TODO: refactor con waves.py/hydrographs
class Hydrograph(object):
'Stores hydrograph data'
def __init__(self):
self.date_index = []
self.dates... | StarcoderdataPython |
1743171 | <filename>train.py
import os
import yaml
import argparse
from datetime import datetime
import torch
import random
import metaworld
from garage.experiment.deterministic import set_seed
from src.env import make_env
from src.algorithm import SAC
from src.agent import Agent
def run(args):
set_seed(args.seed)
wit... | StarcoderdataPython |
1700065 | <filename>data/convert_data_ukbb2964.py
# Copyright 2017, <NAME>. 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
#
# U... | StarcoderdataPython |
37821 | from templeplus.pymod import PythonModifier
from toee import *
import tpdp
import char_class_utils
import d20_action_utils
###################################################
def GetConditionName():
return "Duelist"
print "Registering " + GetConditionName()
classEnum = stat_level_duelist
preciseStrikeEnum = 2400
#... | StarcoderdataPython |
3250311 | <reponame>glyg/lap_tracker
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
import numpy as np
import pandas as pd
from .lap_tracking import LAPTracker
DEFAULT_PARAMS = {'n_part': 5,
... | StarcoderdataPython |
3210396 | <reponame>shashank-google/professional-services-data-validator
# Copyright 2020 Google LLC
#
# 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
... | StarcoderdataPython |
3282023 | from .name2idx import C, V
class DifferentialEquation(object):
"""Kinetic equations"""
def __init__(self, perturbation):
super(DifferentialEquation, self).__init__()
self.perturbation = perturbation
def diffeq(self, t, y, *x):
dydt = [0] * V.NUM
dydt[V.MP] = (
... | StarcoderdataPython |
3271885 | <gh_stars>0
import sys
import typing
def copy():
'''Copy the material settings and nodes
'''
pass
def new():
'''Add a new material
'''
pass
def paste():
'''Paste the material settings and nodes
'''
pass
def sss_preset_add(name: str = "", remove_active: bool = False):... | StarcoderdataPython |
3208940 | <gh_stars>0
"""
--- Day 13: Shuttle Search ---
Your ferry can make it safely to a nearby port, but it won't get much further.
When you call to book another ship, you discover that no ships embark from that port to your vacation island.
You'll need to get from the port to the nearest airport.
Fortunately, a shuttle bu... | StarcoderdataPython |
1787253 | <filename>src/Luna.Packages/luna-publish-utils/luna/lunaClient.py
import yaml
import io
import argparse
import json
import os
import requests
import time
TRAINING_URL_FORMAT = "{base_url}/train?api-version={api_version}"
BATCHINFERENCE_URL_FORMAT = "{base_url}/models/{model_id}/batchinference?api-version={api_version... | StarcoderdataPython |
42919 | <gh_stars>0
# Subtract numbers module
class Calculate:
def sub(a, b):
"""Substract two numbers"""
return a - b
def add(a, b):
"""Add two numbers"""
return a + b
def mult(a, b):
"""Product of two numbers"""
return a * b
def div(a, b):
"""Divide two numbers"""
return a / b
| StarcoderdataPython |
182661 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Send SMS to Visitor with leads',
'category': 'Website/Website',
'sequence': 54,
'summary': 'Allows to send sms to website visitor that have lead',
'version': '1.0',
'description': """All... | StarcoderdataPython |
3228562 | # -*- coding: utf-8 -*-
# 14-8-6
# create by: snower
import socket
import threading
from .protocol.result import Result
from .protocol.exceptions import ConnectionClosedError
class Connection(object):
def __init__(self, host="127.0.0.1", port=5658, reader_factory = None):
self._host = host
self._p... | StarcoderdataPython |
104077 | <filename>Project 2/project_1_deblurr.py
import numpy as np
import os
import cv2
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt2
import math
import cmath
#400 0.003 - 0.001
img = cv2.imread("dew on roses (blurred).tif", -1)
m , n = img.shape
kernel = [[1 for x in range(m)] for y in range(n)]
a = 0.0... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.