id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1715241 | '''
Manage protection of your items, enable protection or disable it, or take on-demand backups.
'''
from ... pyaz_utils import _call_az
def check_vm(resource_group=None, vm=None, vm_id=None):
'''
Find out whether the virtual machine is protected or not. If protected, it returns the recovery services vault ID,... | StarcoderdataPython |
1638137 | <filename>simplui/dialogue.py<gh_stars>10-100
# ----------------------------------------------------------------------
# Copyright (c) 2009 <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are me... | StarcoderdataPython |
3327565 | # -*- coding: utf-8 -*-
import requests
import csv
from bs4 import BeautifulSoup
# Get prefix from: schedule of classes for undergraduate students
course_prefix = []
prefix_page = requests.get('http://www.adm.uwaterloo.ca/infocour/CIR/SA/under.html')
prefix_soup = BeautifulSoup(prefix_page.text, 'html.parser... | StarcoderdataPython |
1752322 | # mad man problem
import numpy as np
def rand(a, b):
return np.random.randint(a, b+1, dtype=int)
def mad_man(num):
a = rand(1, num)
# print(a)
if a == 1 or num == 1:
return True
elif a == num:
return False
else:
return mad_man(num+1-a)
counter = 0
trials = 100000
for... | StarcoderdataPython |
1615648 | from fourparts.structures.notes.Notes import Notes
from fourparts.structures.MelodicInterval import Interval
class NoteProgression:
"""Represents a progression of notes.
Attributes
----------
progression : list of Notes
current : int
To allow NoteProgression to be iterable.
high : int... | StarcoderdataPython |
3394391 | import os
import shutil
import config
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
from classifier_models import PreActResNet18, ResNet18
from dataloader import get_dataloader
from networks.models import Generator, NetC_MNIST
f... | StarcoderdataPython |
4814562 | <reponame>hutomadotAI/word2vec
import argparse
import os
from time import time
from tqdm import tqdm
import pickle
import itertools
import numpy as np
from pathlib import Path
SCRIPT_PATH = Path(os.path.dirname(os.path.realpath(__file__)))
def load_glove_emb(input_path, vocab=None):
count = 0
tStart = time(... | StarcoderdataPython |
3203235 | <filename>setup.py
from distutils.core import setup
setup(name='rqubit',
version='0.1',
author='<NAME>',
author_email='<EMAIL>',
packages=['rqubit'],
url='https://github.com/sauercrowd/rqubit',
)
| StarcoderdataPython |
57345 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from db.BOW_DB import BOW_DB
from db.LDA_DB import LDA_DB
from vis.TermTopicMatrix3 import TermTopicMatrix3
def index():
with BOW_DB() as bow_db:
with LDA_DB() as lda_db:
handler = TermTopicMatrix3(request, response, bow_db, lda_db)
return handler.Gener... | StarcoderdataPython |
3276277 | <filename>tests/test_loader.py
from django.test import TestCase
import pytest
from factory_loader import loader, exceptions
from .django_app import models
from .factories import UserErikaFactory
class LoadFactoriesInterfaceTest(TestCase):
def test_invalid_input_params(self):
"""
Ensures that hand... | StarcoderdataPython |
61544 | <reponame>hellen6654/DataBase_CGHP
# Generated by Django 2.1.3 on 2018-12-24 16:56
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('SOS', '0003_remove_order_discount'),
]
operations ... | StarcoderdataPython |
159823 | <reponame>fedosgad/mitmproxy<gh_stars>0
from mitmproxy import ctx
class AntiComp:
def load(self, loader):
loader.add_option(
"anticomp",
bool,
False,
"Try to convince servers to send us un-compressed data.",
)
def request(self, flow):
if... | StarcoderdataPython |
3264383 | <filename>source /pieces/knight.py
from .piece import Piece
class Knight(Piece):
def __init__(self, x, y, player):
super().__init__(x=x, y=y, player=player)
self.type = 1
self.set_image()
def set_image(self):
color_num = 0 if self.player == "white" else 1
self.image =... | StarcoderdataPython |
73960 | # -*- coding: utf-8 -*-
# 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
#
# Unless required by applicable law or... | StarcoderdataPython |
3323277 | """
Fits PSPL model for MB08310 with finite source effect using EMCEE sampler and
reports posterior flux parameters. The flux parameters are found by regression
for each model and cached using EMCEE blobs mechanism.
This example uses config file:
python example_10_fitting_and_fluxes.py example_10.cfg
Data from `Janc... | StarcoderdataPython |
1647499 | # Copyright 2020 Energinet DataHub A/S
#
# Licensed under the Apache License, Version 2.0 (the "License2");
# 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 i... | StarcoderdataPython |
1670478 | <gh_stars>10-100
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 22 13:40:57 2017
@author: gamma
"""
import numpy as np
import cPickle
inputArray = ##inputArray##
workingDir = "##workingDir##"
fileNameString = "##fileNameString##"
Array = np.array(inputArray)
datafile = open(workingDir+fil... | StarcoderdataPython |
28224 | from PyQt5 import QtCore
from PyQt5.QtWidgets import QProgressBar
class ProgressBar(QProgressBar):
def __init__(self):
super(ProgressBar, self).__init__()
self.setTextVisible(True)
self.setMaximum(100)
self.setAlignment(QtCore.Qt.AlignCenter) | StarcoderdataPython |
1706432 | <filename>tests/tests_ui/test_smoke/tests_invalid/test_admin_page_login.py
import os
import pytest
from selene import be
from tests.locators.dashboard_locators import AdminNavBarLocators, AdminLoginPageLocators
USERNAME = os.environ['USERNAME_ADMIN']
PASSWORD = os.environ['<PASSWORD>']
class TestAdminPanel:
log... | StarcoderdataPython |
93841 | # -*- coding: UTF-0 -*-
import os
import os.path
import re
print "-----------"
for line in open("C:/Users/yakum/Desktop/test0.txt", 'rb'):
it0=re.finditer(r"(?<=;Alias: ).*?(?=;EncryptUsername)",str(line))
for match0 in it0:
print match0.group()
print "-----------"
for line in open("C:/Users/yakum/Desk... | StarcoderdataPython |
71779 | <reponame>dettmann/bolero<gh_stars>10-100
# Author: <NAME> <<EMAIL>>
import numpy as np
from .behavior import BlackBoxBehavior
from ..utils.validation import check_random_state
class DummyBehavior(BlackBoxBehavior):
"""Dummy behavior allows using environments which do not require behaviors.
Some environment... | StarcoderdataPython |
1723416 | <gh_stars>0
"""
Django settings for api project.
Generated by 'django-admin startproject' using Django 2.2.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import... | StarcoderdataPython |
3327754 | <gh_stars>1-10
from django.db import models
from cms.models import CMSPlugin
from cms.models.pagemodel import Page
from cms.models.fields import PageField
class MenuBelowThisModel(CMSPlugin):
"""
Menu plugin for DjangoCMS.
"""
depth = models.PositiveIntegerField(max_length = 3, default = 1, help_text =... | StarcoderdataPython |
25298 | import re
import logging
from pydispatch import dispatcher
__author__ = 'edzard'
logger = logging.getLogger(__name__)
_filters = {}
def _handler(sender, **kwargs):
global _filters
for parameter_name in kwargs:
if parameter_name in _filters:
data = kwargs[parameter_name]
if _... | StarcoderdataPython |
1682693 | # rolebot.py
import os
import sys
import discord
import logging
import traceback
import constants
import helpers
from rolebot_context import RolebotContext
from dotenv import load_dotenv
from command.matchmaking import add_matchmade_player, remove_matchmade_player
# print message when bot connects to disc client
inte... | StarcoderdataPython |
10651 | # from vk_bot.core.modules.basicplug import BasicPlug
# import math
# class Calculator(BasicPlug):
# doc = "Калькулятор"
# command = ("калькулятор",)
# def main(self):
# try:
# x = self.text[1]; x = int(x)
# encalc = self.text[2]; encalc = encalc.lower()
# y = sel... | StarcoderdataPython |
1650362 | <filename>kafka_influxdb/encoder/collectd_graphite_encoder.py
import logging
from kafka_influxdb.encoder.escape_functions import influxdb_tag_escaper
try:
# Test for mypy support (requires Python 3)
from typing import Text
except ImportError:
pass
class Encoder(object):
"""
An encoder for the Col... | StarcoderdataPython |
112124 | <filename>csv1.py
import csv
filename = 'machine-learning.abw'
data = []
try:
with open (filename) as f:
reader = csv.reader(f)
header = reader.next()
data = [row for row in reader]
except csv.Error as e:
print "Error reading CSV file at line %s: %s" % (reader.line_num, e)
sys.exit(-1)
if header:
print ... | StarcoderdataPython |
50023 | <gh_stars>1-10
from __future__ import division, print_function, absolute_import
import six
range = six.moves.range
import numpy as np
import scipy.sparse as ss
import dynpy
class ExampleSystem(dynpy.dynsys.DiscreteStateDynamicalSystem):
def states(self):
return [1,2]
def _iterate_1step_discrete(self, x):
retu... | StarcoderdataPython |
4842634 | <filename>comments/views.py
from django.views.decorators.csrf import csrf_exempt
from django.shortcuts import render
from django.http import HttpResponse
from comments.models import Comment
from django_react import json_encoder
import json
# Create your views here.
def index(request):
return render(request, "com... | StarcoderdataPython |
1722087 | import threading
import numpy as np
class InferenceThread(threading.Thread):
def __init__(self, target=None, *args, **kwargs):
super().__init__(target=self._infer, *args, **kwargs)
self.daemon = True
self._stop_event = threading.Event()
def _infer(self, session, model, data_source, i... | StarcoderdataPython |
1690681 | <reponame>aapks/plugin.video.netflix-1
# -*- coding: utf-8 -*-
"""
Copyright (C) 2017 <NAME> (plugin.video.netflix)
Copyright (C) 2018 Caphm (original implementation module)
Common base for all playback action managers
SPDX-License-Identifier: MIT
See LICENSES/MIT.md for more information.
"""
from ... | StarcoderdataPython |
1734723 | <reponame>r-jay-dev/wasmpy
from .module import read_module
import os, sys, types
class WebAssemblyBinaryLoader(object):
"""WebAssembly binary import hook.
This hook is registered automatically with `import wasmpy`.
After the initial import a WebAssembly binary format file (.wasm) can
be loaded with the... | StarcoderdataPython |
154566 | # gui_07_2.py
import tkinter
SMILE = """
#define smileywe_width 16
#define smiley_height 16
static unsigned char smiley_bits[] = {
0xc0, 0x07, 0x30, 0x18, 0x08, 0x20, 0x04, 0x40, 0x44, 0x44, 0x02, 0x80,
0x02, 0x80, 0x02, 0x80, 0x22, 0x88, 0x62, 0x8c, 0xc4, 0x47, 0x04, 0x40,
0x08, 0x20, 0x30, 0x18, 0xc0, 0x07, 0x00, 0x... | StarcoderdataPython |
1785712 | <reponame>engineerpawan/python-examples
album_set = set(["Back in Black","AC/DC","The dark side of the moon"])
print("AC/DC" in album_set)
print("AC/DC" not in album_set)
print("country" not in album_set)
print("country" in album_set)
print("copying a set")
album_set_backup = album_set.copy()
print("math functi... | StarcoderdataPython |
1610220 | # -*- coding: iso-8859-1 -*-
from __future__ import print_function, division
import sys
if( sys.version_info[0] == 2 ):
range = xrange
import math
import qm3.utils
import qm3.problem
def distribute( nodes, guess ):
"""
guess vector MUST constain at least 2 points: CRD0 and CRDf
"""
size = len( ... | StarcoderdataPython |
3248291 | <reponame>namuan/news-rider
from argparse import ArgumentParser
from .engine.markdown_exporter import md_file_path
from .engine.notifier import notify_user
from .engine.workflow import orchestrate
def parse_args():
parser = ArgumentParser(
description="A simple script to read titles for given urls and se... | StarcoderdataPython |
66908 | <reponame>shihab4t/Competitive-Programming<gh_stars>1-10
material = []
for i in range(int(input())):
material.append(int(input()))
srted = sorted(material)
if srted == material:
print("YES")
else:
print("NO") | StarcoderdataPython |
1757392 | # -----------------------------------------------------------------------------
# Copyright 2017 <NAME> <EMAIL>
#
# 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/l... | StarcoderdataPython |
3254175 | <gh_stars>1-10
# Python code to demonstrate working of
# append(), appendleft(), pop(), and popleft()
# importing "collections" for deque operations
import collections
# initializing deque
de = collections.deque([1,2,3])
# using append() to insert element at right end
# inserts 4 at the end of deque
de.appen... | StarcoderdataPython |
1717444 | <reponame>terror/Solutions
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def findMode(self, root: TreeNode) -> List[int]:
if not root:
return []
... | StarcoderdataPython |
3286846 | import safe_grid_agents.common as common
import safe_grid_agents.parsing as parsing
import safe_grid_agents.ssrl as ssrl
| StarcoderdataPython |
1780090 | <gh_stars>10-100
import Queue
'''
# Using Array to form a QUEUE
>>> from collections import deque
>>> queue = deque(["Eric", "John", "Michael"])
>>> queue.append("Terry") # Terry arrives
>>> queue.append("Graham") # Graham arrives
>>> queue.popleft() # The first to arrive now leaves
... | StarcoderdataPython |
3355355 | # -*- coding: utf-8 -*-
from datetime import datetime, timedelta, tzinfo
from .compat import text_type
date_format = "%Y-%m-%d"
iso8601_datetime_format = '%Y-%m-%dT%H:%M:%S%z'
class FixedOffset(tzinfo):
def __init__(self, offset_hours=0, offset_minutes=0, name="UTC"):
super(FixedOffset, self).__init_... | StarcoderdataPython |
183965 | <filename>noiseceiling/utils.py
import numpy as np
import pandas as pd
from tqdm import tqdm
def get_percentiles(x, n_percentiles=5):
""" Utility function to divide a particular variable up into
percentiles. """
return pd.qcut(x, q=n_percentiles, retbins=False, labels=False)
def reduce_repeats(X, y,... | StarcoderdataPython |
3370562 | import math
import numpy as np
import shapely.geometry as geom
from shapely import affinity
import itertools
from matplotlib import pyplot as plt
from matplotlib import patches
from descartes import PolygonPatch
class Environment:
def __init__(self, obstacles, start, goal_region, bounds=None):
self.enviro... | StarcoderdataPython |
1797554 | # _ __ _ ___ _ ___ _ _
# | |/ /_ _ __ _| |_ ___ __/ __| __ _| |___ _ __ ___| _ \ |_ _ __ _(_)_ _
# | ' <| '_/ _` | _/ _ (_-<__ \/ _` | / _ \ ' \/ -_) _/ | || / _` | | ' \
# |_|\_\_| \__,_|\__\___/__/___/\__,_|_\___/_|_|_\___|_| |_|\_,_\__, |_|_||_|
# ... | StarcoderdataPython |
3237334 | from __future__ import annotations
import asyncio
from typing import Any
import attr
__all__ = ("Ratelimiter",)
@attr.s(slots=True)
class Ratelimiter:
rate: int = attr.field()
per: int = attr.field()
semaphore: asyncio.Semaphore = attr.field(init=False)
def __attrs_post_init__(self) -> None:
... | StarcoderdataPython |
98534 | <gh_stars>0
from pinnacle.resources.baseresource import BaseResource
class BetDetails(BaseResource):
class Meta(BaseResource.Meta):
attributes = {
'betId': 'betId',
'wagerNumber': 'wagerNumber',
'placedAt': 'placedAt',
'win': 'win',
'ri... | StarcoderdataPython |
1762743 | <reponame>danbradham/scrim
# -*- coding: utf-8 -*-
'''
=========
scrim.api
=========
'''
from __future__ import absolute_import
import os
import atexit
from fstrings import f
from scrim.globals import (
SHELLS,
SCRIM_AUTO_WRITE,
SCRIM_PATH,
SCRIM_SHELL,
SCRIM_SCRIPT
)
from scrim.commands import Comm... | StarcoderdataPython |
3200966 | <reponame>abodi050/kjkjkjkjkj
print('hi\nmyname is : abdullah')
print("in this code we will do ")
#Formatting with placeholders
print("'Formatting with placeholders'")
#we have many type of format but the important are.
print("first: %s \nsecond:%d \nthried:%2.1f \n last:%r "%("hole world and number 123.456",56.22,33.... | StarcoderdataPython |
1785786 | <gh_stars>0
# Created byMartin.cz
# Copyright (c) <NAME>. All rights reserved.
from pero import Frame, Graphics, OrdinalScale, Path, colors
from pero.enums import *
from pero.properties import *
from .annotation import Annotation
from .axes import Axis
from .enums import ANNOTS_Z, GRID_Z, LABELS_Z, LEGEND_Z, PLOT_TA... | StarcoderdataPython |
179560 | # Copyright 2020 The Flax 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 wri... | StarcoderdataPython |
124363 | """
Setup script for the customcolour package
"""
from setuptools import setup
from setuptools import find_packages
def readme():
with open('README.rst') as f:
return f.read()
setup(
name='customcolour',
version='0.1',
description=('A library of tools for transforming and creating' +
... | StarcoderdataPython |
3321092 |
class Snippet:
"""
Base class for snippet syntax tree.
"""
def accept(self, visitor):
"""
Accepts a visitor
:param visitor: Visitor instance
:return: Visitor result
"""
raise NotImplementedError("You should not be here.")
class CompositeSnippet(Snippe... | StarcoderdataPython |
1764705 | <gh_stars>0
import matplotlib.pyplot as plt
#generate a pie chart with our Olympic data
values = [315, 203, 107]
colors = ["gold", "silver", "brown"]
labels = ["Gold: 315", "Silver: 203", "Bronze: 107"]
explode = (0.05, 0, 0)
plt.title("Canada Medal Breakdown", pad="15")
plt.pie(values, labels=labels, colors=color... | StarcoderdataPython |
1604233 | # -*- coding: utf-8 -*-
#
# This file is part of Django appschema released under the MIT license.
# See the LICENSE for more information.
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.db import DEFAULT_DB_ALIAS
import appschema
migrate = appschema.migra... | StarcoderdataPython |
1785846 | <reponame>jcnelson/syndicate
#!/usr/bin/python
"""
Copyright 2014 The Trustees of Princeton University
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/lice... | StarcoderdataPython |
3272396 | def add(x, y):
"""Add tow number together"""
return x+y
def subtract(x, y):
"""sbtract x from y and return value"""
return y-x
| StarcoderdataPython |
3391462 | # Django Library
from django.db import models
# Thirdparty Library
from apps.base.models import PyChannel
# Localfolder Library
from ...crm.submodels.lead import PyLead
from .campaign import PyCampaign
class MarketingLead(PyLead):
class Meta:
app_label = 'crm'
channel_id = models.ForeignKey(PyChann... | StarcoderdataPython |
3376567 | <filename>dartwrf/utils.py
import os, sys, shutil, glob
import builtins as __builtin__
#copy = shutil.copy
def print(*args):
__builtin__.print(*args, flush=True)
def copy(src, dst):
try:
os.remove(dst)
except:
pass
shutil.copy(src, dst)
def try_remove(f):
try:
os.remove(f)... | StarcoderdataPython |
4831243 | <filename>1192_Critical_Connections_In_A_Network.py
class Solution:
def buildGraph(self, connections, n):
for node1, node2 in connections:
if node1 not in self.graph:
self.graph[node1] = []
if node2 not in self.graph:
self.graph[node2] = []
... | StarcoderdataPython |
42341 | <reponame>codingforentrepreneurs/launch-with-code
from django.shortcuts import render
def testhome(request):
context = {}
template = "donotuse.html"
return render(request, template, context)
# def home2(request):
# context = {}
# template = "home2.html"
# return render(request, template, context) | StarcoderdataPython |
1728812 | # Generated by Django 3.1.4 on 2021-05-15 11:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Store', '0020_orderitem_orderstatus'),
]
operations = [
migrations.RemoveField(
model_name='shippingaddres',
name='o... | StarcoderdataPython |
20847 | #!/usr/bin/env python3
#
# This file includes mainly a class "randomEpisode" that:
# - draws localization of vehicle
# - draws number of rocks
# - draws position of each rock
# - save in a json file
# Author: Michele
# Project: SmartLoader - Innovation
import json
import random
from ge... | StarcoderdataPython |
1740086 | <reponame>workingyifei/display-pattern-generator<gh_stars>1-10
#-----------------------------------------------------------------------------
# Copyright (c) 2013-2017, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The f... | StarcoderdataPython |
1678128 | <reponame>blc-cruise/ggongsul-api
import threading
from django.conf import settings
from django.db.models.signals import post_save
from django.dispatch import receiver
from slack_sdk import WebhookClient
from .models import Visitation
from ..common.utils import send_slack_msg
slack = WebhookClient(url=settings.SLACK... | StarcoderdataPython |
76468 | <gh_stars>10-100
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import ThisLaunchFileDir
f... | StarcoderdataPython |
4806254 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#%matplotlib inline
class BlandAltman():
def __init__(self,gold_std,new_measure,averaged=False):
# set averaged to True if multiple observations from each participant are averaged together to get one value
import pandas as pd
... | StarcoderdataPython |
9899 | <filename>collation/test2.py<gh_stars>1-10
import pandas as pd
from icu import Collator, Locale, RuleBasedCollator
ddf = pd.read_csv("../word_frequency/unilex/din.txt", sep='\t', skiprows = range(2,5))
collator = Collator.createInstance(Locale('en_AU.UTF-8'))
# https://stackoverflow.com/questions/13838405/custom-sor... | StarcoderdataPython |
3235484 | <reponame>harvardmaps/DataCreation
import urllib.request
import xmltodict
#import xml.etree.ElementTree as ET
xml_request = urllib.request.urlopen('http://api.lib.harvard.edu/v2/items?recordIdentifier=990117369670203941')
doc = xmltodict.parse(xml_request)
#for key, value in doc.items():
# print(key, value)
prin... | StarcoderdataPython |
1674995 | <gh_stars>0
"""Celery background task to start workflow run."""
from _io import TextIOWrapper
import logging
import re
import subprocess
from typing import (Dict, List, Optional, Tuple)
from cwl_wes.celery_worker import celery
# Get logger instance
logger = logging.getLogger(__name__)
@celery.task(
name='task... | StarcoderdataPython |
175210 | <filename>packages/cardpay-reward-programs/streamlit/explore.py
import streamlit as st
from boto3.session import Session
from cardpay_reward_programs.rules import *
from cloudpathlib import S3Client
from views import min_other_merchants_paid, min_spend, weighted_usage
from views.utils import *
cached_client = S3Client... | StarcoderdataPython |
1659774 | <reponame>CloudChef/CloudEntries
# Copyright (c) 2021 Qianyun, Inc. All rights reserved.
from ..common import FusionComputeBase
class DvSwitchsClient(FusionComputeBase):
IDENTIFIER = 'dvswitchs'
| StarcoderdataPython |
3298663 | <filename>setup.py
from setuptools import setup
with open("README.md",'r') as fh:
long_description=fh.read()
setup(
name = 'TOPSIS_Anmoldeep_101983056',
py_modules=['TOPSIS_Anmoldeep_101983056'],
package_dir={'':'src'},
version = '0.2',
license='MIT',
description = 'Packa... | StarcoderdataPython |
1747986 | """A basic extended attributes (xattr) implementation for Linux, FreeBSD and MacOS X."""
import errno
import os
import re
import subprocess
import sys
import tempfile
from ctypes import CDLL, create_string_buffer, c_ssize_t, c_size_t, c_char_p, c_int, c_uint32, get_errno
from ctypes.util import find_library
from distu... | StarcoderdataPython |
120909 | from django.contrib import admin
from .models import Auth0User, ActiveUserSignupLink
admin.site.register(Auth0User)
admin.site.register(
ActiveUserSignupLink,
readonly_fields=("secret", "signup_url", "users_created_with_this_link"),
exclude=("created_users",),
list_display=("secret", "is_active", "comm... | StarcoderdataPython |
1696489 | # -*- coding: utf-8 -*-
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('devilry_account', '0004_auto_20151222_1955'),
]
operations = [
migrations.AlterField(
model_name='permissiongroup',
name='grouptype',
... | StarcoderdataPython |
1741489 | <reponame>940716tian/PythonStudy
from django.db.models import Avg, Sum, Q, F
from django.http import HttpResponse
from django.shortcuts import render
# Create your views here.
from .models import Humen
def get_data(req):
#聚合函数 money>10050
humens = Humen.objects.filter(money__gt=10050)
# avg_age = humens.... | StarcoderdataPython |
1612082 | # -*- coding: utf-8 -*-
#
# @Author: <NAME> (<EMAIL>)
# @Date: 2021-10-05
# @Filename: dm.py
# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause)
from __future__ import absolute_import, annotations, division, print_function
import datetime
import click
from clu.command import Command
from lvme... | StarcoderdataPython |
3281020 | import numpy as np
import time
from scipy.sparse import isspmatrix_csr, issparse
# Import functions for the step_sizes and the updates.
from auxiliary_functions import step_size, polish_solution
# Import functions for active set management
from auxiliary_functions import (
new_vertex_fail_fast,
delete_vertex_... | StarcoderdataPython |
1729803 | from flask import Flask, render_template, request, escape
from lsearch import search_for_letters
import mysql.connector
app = Flask(__name__)
def log_request(req: 'flask_request', res: str) -> None:
"""Log details of the web request and the results."""
dbconfig = {'host': '127.0.0.1',
'user':... | StarcoderdataPython |
1620502 | places = ["tokyo", "cuba", "italie", "india"]
places.sort()
print(places)
places = ["tokyo", "cuba", "italie", "india"]
print('\nThis is the original list:')
print(places)
print('\nthis is the sorted list:')
print(sorted(places))
print('\nThis is the original list again:')
print(places)
print('\nThis ... | StarcoderdataPython |
162849 | from django.urls import path
from django_gramm.views import (
auth_views, post_views, user_views
)
from django.views.generic import TemplateView
from allauth.socialaccount.views import SignupView as SignUpOauth
app_name = 'django_gramm'
urlpatterns = [
path('', post_views.Index.as_view(), name='index'),
... | StarcoderdataPython |
96231 | """empty message
Revision ID: <KEY>
Revises:
Create Date: 2018-05-03 18:18:27.470606
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alemb... | StarcoderdataPython |
1779327 | def sum_of_list(num_list):
"""
This is to demonstrate some basic notions of debugging using pdb.
Toy implementation of summing a list of numbers. Unfortunately, it's
crashing when we run it.
"""
sum = 0
# In the real world, use the sum() function instead.
for i in num_list:
su... | StarcoderdataPython |
105320 | import os
import cinderclient.exceptions as c_exceptions
from cinderclient.v2 import client as c_client
import log
class CinderReturnStack(object):
def __init__(self):
pass
class CinderAuth(object):
def __init__(self):
self.os_username = os.environ['OS_USERNAME']
self.os_api_key = o... | StarcoderdataPython |
142019 | from typing import List, Union, Tuple
import syft as sy
from syft.execution.action import Action
from syft.workers.abstract import AbstractWorker
from syft_proto.execution.v1.communication_action_pb2 import (
CommunicationAction as CommunicationActionPB,
)
COMMUNICATION_METHODS = [
"get",
"mid_get",
... | StarcoderdataPython |
143985 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import threading
import time
g_num = 0
def work1(num):
global g_num
for i in range(num):
mutex.acquire() # 上锁
g_num += 1
mutex.release() # 解锁
# print("----in work1, g_num is %d---" % g_num)
def work2(num):
global ... | StarcoderdataPython |
4814422 | import cv2
import argparse
import numpy as np
import distance_to_camera
from centroidtracker import CentroidTracker
from centroidtracker import RingBuffer
from collections import OrderedDict
ap = argparse.ArgumentParser()
ap.add_argument('-v', '--video', required=False,
help='path to input image')
ap.a... | StarcoderdataPython |
1600647 | <gh_stars>0
class _Node:
def __init__(self, prevNode, nextNode, element):
self.__prev = prevNode
self.__next = nextNode
self.__element = element
def get(self):
return self.__element
def next(self):
return self.__next
def prev(self):
return self.__prev
... | StarcoderdataPython |
32442 | <reponame>NVIDIA-AI-IOT/realtime_handpose_3d<filename>model/A2J/a2j_utilities/post_processing.py
'''
Copyright (c) 2019 <NAME>
Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (t... | StarcoderdataPython |
1750522 | <reponame>IngmarVG-IB/infoblox-netmri
from ..remote import RemoteModel
from infoblox_netmri.utils.utils import check_api_availability
class DeviceViewerSwitchVlanTrunksGridRemote(RemoteModel):
"""
| ``id:`` none
| ``attribute type:`` string
| ``DeviceID:`` none
| ``attribute ty... | StarcoderdataPython |
1722703 | #file used is romeo.txt
fname = input("Enter file name: ")
fh = open(fname)
lst = list()
for line in fh:
for i in line.split():
if not i in lst:
lst.append(i)
lst.sort()
print(lst)
#Output
#['Arise', 'But', 'It', 'Juliet', 'Who', 'already', 'and', 'breaks', 'east', 'envious', 'fair', 'grief', '... | StarcoderdataPython |
1784315 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# pypll.py
#
# Copyright (c) 2018 <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 limitati... | StarcoderdataPython |
1683799 | <reponame>abroun/psdr-cuda<gh_stars>10-100
scene_path = "./data/scenes/"
output_path = "./outputs/"
AD_config1 = {
"type" : "mesh_transform",
"Mesh_ID" : [1],
"Mesh_dir" : [[1.0, 0.0, 0.0]],
"spp" : 8,
"sppe" : 8,
"sppse" : 8,
"guide" :... | StarcoderdataPython |
1601098 | from django.test import TestCase
from .models import Order
class CheckoutEntryTest(TestCase):
def test_string_representation(self):
order = Order(full_name="abc", phone_number="123", street_address1="abc",
postcode="abc")
self.assertEqual(str(order.full_name), order.full_name)
| StarcoderdataPython |
3367020 | from flask_restful import Api
from endpoints.DataProcess.urls import process_urls
from endpoints.DataUpload.urls import data_urls
from endpoints.DeepLearning.urls import model_urls
"""
To add a new urls to the application, all the url functions defined in the relevant files, need to be register here.
"""
"""
To add ... | StarcoderdataPython |
76113 | houses = {(0, 0)}
with open('Day 3 - input', 'r') as f:
directions = f.readline()
current_location = [0, 0]
for direction in directions[::2]:
if direction == '^':
current_location[1] += 1
houses.add(tuple(current_location))
elif direction == '>':
current_... | StarcoderdataPython |
1750241 | import getpass
import json
import re
from pathlib import Path
from tempfile import NamedTemporaryFile
import pytest
import yaml
from jsonschema import validate
from Pegasus.api.errors import DuplicateError
from Pegasus.api.site_catalog import (
OS,
PEGASUS_VERSION,
Arch,
Directory,
FileServer,
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.