id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
1693443 | from PyQt5 import QtCore
def load_style_sheet():
"""
Loads style.qss content.
:return: style sheet for :class:`main.MainWindow`
:rtype: str
"""
style = QtCore.QFile(f'style.qss')
if not style.exists():
return
else:
style.open(QtCore.QFile.ReadOnly | QtCore.QFile.Text... | StarcoderdataPython |
1763855 | from nzpy.core import (ArrayContentNotHomogenousError,
ArrayContentNotSupportedError,
ArrayDimensionsNotConsistentError, BINARY,
Binary, Connection, Cursor, DataError,
DatabaseError, Date, DateFromTicks, Error,
... | StarcoderdataPython |
150839 | <reponame>hafeez3000/taurus
import os
from collections import Counter
import time
from tests import BZTestCase, random_datapoint
from tests.mocks import EngineEmul
from bzt.modules.blazemeter import BlazeMeterUploader, CloudProvisioning
from bzt.modules.reporting import FinalStatus
from bzt.utils import BetterDict
fro... | StarcoderdataPython |
161252 | """
用于减少编码中的多个简单条件if分支,
实现类似 java spring 中通过 application context 生命周期回调实现的工厂路由
实例见下方test
"""
import functools
from blinker import Signal
def dispatch(func):
"""
入口方法装饰器
:param func: 入口方法
:return: 装饰后的方法
"""
# 路由表
signal_ = Signal()
@functools.wraps(func)
def wrapper(arg0, *arg... | StarcoderdataPython |
4808142 | <reponame>willyspinner/High-Performance-Face-Recognition<gh_stars>100-1000
import scipy.io as sio
import pickle
import numpy as np
import os
import numpy as np
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
from scipy import spatial
from sklearn.externals import joblib
import tim... | StarcoderdataPython |
1773211 | """
Copyright Amazon.com, Inc. or its affiliates. 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... | StarcoderdataPython |
129919 | #!/usr/bin/env python
import ConfigParser
import argparse
import cStringIO
import deploy_config
import getpass
import hashlib
import os
import pprint
import re
import service_config
import socket
import string
import subprocess
import sys
import telnetlib
import tempfile
import time
import uuid
from datetime import d... | StarcoderdataPython |
154319 | from tests.testutils.mocks.mock_paths import MockPaths
def test_app():
with MockPaths():
from tilescopegui.factory import TestingConfig, create_app
app = create_app(TestingConfig())
app.blueprints["home_blueprint"].template_folder = MockPaths._TMP.as_posix()
yield app
| StarcoderdataPython |
86418 | <reponame>tirkarthi/odin-ai<gh_stars>0
from __future__ import absolute_import, division, print_function
import os
import pickle
import warnings
from collections import defaultdict
import matplotlib.mlab as mlab
import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt
from scipy import stats
from ... | StarcoderdataPython |
1680380 | <reponame>zaehuun/osscap2020
from pytet import *
NowRoad=[10,10,10,10,10,10,10,10,0,0,0,0,0,0,0,0,10,10,10,10,10,10,10,10]
NList=[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]
#모든 방향은 LED Matrix 출력 기준임(좌우가 바꿔어 있음)
def NR():
return NowRoad
def R1(): #길전체가 오른쪽으로 이동
if NowRoad[5]==0: #벽에 붙었다면 실행X
... | StarcoderdataPython |
75741 | <filename>phishing/setmail.py
#!/usr/bin/env python
# Copyright (c) 2012, AverageSecurityGuy
# 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 ab... | StarcoderdataPython |
3212602 | from numpy import eye
def warmUpExercise():
""" an example function that returns the 5x5 identity matrix
"""
return eye(5)
| StarcoderdataPython |
52837 | <reponame>JiangYangJie/Embedded<filename>esp8266/clock/printf.py
from dictionary import dicts
class Printf:
def __init__(self,oled):
self.oled=oled
self.clear()
def clear(self):#清屏
self.oled.fill(0)
self.oled.show()
def en(self, String, x, y):#显示英文,oled:屏幕对象,string:英文内容,x,... | StarcoderdataPython |
56687 | <gh_stars>1-10
import cv2
import os
def detect_faces_from_webcam(webcam_index=0, window_title='Faces In Video', cascade='haarcascade_frontalface_default.xml',box_colour=(0, 255, 0), line_thickness=2):
face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + cascade)
cap = cv2.VideoCapture(webcam_index)
... | StarcoderdataPython |
1761077 | __all__ = ("IntegerMetaMap", "ScalarMetaMap", "MSpec")
import typing
from enum import IntEnum
from functools import lru_cache
from collections import OrderedDict
from warnings import warn
from .Spec import *
from .ArraySpec import ArraySpec
from .SpecNoIntegers import IntegerMetaMap
from .SpecNoScalars import ScalarMe... | StarcoderdataPython |
173467 | <gh_stars>1-10
"""**DEPRECATED** - Instead, use `@rules_rust//crate_universe:repositories.bzl"""
load(":repositories.bzl", "crate_universe_dependencies")
def crate_deps_repository(**kwargs):
# buildifier: disable=print
print("`crate_deps_repository` is deprecated. See setup instructions for how to update: htt... | StarcoderdataPython |
1750209 | # 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 writing, software
# distributed under t... | StarcoderdataPython |
1726921 | # -*- coding: utf-8 -*-
from setuptools import setup
try:
from pip._internal.req import parse_requirements
except:
from pip.req import parse_requirements
install_reqs = list(parse_requirements("requirements.txt", session={}))
def version():
from stubilous import version
return version.get_version()
... | StarcoderdataPython |
4832338 | import ast
import json
import os
import unicodedata
import base64
from amazon.api import AmazonAPI
import logging
import base64
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
def elicit_intent(message, responsecards):
return {
'dialogAction' : {
'type' : 'ElicitIntent',
'message' :... | StarcoderdataPython |
1661681 | <gh_stars>0
from django.db import models
class Wine(models.Model):
name=models.CharField(max_length=255)
description=models.TextField()
points=models.IntegerField(blank=False, default=0)
price=models.DecimalField(blank=False, default=0, max_digits=999, decimal_places=2)
ratio=models.DecimalField(bl... | StarcoderdataPython |
1657855 | <filename>src/server/app/main/models/ChallengesModel.py
from .. import db
import datetime
from . import ChallengesTagsModel
class ChallengesModel(db.Model):
"""
[summary]
Args:
ChallengesMixin ([type]): [description]
db ([type]): [description]
"""
__tablename__ = "challenges"
... | StarcoderdataPython |
109754 | <filename>tests/pyxb/test-reserved.py
import unittest
import pyxb.binding.basis
class TestReserved (unittest.TestCase):
def testSTD (self):
tSTD = pyxb.binding.basis.simpleTypeDefinition
for k in tSTD.__dict__.keys():
if not k.startswith('_'):
self.assertTrue(k in tSTD._... | StarcoderdataPython |
147507 | <filename>model/constants.py<gh_stars>1-10
'''
MIT License
Copyright (c) 2020 <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
t... | StarcoderdataPython |
187828 | <filename>kthSmallestElementBST.py
class Solution(object):
def kthSmallest(self, root, k):
"""
:type root: TreeNode
:type k: int
:rtype: int
"""
stack = [root]
BST_vals = []
while stack:
curr = stack.pop()
BST_vals.appe... | StarcoderdataPython |
1685898 | """
https://en.wikipedia.org/wiki/Binary_search_algorithm
"""
def binary_search_recursion(array, key, left: int = 0, right: int = None) -> int:
"""
Binary search algorithm using recursion.
:param array: the sorted array to be searched.
:param key: the key value to be searched.
:param left: the lef... | StarcoderdataPython |
1730605 | # ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.8.0
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %% [markdown]
#
# <... | StarcoderdataPython |
1554 | <gh_stars>0
import emoji
import sentiment_analysis.src.report.cons_report as cons
import sentiment_analysis.src.constants as global_cons
from utils.data_connection.api_data_manager import APISourcesFetcher
from utils.utilities import read_json_file, CUSTOM_YEAR_WEEK_AGG, extract_dimension, extract_question
from sentim... | StarcoderdataPython |
17786 | <reponame>vishalbelsare/jina
from typing import Optional, Dict, Any
from fastapi import APIRouter
from jina.helper import ArgNamespace
from jina.parsers import set_pod_parser
from ....excepts import PartialDaemon400Exception
from ....models import PodModel
from ....models.partial import PartialStoreItem
from ....store... | StarcoderdataPython |
70328 | <gh_stars>0
import torch
class RegressionEvaluationMetrics(object):
@staticmethod
def r_squared(output, target):
x = output
y = target
vx = x - torch.mean(x)
vy = y - torch.mean(y)
cost = torch.sum(vx * vy) / (torch.sqrt(torch.sum(vx ** 2)) * torch.sqrt(torch.sum(vy **... | StarcoderdataPython |
3223901 | <filename>Cloud-Net-A-semantic-segmentation-CNN-for-cloud-detection/Cloud-Net/augmentation.py<gh_stars>0
import numpy as np
import skimage
import skimage.transform as trans
"""
Some lines borrowed from: https://www.kaggle.com/sashakorekov/end-to-end-resnet50-with-tta-lb-0-93
"""
def rotate_clk_img_and_msk(img, msk):... | StarcoderdataPython |
3239076 | from PyQt5 import QtWidgets, QtCore
class LineEdit(QtWidgets.QLineEdit):
activated = QtCore.pyqtSignal(str)
def __init__(self, parent=None):
super().__init__(parent=parent)
go_icon = self.style().standardIcon(QtWidgets.QStyle.SP_DialogOkButton)
activated_action = self.addAction(go_ico... | StarcoderdataPython |
4834459 | <reponame>monisjaved/Data-Processing-With-Hadoop<gh_stars>1-10
#!/usr/bin/env python
import sys
for line in sys.stdin:
# remove leading and trailing whitespace
line = line.strip()
# split the line into words
words = line.split()
for i in xrange(len(words)-1):
for j in range(i+1,len(words)... | StarcoderdataPython |
3285554 | <filename>rsHRF/rsHRF_GUI/gui_windows/inputWindow.py
import os
from tkinter import Toplevel, Checkbutton, IntVar, Button, filedialog, NORMAL, DISABLED, OptionMenu, StringVar, Label
class InputWindow():
def __init__(self):
# input window
window = Toplevel()
window.title("Input Window"... | StarcoderdataPython |
1609896 | # Copyright (C) 2020 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# pylint: disable=maybe-no-member, invalid-name, too-many-lines
"""Test request import and updates."""
import unittest
import datetime
import collections
import ddt
import freezegun
from mock import mock... | StarcoderdataPython |
198372 | <gh_stars>100-1000
def up(config, database, semester, course):
database.execute("UPDATE threads SET deleted = false WHERE merged_thread_id <> -1")
| StarcoderdataPython |
3286731 | <filename>lib/ansible/modules/network/fadcos/fadcos_route_static.py
#!/usr/bin/python
#
# This file is part of Ansible
#
#
#updata date:2019/03/12
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['pre... | StarcoderdataPython |
32609 | import abc
from collections import OrderedDict
from .constants import RESULT_KEY_MAP
class ResultMessageBase(abc.ABC):
"""
Result message base class.
"""
@abc.abstractmethod
def get_content(self, custom_data=None):
"""
Get message content.
Args:
custom_data ... | StarcoderdataPython |
1790865 | #!/usr/bin/env python
import argparse
import random
import socket
import sys
import urlparse
import json
from wsgiref.simple_server import make_server
TIMEZONE = "US/Central"
def validate_parameters(query_dict, parameters):
"""
Check parameters in query_dict using the parameters specified
:param query_d... | StarcoderdataPython |
1654138 | <reponame>selectel/python-selvpcclient
import pytest
from tests.cli import make_client, run_cmd
from tests.util import answers
from tests.util import params
def test_show_theme_b64():
client = make_client(return_value=answers.CUSTOMIZATION_SHOW)
args = ['customization show', '--show-base64']
output = ru... | StarcoderdataPython |
1711485 | horas_mensais = float(input('Horas mensais de trabalho: '))
ganho_por_hora = float(input('Valor por hora trabalhada: '))
salario_bruto = (horas_mensais * ganho_por_hora)
inss = (8/100) * (salario_bruto)
imposto_de_renda = (11/100) * (salario_bruto)
sindicato = (5/100) * (salario_bruto)
descontos = (inss + imposto_de_re... | StarcoderdataPython |
1629778 | """ Cisco_IOS_XR_crypto_sam_oper
This module contains a collection of YANG definitions
for Cisco IOS\-XR crypto\-sam package operational data.
This module contains definitions
for the following management objects\:
sam\: Software authentication manager certificate information
Copyright (c) 2013\-2016 by Cisco Sys... | StarcoderdataPython |
26124 | <reponame>lamenezes/certificator<filename>certificator/meetup/__init__.py
from datetime import datetime as dt
from .client import MeetupClient
from ..certificator import BaseCertificator
from .models import Event
class MeetupCertificator(BaseCertificator):
def __init__(self, urlname, event_id, api_key, **kwargs)... | StarcoderdataPython |
1718214 | # Copyright 2018 Samsung Electronics
# 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 requi... | StarcoderdataPython |
3350440 | <filename>slackbot/plugins/secrefs.py
__author__ = 'jayk'
import re
from slackbot.bot import respond_to
from slackbot.bot import listen_to
@respond_to('secbot', re.IGNORECASE)
def hello_reply(message):
message.reply('hello human!')
@respond_to('what is (.*)')
def whatis(message, something):
message.reply('... | StarcoderdataPython |
3300704 | # pylint: skip-file
from data import mnist_iterator
import mxnet as mx
import numpy as np
import logging
# define mlp
use_torch_criterion = False
data = mx.symbol.Variable('data')
fc1 = mx.symbol.TorchModule(data_0=data, lua_string='nn.Linear(784, 128)', num_data=1, num_params=2, num_outputs=1, name='fc1')
act1 = mx... | StarcoderdataPython |
1721582 | # Generated with LimitStateCategory
#
from enum import Enum
from enum import auto
class LimitStateCategory(Enum):
""""""
SLS = auto()
ULS = auto()
ALS = auto()
def label(self):
if self == LimitStateCategory.SLS:
return "SLS"
if self == LimitStateCategory.ULS:
... | StarcoderdataPython |
3217708 | # -*- coding: utf-8 -*-
"""
@author: anonymous
"""
import json
train1 = {'simulation':{
'num_simulations' : 10,
'simulation_index_start' : 0,
'N' : 10,
'K' : 20,
'R_defined' : 400,
'min_dist' : 35,
'dcor' : 10,
'T' : 20e-3,
'total_samples' : 100000,
'isTrain' : True,
'equal_number_for_BS' : True},
... | StarcoderdataPython |
91467 | import tkinter as tk
from tkinter import ttk
from collections import deque
class Timer(ttk.Frame):
"""parent is the frame which contains the timer frame self is the object whose properties are being created
and controller is the class whose properties are inherited....tk.Frame properties are also inher... | StarcoderdataPython |
1608727 | from .Feed import *
from .FPFeed import *
| StarcoderdataPython |
14635 | <reponame>ezeakeal/glider_drone
from unittest import TestCase
from glider.modules.glider_radio import GliderRadio
class TestGliderRadio(TestCase):
def setUp(self):
self.radio = GliderRadio(self.test_callback)
self.radio.start()
def tearDown(self):
self.radio.stop()
def test_callb... | StarcoderdataPython |
1619666 | <reponame>vishalbelsare/emmental-tutorials<gh_stars>10-100
import logging
import torchvision
from eda.image.datasets import ALL_DATASETS
from emmental.data import EmmentalDataLoader
logger = logging.getLogger(__name__)
def get_dataloaders(args):
train_dataset = torchvision.datasets.__dict__[args.task.upper()](... | StarcoderdataPython |
4837816 | # -*- coding: utf-8 -*-
from gevent import monkey
monkey.patch_all()
import gevent
import gevent.pool
import time
import random
import logging
_handler = logging.StreamHandler()
_handler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s %(module)s:%(lineno)s %(message)s'))
log = logging.getLog... | StarcoderdataPython |
3374956 | <filename>scripts/check_literalincludes.py
import sys
import subprocess
def literalinclude_blocks():
literalincludes = subprocess.check_output(
["git", "grep", "-A", "10", ".. literalinclude::"]
)
literalincludes = literalincludes.decode()
section = []
for line in "\n".join(literalincludes... | StarcoderdataPython |
3272410 | from setuptools import setup, find_packages
with open("README.rst", "r") as fh:
long_description = fh.read()
setup_params = dict(
name = 'pysqream',
version = '3.0.0',
description = 'DB-API connector for SQreamDB',
long_description=long_description,
url="https://github.com/... | StarcoderdataPython |
188975 | # -*- coding: utf-8 -*-
"""lhs_opt.py: Module to generate design matrix from an optimized
Latin Hypercube design
"""
import numpy as np
from . import lhs
__author__ = "<NAME>"
def create_ese(n: int, d: int, seed: int, max_outer: int,
obj_function: str="w2_discrepancy",
threshold_init: f... | StarcoderdataPython |
3241779 | <reponame>alvin-chang/lightning-flash
from flash.text.seq2seq.translation.data import TranslationData
from flash.text.seq2seq.translation.model import TranslationTask
| StarcoderdataPython |
3297156 | import os
import argparse
import traceback
from datetime import datetime
import pandas as pd
from cmapPy.pandasGEXpress.GCToo import GCToo
from cmapPy.set_io.grp import read as parse_grp
from cmapPy.pandasGEXpress.write_gctx import write as write_gctx
from cmapPy.pandasGEXpress.write_gct import write as write_gct
d... | StarcoderdataPython |
1767901 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import random
import uuid
from odoo import api, fields, models, _
from odoo.tools import email_split, email_split_and_format
class Order(models.Model):
_name = 'plant.order'
_description = 'Plant Order'
_o... | StarcoderdataPython |
1704019 | from __future__ import unicode_literals
import boto3
from moto import mock_secretsmanager
import sure # noqa
@mock_secretsmanager
def test_get_secret_value():
conn = boto3.client('secretsmanager', region_name='us-west-2')
result = conn.get_secret_value(SecretId='java-util-test-password')
assert result[... | StarcoderdataPython |
156533 | <reponame>niefy/LeetCodeExam
"""
题目:1006. 笨阶乘
通常,正整数 n 的阶乘是所有小于或等于 n 的正整数的乘积。例如,factorial(10) = 10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1。
相反,我们设计了一个笨阶乘 clumsy:在整数的递减序列中,我们以一个固定顺序的操作符序列来依次替换原有的乘法操作符:乘法(*),除法(/),加法(+)和减法(-)。
例如,clumsy(10) = 10 * 9 / 8 + 7 - 6 * 5 / 4 + 3 - 2 * 1。然而,这些运算仍然使用通常的算术运算顺序:我们在任何加、减步骤之前执行所有的乘法和除... | StarcoderdataPython |
153877 | #!/usr/bin/env python
#
# Public Domain 2014-2017 MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compil... | StarcoderdataPython |
70602 | <gh_stars>1-10
#-----------------------------------------------------------------------------
#
# Copyright (c) 2006 by Enthought, Inc.
# All rights reserved.
#
# Author: <NAME> <<EMAIL>>
#
#-----------------------------------------------------------------------------
# Standard library imports
import logging
# En... | StarcoderdataPython |
3331270 | <reponame>PandaDrunkard/proex<filename>AOJ/ALDS1_5_C.py<gh_stars>0
import math
def stdinput():
from sys import stdin
return stdin.readline().strip()
def main():
n = int(stdinput())
nodes = [[0., 0.], [100., 0.]]
for _ in range(n):
next_nodes = []
for s_node, e_node in zip(nodes[:],... | StarcoderdataPython |
1788690 | import selenium
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.action_chains import ActionCh... | StarcoderdataPython |
1612633 | <gh_stars>100-1000
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: annotations.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf impo... | StarcoderdataPython |
3247430 | <filename>apployer/fetcher/jumpbox_utilities.py
#
# Copyright (c) 2016 Intel Corporation
#
# 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 |
1740490 | #%%
# <NAME> 12-Apr-2019
# Iris Data Set Project.
# Scatterplots of Iris Dataset
# import pandas, seaborn and matplotlib libraries
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
# import iris dataset with Pandas
f = pd.read_csv("iris.csv")
# set the key parameters for the 'Sepal Lenght' s... | StarcoderdataPython |
1736451 | <filename>kedua.py<gh_stars>0
import shapefile
class Kedua:
def __init__(self):
self.kedua = shapefile.Writer('kedua', shapeType = shapefile.POLYGON)
self.kedua.shapeType
self.kedua.field('nama_ruangan', 'C')
#<NAME> - 1174035
def tanggaBawahKiri(self, label):
self.kedua.r... | StarcoderdataPython |
3381828 | <reponame>divine-dragonflies/codejam-summer-2021<filename>src/__main__.py<gh_stars>0
"""The entry point to this game."""
from time import sleep
from typing import List
from blessed import Terminal
board = [
[
["w", "w", "w", "w", "w", "w", "w", "w", "w"],
["w", ".", ".", ".", ".", ".", ".", ".", ... | StarcoderdataPython |
3399928 | <reponame>svenfritsch/django-elo-rating
import math
from django.db import models
from django.conf import settings
class EloRated(models.Model):
elo_rating = models.FloatField(default=settings.ELO_START_VALUE)
class Meta:
abstract = True
def probability(self, opponent):
return 1 / (1 + m... | StarcoderdataPython |
1637662 | """
Collection of basic python function for meteorological library.
"""
__author__ = "<NAME>"
__version__ = '0.1.0'
| StarcoderdataPython |
1702993 | import ntpath
import os
import argparse
from datetime import datetime
import logging
from pypgrest import Postgrest
import pandas as pd
import boto3
from dotenv import load_dotenv
import utils
# Envrioment variables
AWS_ACCESS_ID = os.getenv("AWS_ACCESS_ID")
AWS_PASS = os.getenv("AWS_PASS")
BUCKET_NAME = os.getenv(... | StarcoderdataPython |
1745305 | """
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.
For example,
Given [100, 4, 200, 1, 3, 2],
The longest consecutive elements sequence is [1, 2, 3, 4]. Return its length: 4.
Your algorithm should run in O(n) complexity.
"""
class Solution:
# @param num, a list... | StarcoderdataPython |
1771927 | import pymysql
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
webapp_python_flask_sqlalchemy_mysql_app = Flask(__name__, instance_relative_config=True)
webapp_python_flask_sqlalchemy_mysql_app.config.from_object("config")
webapp_python_flask_sqlalchemy_mysql_app.config.from_pyfile("config.py")
db = ... | StarcoderdataPython |
3318273 | import tensorflow as tf
validation_dir="fooval/val" #"/datasets/ImageNet/ILSVRC/Data/CLS-LOC/val" #"val"
BATCH_SIZE = 32
IMG_SIZE = (224,224)
#model = tf.keras.applications.mobilenet
#pretrained = tf.keras.applications.MobileNet
model = tf.keras.applications.mobilenet_v2
pretrained = tf.keras.applications.MobileNetV2... | StarcoderdataPython |
3238572 | """
Read file into texts and calls.
It's ok if you don't understand how to read files
"""
import csv
with open('texts.csv', 'r') as f:
reader = csv.reader(f)
texts = list(reader)
with open('calls.csv', 'r') as f:
reader = csv.reader(f)
calls = list(reader)
"""
TASK 2: Which telephone number spent the ... | StarcoderdataPython |
4810341 | <reponame>lidofinance/depositor-bot<filename>scripts/utils/metrics.py<gh_stars>1-10
from prometheus_client.metrics import Gauge, Counter
DEPOSITOR_PREFIX = 'depositor_bot_'
BUILD_INFO = Gauge(f'{DEPOSITOR_PREFIX}build_info', 'Build info', [
'name',
'network',
'max_gas_fee',
'contract_gas_limit',
... | StarcoderdataPython |
1655018 | <filename>tests/home/test_home.py
from unittest import TestCase
import sys
sys.path.insert(1, '../../apps/models/user_package/user')
sys.path.insert(2, '../../apps/models/user_package/schema')
from user_model import User
class HomeTests(TestCase):
def test_user(self):
user = User(email='<EMAIL>', passw... | StarcoderdataPython |
3322374 | from django.urls import path, include
from . import views
from mainapp.main import views as main_views
from mainapp.video import views as video_views
main_patterns = [
path('',main_views.main),
path('signup/', main_views.signup, name='signup'),
path('signin/', main_views.signin, name='signin'),
]
video_p... | StarcoderdataPython |
3386676 | <gh_stars>0
def get_departments():
departments = {
"eee": "10056",
"computer_science": "10024",
"mechanical": "10141",
"civil": "10110",
"mechatronics": "10152",
"biomedical": "10032",
"industrial": "10059"
}
return departments
| StarcoderdataPython |
3247399 | import abc
import socket
class ProxyError(Exception):
pass
class Proxy(object):
"""
The Proxy class serves as a template for the implementation of specific proxy's. The Proxy class is an abstract
class, so it can not function on its own. The HttpProxy class is an example which is based on th... | StarcoderdataPython |
90752 | <reponame>sytelus/axformer
from axformer import trainer
def main():
trainer.train() | StarcoderdataPython |
3393049 | """
Faça um programa que mostre na tela uma contagem regressiva para o estouro de fogos de artifício,
indo de 10 até 0, com uma pausa de 1 segundo entre eles.
"""
from time import sleep
import emoji
for c in range(10, 0, -1):
print(c)
sleep(1)
if c == 1:
print(0)
print(emoji.emojize(":sparkl... | StarcoderdataPython |
3344332 | """ --- Brackets --- Elementary
You are given an expression with numbers, brackets and operators.
For this task only the brackets matter. Brackets come in three flavors:
"{}" "()" or "[]". Brackets are used to determine scope or to restrict
some expression. If a bracket is open, then it must be closed with
a closing b... | StarcoderdataPython |
3236082 | <reponame>IndigoPurple/EFENet<gh_stars>10-100
# -*- coding: utf-8 -*-
"""
Portions Copyright (c) 2014 CiiNOW Inc.
Written by <NAME> <<EMAIL>>, <<EMAIL>>
2014-03-03 Ported from matlab to python/numpy/scipy
2014-03-04 Added utility functions to read/compare images and video
"""
"""
-----------COPYRIGHT NOTICE STARTS WI... | StarcoderdataPython |
3323807 | from enum import Enum
from typing import Any, Union
from .connection import Connection
class HTTPRequestTypes(Enum):
GET = "GET"
POST = "POST"
PUT = "PUT"
DELETE = "DELETE"
PATCH = "PATCH"
HEAD = "HEAD"
class HTTPConnection(Connection):
"""
A Connection that utilizes HTTP
HTTP ... | StarcoderdataPython |
1630708 | """
Chess board
No computer player yet
Sucks in other ways too
TO DO: look over http://home.hccnet.nl/h.g.muller/max-src2.html
"""
## b = InitialChessBoard()
## print str(b)
#. rnbqkbnr
#. pppppppp
#.
#.
#.
#.
#. PPPPPPPP
#. RNBQKBNR
## pw = HumanPlayer(white)
## pb = HumanPlayer(bl... | StarcoderdataPython |
1791236 | <reponame>rochester-rcl/islandora-import-scripts<filename>ur/mods.py
#!/usr/bin/python
import xml.etree.ElementTree as ET
# #########################################################
# Represents all the MODS metadata classes for import
# #########################################################
class RecordInfo:
... | StarcoderdataPython |
44368 | <filename>tests/test_gf.py
from crypto_math import GF, field_extension
import pytest
@pytest.fixture
def setup():
F7 = GF(7)
F7_4 = field_extension(F7, 4)
return F7_4
@pytest.mark.parametrize(
"x,y,expect",
[
([1, 1, 1, 1], [2, 3, 1], [1, 3, 4, 2]),
([2, 3, 1], [6, 1, 3, 1], [6, ... | StarcoderdataPython |
167913 | from django.shortcuts import render, get_object_or_404
from rest_framework import generics, permissions, status
from rest_framework.response import Response
from rest_framework.views import APIView
from .serializers import RestaurantSerializer, RestaurantnamesSerializer, UserCollectionsSerializer, RestaurantCollections... | StarcoderdataPython |
3339007 | <reponame>aronchick/gha-arm-experiment
# Import the needed management objects from the libraries. The azure.common library
# is installed automatically with the other libraries.
from azure.common.client_factory import get_client_from_cli_profile
from azure.mgmt.resource import ResourceManagementClient
from azure.mgmt.n... | StarcoderdataPython |
86247 | <gh_stars>10-100
import cv2 as cv
import numpy as np
from matplotlib import pyplot as plt
def sketch(image):
# Convert image to gray scale
img_gray = cv.cvtColor(image, cv.COLOR_BGR2GRAY)
# Clean up image using Gaussian Blur
img_gray_blur = cv.GaussianBlur(img_gray, (5, 5), 0)
# Extract Edges
... | StarcoderdataPython |
1649946 | import unittest
from .. import main
def test_entry_point():
assert main() == "Here's the entry point"
| StarcoderdataPython |
3320324 | # Copyright (c) 2020, Huawei Technologies.All rights reserved.
#
# Licensed under the BSD 3-Clause License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://opensource.org/licenses/BSD-3-Clause
#
# Unless required by applicable law... | StarcoderdataPython |
169517 | from helpers import render
def aboutus(request):
return render(request, {}, 'news/aboutus.html')
def help(request):
return render(request, {}, 'news/help.html')
def buttons(request):
return render(request, {}, 'news/buttons.html')
| StarcoderdataPython |
191771 | <gh_stars>0
from . import exportFix, get_files
import argparse
import os
def check_file(file):
if not os.access(file, os.W_OK):
parser.error('File could not be accessed. Make sure file exists and can be modified')
else:
return file
if __name__ == '__main__':
parser = argparse.ArgumentParse... | StarcoderdataPython |
3354788 | <filename>FWCore/Integration/test/testConcurrentIOVsESConcurrentSource_cfg.py
import FWCore.ParameterSet.Config as cms
process = cms.Process("TEST")
process.source = cms.Source("EmptySource",
firstRun = cms.untracked.uint32(1),
firstLuminosityBlock = cms.untracked.uint32(1),
firstEvent = cms.untracked.uin... | StarcoderdataPython |
1759403 | <filename>remote_sensing/python/drivers/00_Kirti_Mike_initial_plots_Grant/00_peak_tables_and_plots/d_peak_and_plots_for_Kirti_MikeBrady.py
"""
Peak and plot simultaneously
"""
import csv
import numpy as np
import pandas as pd
# import geopandas as gpd
from IPython.display import Image
# from shapely.geometry import Po... | StarcoderdataPython |
122792 | <filename>exercises/ja/exc_02_02_01.py
from spacy.lang.ja import Japanese
nlp = Japanese()
doc = nlp("私はネコを飼っています")
# 単語「ネコ」のハッシュを引く
cat_hash = ____.____.____[____]
print(cat_hash)
# cat_hashを使って文字列を引く
cat_string = ____.____.____[____]
print(cat_string)
| StarcoderdataPython |
1605354 | from __future__ import absolute_import
#!/usr/bin/env python
import sys
import unittest
sys.path.append('xypath')
import xypath
import messytables
try:
import hamcrest
except ImportError:
hamcrest = None
import re
import tcore
class Test_Import_Missing(tcore.TMissing):
def test_table_has_properties_at_all(... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.