id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
3402384 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# === This file is part of Calamares - <https://github.com/calamares> ===
#
# Copyright 2014-2015, <NAME> <<EMAIL>>
# Copyright 2014, <NAME> <<EMAIL>>
# Copyright 2017, <NAME> <<EMAIL>>
# Copyright 2019, <NAME> <<EMAIL>>
#
# Calamares is free softwa... | StarcoderdataPython |
11207363 | # Copyright 2013-2015 ARM Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | StarcoderdataPython |
11206000 | <reponame>Astronaut-X-X/easy-redis-by-python
# 客户端连接服务器 IP地址 端口号
host = '127.0.0.1'
port = 6780
| StarcoderdataPython |
1800164 | # addon modules
from . import obj
from . import mesh
from . import material
from . import armature
from . import bone
from . import action
from . import scene
modules = (obj, mesh, material, armature, bone, action, scene)
def register():
for module in modules:
module.register()
def unregister():
f... | StarcoderdataPython |
3469062 | import json
import os
import pytest
import pathlib
import subprocess
import sys
from visual_regression_tracker import Config, MissingConfigurationError
from visual_regression_tracker.config import determine_config_path, ENV_MAPPING
@pytest.fixture
def config_file(tmpdir):
p = tmpdir.join('config.json')
p.wri... | StarcoderdataPython |
215562 | import os
import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Flatten
from tensorflow.keras.callbacks import Callback
from PyQt5.QtCore import QRunnable, pyqtSlot, pyqtSignal, QObject
from .trainingoptions import TrainingOptions
from .architectures import A... | StarcoderdataPython |
4816196 | import json
import pandas as pd
import numpy as np
import random
from collections import Counter
import sys
from src.func import tweet_utils
from src.func import regex
from src.func import labmtgen
from src.scripts.process_tweets import *
from labMTsimple.storyLab import *
### This file contains prior version of som... | StarcoderdataPython |
3571703 | import json
# files = ["../data/train19_dev.json", "../data/train19_train.json", "../data/train19_test.json", "train_large.json"]
files = ["../data/train19_dev.json", "../data/train19_test.json", "train_small.json", "train_large.json"]
def read(file, start_id=0):
with open(file, 'r', encoding='utf-8') as f:
... | StarcoderdataPython |
9639856 | import unittest
from ccdfs import ccdfs
class Test_Case_CCDfs(unittest.TestCase):
def test_ccdfs(self):
self.assertEqual(str(ccdfs({'a': ['c', 'b'],
'b': ['a','c'],
'c': ['b', 'a'],
'd': ['e', 'f'],
'e': ['d', 'f'],
'f': ['e', 'd']})), "{'a': (1, True), 'c'... | StarcoderdataPython |
4955947 | <reponame>grandq33769/gdpr-data-marketplace
from importlib import import_module as im
from data_marketplace.utils.common import to_byte
from data_marketplace.utils.log import logging
log = logging.getLogger('data_marketplace.crypto.hash')
def _hash(contents, hash_algo):
log.info(
"Hashing the file.\n\
... | StarcoderdataPython |
5063687 | <gh_stars>1-10
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.7
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (2, 6, 0):
def swig_import_helper():
f... | StarcoderdataPython |
11362433 | <gh_stars>1-10
# Copyright 2019 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | StarcoderdataPython |
6492956 | <reponame>ccortes1/Event5-Data
from django.db import models
from django.db.models.signals import post_save, post_delete
# Create the models to the api rest.
class UserE(models.Model):
username = models.CharField(max_length=30)
password = models.CharField(max_length=100)
type_user = models.CharField(max_len... | StarcoderdataPython |
8042985 | <gh_stars>10-100
# Copyright 2018 The Texar 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 requir... | StarcoderdataPython |
8178362 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2020 <NAME> <<EMAIL>>
# and the Talkowski Laboratory
# Distributed under terms of the MIT license.
"""
Extract noncoding RNAs as BEDs from Gencode GTF
"""
import pybedtools as pbt
import argparse
from os import path, makedirs
import gzip
import subproc... | StarcoderdataPython |
6486266 | import tkinter
from logic import *
import random
from puzzle import *
UP = 0
RIGHT = 1
DOWN = 2
LEFT = 3
class Player():
def __init__(self):
self.score = 0
self.goal = 2048
def play(self, board):
move = self.scan(board)
self.move(board, move)
def scan(self, board):
... | StarcoderdataPython |
3331148 | """init"""
__version__ = '3.2.0'
| StarcoderdataPython |
11388979 | <gh_stars>1-10
from datetime import datetime, timezone
from pathlib import Path
import numpy as np
from numpy.testing import assert_array_equal
import pandas as pd
import pytest
from athenian.api.controllers.features.github.check_run_metrics_accelerated import \
mark_check_suite_types
from athenian.api.controller... | StarcoderdataPython |
5059966 | <gh_stars>10-100
from datetime import datetime
from problem.models import Problem
from codechef.models import CodechefContest, CodechefContestProblems
def create_or_update_codechefProblem(problemdata):
for problem in problemdata:
Prob, created = Problem.objects.get_or_create(
name=problem['Nam... | StarcoderdataPython |
242126 | from __future__ import with_statement
import os
import subprocess
import errno
import time
import sys
import threading
PIPE = subprocess.PIPE
if subprocess.mswindows:
from win32file import ReadFile, WriteFile
from win32pipe import PeekNamedPipe
from _subprocess import TerminateProcess
import win32event
import ms... | StarcoderdataPython |
6415516 | # To get the necessary file:
# 1. Go to relevant Geonorge link, for example
# 'https://objektkatalog.geonorge.no/Objekttype/Index/EAID_C8092167_3AF8_4668_BDA5_5EBE69CB3645'
# and download the csv file
# 2. Make sure the path to the downloaded csv file is correct
# To run from the console:
# 1. Go the the direct... | StarcoderdataPython |
1755466 | from mdde.core.exception import MddeError
class FragmentationError(MddeError):
"""Error creating an instance of the environment"""
def __init__(self, message: str):
super(FragmentationError, self).__init__(message)
| StarcoderdataPython |
1630177 | #!/usr/bin/env python3
# Copyright 2020 Mobvoi AI Lab, Beijing, China (author: <NAME>)
# Apache 2.0
import unittest
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir))
import shutil
from tempfile import mkdtemp
import numpy as np
import kaldi
class TestIOUtil(unittest.Te... | StarcoderdataPython |
3357673 | <reponame>EricBastos/Tetris-RL<gh_stars>0
from .gamemode import GameMode
import pygame
from ..tiles import Board, Tetromino, Tile
from ..rl import ListMoves
import random
import numpy as np
from tetris import settings
class TetrisMode(GameMode):
def __init__(self):
pygame.init()
self.clock = pyg... | StarcoderdataPython |
238853 | # Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project au... | StarcoderdataPython |
12834305 | """
<NAME>017
Variational Autoencoder - Pan Cancer
scripts/adage_pancancer.py
Comparing a VAE learned features to ADAGE features. Use this script within
the context of a parameter sweep to compare performance across a grid of
hyper parameters.
Usage:
Run in command line with required command arguments:
... | StarcoderdataPython |
1834235 | """Unique constraint for roles
Revision ID: <KEY>6
Revises: <PASSWORD>
Create Date: 2016-07-10 14:18:46.455411
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<PASSWORD>'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ple... | StarcoderdataPython |
340359 | """ This module renders profiles """
import json
from rest_framework.renderers import JSONRenderer
class ProfileJsonRenderer(JSONRenderer):
"""
Renders profile in JSON
"""
charset = 'utf-8'
def render(self, data, media_type=None, renderer_context=None):
"""
Perfoms the renderin... | StarcoderdataPython |
12837005 | <filename>system.py<gh_stars>0
# PackedBerry System
import requests
import random
import os
import youtubesearchpython
def search_video(query:str):
videosSearch = youtubesearchpython.VideosSearch(str(query), limit = 1)
return videosSearch.result()
def get_video_data(query:dict):
r = {}
d = search_video(query)
f... | StarcoderdataPython |
9656764 | import serial
import time
# sudo sh -c "echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
# 1500000
BAUD = 115200
ser0 = serial.Serial('/dev/ttySC1', BAUD, timeout=0.5)
print(ser0.name)
# ser1 = serial.Serial('/dev/ttySC1', BAUD, t... | StarcoderdataPython |
6619648 | from common.webdriver_factory import get_driver
from selenium.webdriver.support.wait import WebDriverWait
driver = get_driver('chrome')
wait = WebDriverWait(driver, 10)
driver.get('https://www.amazon.com/')
elements = driver.find_elements_by_xpath("//a")
print(f'Tags con A encontrados: {len(elements)}')
for element i... | StarcoderdataPython |
3376848 | <filename>bismark_bomber.py
import requests
import datetime
import services
#Цвета
green = '\033[92m'
cyan = '\033[95m'
bold = '\033[1m'
underline = '\033[4m'
end = '\033[0m'
red = '\033[91m'
#Хедер
print(f"{green}{bold}\t\t{underline}[Bismark BOMBER ]{end}")
print()
print(f"{bold}Coded by{... | StarcoderdataPython |
9769363 | <filename>mysite/learn5/migrations/0002_running_material_running_member.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('learn5', '0001_initial'),
]
operations = [
migrat... | StarcoderdataPython |
1882434 | # -*-coding: utf-8-*-
# @Author : Charlesxu
# @Email : <EMAIL>
from layers import *
class SelfAttention(Layer):
def __init__(self):
super(SelfAttention, self).__init__()
def build(self, input_shape):
self.dim = input_shape[0][-1]
self.W = self.add_weight(shape=[self.dim, self.dim],... | StarcoderdataPython |
3414598 | <filename>slimta/smtp/datareader.py<gh_stars>100-1000
# Copyright (c) 2012 <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 right... | StarcoderdataPython |
4986906 | import websockets
import asyncio
import json
import argparse
from ButtonFrame import ButtonFrame
from tkinter import Tk
parser = argparse.ArgumentParser()
parser.add_argument("--ip", default="127.0.0.1")
parser.add_argument("--port", default=80)
args = parser.parse_args()
URL = "ws://" + args.ip + ":" + f"{args.po... | StarcoderdataPython |
357716 | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modif... | StarcoderdataPython |
1714465 | # -*- coding: utf-8 -*-
"""
Spyder Editor
15201002 <NAME>
"""
#initializing PCA
from sklearn import decomposition
pca=decomposition.PCA()
import pandas as pd
import numpy as np
import seaborn as sn
import matplotlib.pyplot as plt
from sklearn.preprocessing import StandardScaler
data=pd.read_csv('Thesis_responses_Scal... | StarcoderdataPython |
3434036 | <reponame>lechat/jenkinsflow
# This ensures that the demos can find jenkinsflow even though it has not been installed
import sys
import os.path
from os.path import join as jp
def sys_path():
here = os.path.dirname(__file__)
sys.path.append(jp(here, '../..'))
| StarcoderdataPython |
198279 | __version__ = '0.0.1a7'
__bitcoind_version_emulation__ = '0.16'
| StarcoderdataPython |
3311418 | # TODO: Keep these in the saved model instead.
IMAGENET_LABELS = """
background
tench
goldfish
great white shark
tiger shark
hammerhead
electric ray
stingray
cock
hen
ostrich
brambling
goldfinch
house finch
junco
indigo bunting
robin
bulbul
jay
magpie
chickadee
water ouzel
kite
bald eagle
vulture
great grey owl
Europea... | StarcoderdataPython |
1647360 | from flask import current_app as app
class Category:
def __init__(self,name):
self.name = name
# get all avaliable categories in the database
@staticmethod
def get_by_id(cid:int):
rows = app.db.execute(f'''
SELECT id AS cid, name AS name
FROM Categories
... | StarcoderdataPython |
1917752 | <gh_stars>0
# Copyright (c) 2021 <NAME>
#
# Licensed under the MIT Licens (the "License").
#
# 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 limitatio... | StarcoderdataPython |
13315 | voc_it = [
['a', 'noun', 'c'],
['a', 'preposition', 'a'],
['abbagliante', 'pres_part', 'c'],
['abbagliante', 'adjective', 'c'],
['abbagliante', 'noun', 'c'],
['abbaiare', 'verb', 'c'],
['abbandonare', 'verb', 'a'],
['abbandonato', 'past_part', 'b'],
['abbandonato', 'adjective', 'b'],
['abbandono', 'noun', 'b'],
['abbas... | StarcoderdataPython |
3251113 | <reponame>hakank/hakank
"""
K4P2 Graceful Graph in cpmpy.
http://www.csplib.org/Problems/prob053/
'''
Proposed by <NAME>
A labelling f of the nodes of a graph with q edges is graceful if f assigns each node a unique label
from 0,1,...,q and when each edge xy is labelled with |f(x)-f(y)|, the edge labels are all differ... | StarcoderdataPython |
1733458 | #!/usr/bin/env python
from systemofrecord.server import app
app.run(host="0.0.0.0", port=8003, debug=True, processes=3)
| StarcoderdataPython |
11292084 | <gh_stars>0
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Contest: Google Code Jam - 2010 Round 1C
# Problem: A. Rope Intranet
# URL: https://code.google.com/codejam/contest/619102/dashboard#s=p0
# Author: <NAME>
# Strategy:
# i 番目の線と j 番目の線が交わる条件は、始点と終点の上下が入れ替わるときなので、
# A[i] < A[j] and B[i] > B[j]
# ... | StarcoderdataPython |
4905091 | <gh_stars>1-10
# RTS Blinking
# Requires PySerial
# (c) www.xanthium.in 2021
# Rahul.S
import serial
import time
HIGH = 1
LOW = 0
SerialObj = serial.Serial('COM6',9600) # COMxx format on Windows
#/dev/ttyUSBx format on Linux
#
... | StarcoderdataPython |
205030 | <reponame>bagustris/nkululeko<gh_stars>0
import glob_conf
from util import Util
import pandas as pd
class Test_predictor():
def __init__(self, model, orig_df, label_encoder, name):
"""Constructor setting up name and configuration"""
self.model = model
self.orig_df = orig_df
self.l... | StarcoderdataPython |
1835727 | """
Function: helps to convert a very long list variable into a string with multiple lines that can be fit into the text box of powerpoint
Author: <NAME>
Date: 07/23/2020
"""
def change_lines(range_list, width=90):
"""
convert a very long list into a string with multiple lines
:param range_list:... | StarcoderdataPython |
3479697 | <reponame>w3c/feedvalidator
#!/usr/bin/python
__author__ = "<NAME> <http://intertwingly.net/> and <NAME> <http://diveintomark.org/>"
__version__ = "$Revision$"
__copyright__ = "Copyright (c) 2002 <NAME> and <NAME>"
import feedvalidator
import sys
import os
import urllib.request, urllib.parse, urllib.error
import urll... | StarcoderdataPython |
12827525 | <reponame>tehcyx/test-infra-k8s
#!/usr/bin/env python
# Copyright 2017 The Kubernetes Authors.
#
# 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-... | StarcoderdataPython |
1680204 | # Copyright (c) 2013-2018, Rethink Robotics 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 law or ag... | StarcoderdataPython |
142711 | import torch
from torchtext.datasets import DATASETS
class BatchTextClassificationData(torch.utils.data.IterableDataset):
def __init__(self, dataset_name, batch_size=16):
super(BatchTextClassificationData, self).__init__()
self._iterator = DATASETS[dataset_name](split='train')
self.batch_... | StarcoderdataPython |
11255510 | <reponame>praisetompane/3_programming<gh_stars>0
def isPrime(number):
for i in range(2, number):
if number % i == 0:
return False
return True
print(isPrime(2))
print(isPrime(7)) | StarcoderdataPython |
6684909 | <gh_stars>0
from check_mk_web_api.web_api_base import WebApiBase
class WebApiProblems(WebApiBase):
def get_svc_problems(self):
"""
Get current SVC problems
"""
return self.make_view_name_request('svcproblems')
| StarcoderdataPython |
224489 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""""""
import tkinter as tk
from tkinter import ttk
# https://developer.gnome.org/gtk3/stable/GtkSwitch.html
__title__ = "ButtonSwitch"
__version__ = "1.0.0"
__author__ = "DeflatedPickle"
class ButtonSwitch(ttk.Frame):
"""
-----DESCRIPTION-----
A “l... | StarcoderdataPython |
1982755 | """
@author: <NAME>
@contact: yuhao.cheng[at]outlook.com
"""
from torch.utils.data import Dataset
__all__ = ['AbstractImageDataset']
class AbstractImageDataset(Dataset):
_NAME = 'AbstractImageDataset'
def __init__(self, dataset_folder, transforms):
self.dir = dataset_folder
self.tra... | StarcoderdataPython |
9787374 | #!/usr/bin/python
#-*- encoding: utf8 -*-
import rospy
from std_msgs.msg import Bool, String, Empty
from mind_msgs.msg import RaisingEvents, SetIdleMotion
class TurnDetectorNode:
def __init__(self):
rospy.Subscriber('raising_events', RaisingEvents, self.handle_raising_events)
rospy.Subscriber('rob... | StarcoderdataPython |
166726 | <gh_stars>0
# -*- coding: utf-8 -*-
import sys
sys.path.append("./voc")
from rnaudio import *
from bdasr import *
from rntuling import *
CMD_LST = ["前进","后退","左转","右转","停止"]
# 检测语音内容是否为命令
def checkCmd(text):
if(CMD_LST.index(text) < 0):
return False
return True
# 执行命令
def exeCmd(cmd... | StarcoderdataPython |
1634197 | <gh_stars>10-100
from django.http import HttpResponse
import logging
from test_utils.testmaker.processors.base import slugify
from test_utils.testmaker import Testmaker
def set_logging(request, filename=None):
if not filename:
filename = request.REQUEST['filename']
filename = slugify(filename)
lo... | StarcoderdataPython |
1912127 | import numpy as np
from tensorflow.keras import Model, Input, Sequential
from tensorflow.keras.layers import TimeDistributed, Dense, Flatten
from tensorflow.keras.optimizers import Adam
from self_supervised_3d_tasks.algorithms.algorithm_base import AlgorithmBuilderBase
from self_supervised_3d_tasks.preprocessing.prepr... | StarcoderdataPython |
1702296 | import pybullet as p
p.connect(p.GUI)
cube = p.loadURDF("cube.urdf")
frequency = 240
timeStep = 1./frequency
p.setGravity(0,0,-9.8)
p.changeDynamics(cube,-1,linearDamping=0,angularDamping=0)
p.setPhysicsEngineParameter(fixedTimeStep = timeStep)
for i in range (frequency):
p.stepSimulation()
pos,orn = p.getBasePositio... | StarcoderdataPython |
1845789 | from mock import MagicMock
def test_with_metaclass():
import momox.compat
mc_new_called = MagicMock()
class Meta(type):
def __new__(mcls, name, bases, attrs):
mc_new_called.assert_not_called()
mc_new_called()
assert name == 'TestClass'
assert bases... | StarcoderdataPython |
1615373 | <filename>experiments/predict_on_cineca/move_dreyeve_gt_to_cineca.py
import paramiko
from glob import glob
import os
from tqdm import tqdm
import argparse
if __name__ == '__main__':
# parse arguments
parser = argparse.ArgumentParser()
parser.add_argument("--host")
parser.add_argument("--user")
pa... | StarcoderdataPython |
3314936 | from PyQt4 import QtGui, QtCore
from epubcreator.gui.forms import about_dialog_ui
from epubcreator import version
class About(QtGui.QDialog, about_dialog_ui.Ui_Dialog):
def __init__(self, parent=None):
super().__init__(parent)
self.setupUi(self)
self.versionLabel.setText(version.VERSION)... | StarcoderdataPython |
11283329 | from KMCLib import *
import numpy
# Define the unit cell. We're going for hcp here, with c/a set for sphere-packing ratio for now.
cell_vectors = [[1.0,0.0,0.0],
[0.0,1.0,0.0],
[0.0,0.0,1.0]]
# I've set these up so that the Titaniums sit on the 1st and 3rd basis points, and the Oxygens... | StarcoderdataPython |
11288783 | # Generated by Django 3.0 on 2020-08-24 07:20
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('debugtalks', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='... | StarcoderdataPython |
1800178 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/9/21 11:15
# @Author : ganliang
# @File : ndsort.py
# @Desc : 排序
import numpy as np
a = np.array([[3, 7], [9, 1]])
print ('我们的数组是:')
print (a)
print ('\n')
print ('调用 sort() 函数:')
print (np.sort(a))
print ('\n')
print ('按列排序:')
print... | StarcoderdataPython |
1647361 | # Copyright 2020 The SODA Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | StarcoderdataPython |
9757705 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from typing import List, Tuple
import cv2 as cv
import numpy as np
from sklearn.decomposition import TruncatedSVD
def resize_SVD(imgs: np.ndarray) -> Tuple[np.ndarray, List[str]]:
"""
Extract features for each image by dimension reduct... | StarcoderdataPython |
3549381 | <reponame>rsintheta/collectible-app-api<gh_stars>0
from django.contrib.auth import get_user_model as gum
from django.urls import reverse
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from base.models import Tag, Collection
from collection.serializers import... | StarcoderdataPython |
5154029 | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | StarcoderdataPython |
6530652 | # coding=utf-8
from connectMysql import OrderMysql, RouteMysql, RecordMysql, MoneyMysql, GameRecordMysql, MeanMysql
from entity.baseClass import Order
import random
import numpy as np
from datetime import*
class GameState:
def __init__(self, routeLine, routeList):
# 连接数据库
'''
self.om = Ord... | StarcoderdataPython |
11392422 | # Copyright 2014 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Main entry point for Swarming backend handlers."""
import datetime
import json
import logging
import webapp2
from google.appengine.api import... | StarcoderdataPython |
166401 | <filename>pre_processing.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 24 17:44:54 2019
@author: meliude
"""
import pygrib
import pandas as pd
years = ['1998.grib', '1999.grib', '2000.grib', '2001.grib', '2002.grib', '2003.grib', '2004.grib', '2005.grib', '2006.grib', '2007.grib', '2008.gr... | StarcoderdataPython |
4967952 | <filename>tests/test_utils.py
from app import utils
from tests.base_test_case import BaseTestCase
class TestStatusMethod(BaseTestCase):
def test_size_valid(self):
data = {'width': 1, 'height': 1}
self.assertTrue(utils.size_valid(data))
data = {'width': 0, 'height': 0}
self.assertFa... | StarcoderdataPython |
6699723 | <filename>handlers/es_publisher.py
'''Write event data to elasticsearch'''
import logging
import json
import os
from elasticsearch import Elasticsearch
log_level = os.environ.get('LOG_LEVEL', 'INFO')
logging.root.setLevel(logging.getLevelName(log_level)) # type: ignore
_logger = logging.getLogger(__name__)
ES_HOST... | StarcoderdataPython |
3234929 | <gh_stars>0
from marshmallow import Schema as BaseSchema
from marshmallow import SchemaOpts as BaseSchemaOpts
from marshmallow import fields, validate
from marshmallow_enum import EnumField
from .models import Corrected, Correction, CorrectionEdit, Play, PlayEdit, RecordedPlay
class SchemaOpts(BaseSchemaOpts):
d... | StarcoderdataPython |
11368145 | <filename>util/globaltokens.py
import brownie
from enforce_typing import enforce_types
from util.constants import BROWNIE_PROJECT057, GOD_ACCOUNT
from util.base18 import toBase18
_OCEAN_TOKEN = None
@enforce_types
def OCEANtoken():
global _OCEAN_TOKEN # pylint: disable=global-statement
try:
token =... | StarcoderdataPython |
1988808 | <gh_stars>0
def serialize(value):
'''
No serialization
'''
return value
def deserialize(key, value):
'''
No deserialization
'''
return value
| StarcoderdataPython |
5061864 | # -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.15.2)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x36\xcf\
\xff\
\xd8\xff\xe0\x00\x10\x4a\x46\x49\x46\x00\x01\x01\x01\x00\x90\x00\
... | StarcoderdataPython |
9626159 | <gh_stars>1-10
"""
Relief Visualization Toolbox – Visualization Functions
RVT Sky illumination raster function
rvt_py, rvt.vis.sky_illumination
Credits:
<NAME> (<EMAIL>)
<NAME> (<EMAIL>)
<NAME>
<NAME>
<NAME>
<NAME>
<NAME>
Copyright:
2010-2020 Research Centre of the Slovenian Academy o... | StarcoderdataPython |
39484 | import feedparser
import difflib
import json
cbc = feedparser.parse("http://rss.cbc.ca/lineup/topstories.xml")
print(json.dumps(cbc))
print("\n\n################################################\n\n")
cnn = feedparser.parse("http://rss.cnn.com/rss/cnn_topstories.rss")
print(json.dumps(cnn))
print("\n\n##################... | StarcoderdataPython |
8188350 | from __future__ import annotations
import io
import logging
import sys
import time
import requests
from json import JSONDecodeError
from typing import Any, List, NoReturn, Optional, Union, TYPE_CHECKING
from .attachments import CTA, CustomProfile, File, Geo, Poll, QuickReply
from .auth import OauthSession
from .enums... | StarcoderdataPython |
3334515 | print('Aqui iremos pegar um valor e mostrar alguns resultados, como o\nDOBRO\nTRIPRO\nRAIZ QUADRADA')
valor = int(input('Informe um valor: '))
print('O dobro de {}, será {}'.format(valor, valor*2))
print('O triplo de {}, será {}'.format(valor, valor*3))
#Em números com bastantes casas decimais, se quisermos diminuir co... | StarcoderdataPython |
11224553 | <filename>Assignment_2/rekognition.py
"""
__author__ = "<NAME>"
__version__ = "1.0"
__git__ = "https://github.com/parampopat/"
__reference__ = "https://boto3.amazonaws.com/v1/documentation/api/latest/index.html"
"""
import boto3
import time
def create_collection(collection_id):
"""
:source: https://docs.aws.... | StarcoderdataPython |
8040110 | #!/usr/bin/python3
import os
import pycommon.advent as advent
problem_key = os.path.basename(__file__).replace(".py", "")
question_groups = []
def get_unique_counts(line):
line = line.replace(' ', '')
counts = {}
for index in range(0, len(line)):
key = line[index]
counts[key] = True
... | StarcoderdataPython |
5035448 | # Import libraries
import speech_recognition as sr
import datetime
r = sr.Recognizer()
# Get the default microphone
with sr.Microphone() as source:
# Listens to a command, using AVD
while True:
audio = r.listen(source)
# Recognizes speech using Google as a service: online, slow.
goog... | StarcoderdataPython |
4821390 | <filename>simple_CA.py<gh_stars>0
import numpy as np
import tkinter as tk
import matplotlib.pyplot as plt
import datetime
from matplotlib import cm
from PIL import Image, ImageTk
window = tk.Tk()
window.title("simple_CA")
window.geometry('600x670')
window.configure(background='black')
width, height = 600, 600
size = (... | StarcoderdataPython |
6569840 | <reponame>ONSdigital/ras-frontstage
import io
import unittest
from unittest.mock import patch
import requests_mock
from frontstage import app
from tests.integration.mocked_services import (
business_party,
collection_exercise,
collection_instrument_seft,
encoded_jwt_token,
encrypted_enrolment_code... | StarcoderdataPython |
8183927 | <reponame>xykivo/percipio
# BSD 3-Clause License
#
# Copyright (c) 2019-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 cop... | StarcoderdataPython |
3565110 | <gh_stars>1-10
import numpy
from scipy import optimize
c = numpy.array([0,0,0,0,1])
A_ub = numpy.array([[1,0,0,0,-1],[0,1,1,0,-1],[0,0,0,1,-1]])
b_ub = numpy.array([-29,0,-10])
A_eb = numpy.array([[1,1,0,0,0],[0,0,1,1,0]])
b_eb = numpy.array([12,12])
all_bounds = (0,None)
res = optimize.linprog(c,A_ub,b_ub,A_eb,b_eb... | StarcoderdataPython |
6431403 | <reponame>techdad/ansible-role-hosts-file
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_hosts_file_exists(host):
f = host.file('/etc/hosts')
assert f.exists
assert f.use... | StarcoderdataPython |
6460946 | import sys
import os
import random
import time
import pygame
import math
import random
from square import *
from constants import *
from pygame.locals import *
class Grid:
"""Game grid and everything it needs"""
def __init__(self, x, y, walls):
"""Initiate the grid
Args:
x (int):... | StarcoderdataPython |
1980658 | <filename>app/__init__.py
from flask import Flask
import os
#from model import LSCCNN
basedir = os.path.abspath(os.path.dirname(__file__))
app = Flask(__name__)
app.config.from_object(__name__)
# Load model
#checkpoint_path = path_to_gcp_bucket
#model = LSCCNN(checkpoint_path=checkpoint_path)
#model.eval()
#model.c... | StarcoderdataPython |
8016106 | <reponame>gmoraitis/sports-betting<gh_stars>10-100
"""
Download and transform historical and fixtures data
for various leagues from Football-Data.co.uk.
Football-Data.co.uk: https://www.football-data.co.uk/data.php
"""
# Author: <NAME> <<EMAIL>>
# License: MIT
from urllib.request import urlopen, urljoin
from datetim... | StarcoderdataPython |
1970294 | <gh_stars>10-100
# NOTE: this file is designed to be imported by Huey, the background job processor
# It changes the logging configuration. If it's imported anywhere else in the app,
# it will change the logging configuration for the entire app.
import logging
logging.getLogger("requests").setLevel(logging.WARNING)
log... | StarcoderdataPython |
4838833 | class Solution:
def XXX(self,x):
xx=x
y=1
if x<0:
xx=-x
y=-1
list1=int(str(xx)[::-1])*y
cc=0 if list1<-(2**31-1) or list1>2**31 else list1
return cc
| StarcoderdataPython |
5142251 | <reponame>isabella232/cloud-costs
#!/usr/bin/env python
''' Script to ingest GCP billing data into a DB '''
import logging
import os
import re
import sys
from datetime import datetime
from dateutil.relativedelta import relativedelta
from dateutil.parser import parse as parse_date
import transaction
from gcloud impo... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.