id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
3580030 | <reponame>openstack/masakari-dashboard
# Copyright (C) 2018 NTT DATA
# 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... | StarcoderdataPython |
9706447 | #!/usr/bin/env python
import time
import pygtk
pygtk.require('2.0')
import gtk
class EntryCompletionExample:
def __init__(self):
window = gtk.Window()
window.connect('destroy', lambda w: gtk.main_quit())
vbox = gtk.VBox()
label = gtk.Label('Type a, b, c or d\nfor completion')
... | StarcoderdataPython |
5021492 | import json
import os
import tempfile
import requests
from test import TestBase
from test.core.test_request import dir_path
base_dir = f"{dir_path}/payload"
session = requests.session()
class PayLoadTest(TestBase):
def test_json_payload(self):
req = self.get_request(f"{base_dir}/jsonpayload.http")
... | StarcoderdataPython |
1742845 | from otree.api import *
class C(BaseConstants):
NAME_IN_URL = 'random_num_rounds'
PLAYERS_PER_GROUP = None
NUM_ROUNDS = 20
class Subsession(BaseSubsession):
pass
def creating_session(subsession: Subsession):
import random
for p in subsession.get_players():
p.participant.num_rounds... | StarcoderdataPython |
1851118 | #!/usr/bin/python
#
# Copyright (C) 2012 Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of... | StarcoderdataPython |
518 | <filename>setup.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from setuptools import find_packages, setup
from app import __version__
# get the dependencies and installs
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'requirements.txt')) as f:
all_requirements = f.read... | StarcoderdataPython |
3321656 | import tkinter as tk
import sys
from tkinter import filedialog
import random
import numpy as np
import pandas as pd
import math
import seaborn as sns
sys.path.append('Portplanering')
sys.path.append('Bilbokning/src')
from bilbokning import calculate_carriages
HEURISTICS = ['local_search',
'simulated_an... | StarcoderdataPython |
3540337 | import os
import sys
project = 'pyunpack'
author = 'ponty'
copyright = '2011, ponty'
__version__ = None
exec(open(os.path.join('..', project.lower(), 'about.py')).read())
release = __version__
# logging.basicConfig(level=logging.DEBUG)
sys.path.insert(0, os.path.abspath('..'))
# Extension
extensions = [
# -*-E... | StarcoderdataPython |
4824212 |
# Third party imports
from decimal import Decimal
from flask import render_template, flash, redirect, url_for
from flask_login import current_user, login_required
from sqlalchemy import func
# Local application imports
from app import db
from app.main import bp
from app.forms import FeeForm
from app.helpers import us... | StarcoderdataPython |
11312178 | # -*- coding: utf-8 -*-
'''
@Author : Xu
@Software: PyCharm
@File : predict.py
@Time : 2019-06-17 17:51
@Desc : Ner测试
'''
import tensorflow as tf
from Entity_Extraction.Enext_model import BiLSTM_CRF
def NER_predict(msg):
'''
:param msg:
:return:
'''
pass | StarcoderdataPython |
3283312 | <reponame>sarayourfriend/openverse-catalog
from util.loader import paths, s3, sql, ingestion_column
from util.loader.paths import _extract_media_type
def load_local_data(output_dir, postgres_conn_id, identifier, overwrite=False):
tsv_file_name = paths.get_staged_file(output_dir, identifier)
media_type = _extr... | StarcoderdataPython |
3212573 | from pprint import pprint
import boto3
def purge_queue(queueu_url: str, region_name: str):
sqs_client = boto3.client("sqs", region_name=region_name)
response = sqs_client.purge_queue(QueueUrl=queueu_url)
return response
if __name__ == "__main__":
"""
Note!
This script assumed the queue is em... | StarcoderdataPython |
4834123 | #!/usr/bin/python
# apigw_vpc_link_facts
# Find API Gateway VPC link resources
DOCUMENTATION='''
---
module: apigw_vpc_link
author: <NAME>
short_description: Get VPC link resources
description: Get VPC link resources
version_added: "2.2"
requirements:
- python = 2.7
- boto
- boto3
extends_documentatio... | StarcoderdataPython |
6648660 | <reponame>loafbaker/django_blog
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth import get_user_model
from rest_framework import serializers
from accounts.api.serializers import UserDetailSerializer
from comments.models import Comment
User = get_user_model()
def create_comment_... | StarcoderdataPython |
3456749 | #!-*- coding:utf-8 -*-
#!/usr/bin/env python
#---------------------------------------------------
#管理ページ
#copyright 2010-2012 ABARS all rights reserved.
#---------------------------------------------------
import re
import os
import datetime
import template_select
from google.appengine.ext import webapp
from google... | StarcoderdataPython |
12856236 | <reponame>Linda-liugongzi/DIGITS-digits-py3
# -*- coding: utf-8 -*-
# Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved.
import os
import flask
from flask_wtf import FlaskForm
import wtforms
from wtforms import validators
from digits.config import config_value
from digits.device_query import get_devi... | StarcoderdataPython |
3444558 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('checklists', '0005_fix_external_review'),
('core', '0030_auto_20160721_1545'),
('meetings', '0005_auto_2016062... | StarcoderdataPython |
4997211 | <gh_stars>0
from ..models import Record
from .base import BaseRepository
class RecordsRepository(BaseRepository):
__model__ = Record
| StarcoderdataPython |
4837437 | #
# Copyright (c) 2019 ISP RAS (http://www.ispras.ru)
# Ivannikov Institute for System Programming of the Russian Academy of Sciences
#
# 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
#
# h... | StarcoderdataPython |
66491 | # -*- coding: utf-8 -*-
from uuid import uuid4
from decimal import Decimal
from zope.interface import implementer
from schematics.exceptions import ValidationError
from schematics.transforms import whitelist, blacklist
from schematics.types import StringType, FloatType, IntType, MD5Type
from schematics.types.compound i... | StarcoderdataPython |
3359110 | import logging
from guessit import guessit
from unplugged import Schema
from .plugin import ItemInfoPlugin
logging.getLogger("rebulk.rebulk").setLevel(logging.WARNING)
class GuessItItemInfoPlugin(ItemInfoPlugin):
plugin_name = "guessit"
config_schema = Schema
def get_info(self, name):
info = d... | StarcoderdataPython |
3371146 | def append(str: str, suffix: str) -> str:
return str + suffix
| StarcoderdataPython |
8027934 | <filename>hw/hw01/src/line_search_zoom.py
import argparse
import logging
import math
from typing import Callable, List
import matplotlib.pyplot as plt
class HW1:
alpha0 = 0 # type: float
f = None # type: Callable
opt = None # type: List[float]
min_err = None # type: float
gradient = None #... | StarcoderdataPython |
12846776 | <filename>src/tools/files.py
def write_lines(file_path, lines):
with open(file_path, 'w') as file:
for line in lines:
file.write(line + '\n')
def read_line(file_path):
with open(file_path) as file:
return file.readline().strip()
def read_lines(file_path):
lines = []
wi... | StarcoderdataPython |
1724335 | from django.urls import path
from . import views
# this establishes the url pathways and connects them to the view functions
urlpatterns = [
path('', views.index, name='index'),
path('page2/', views.page2, name='page2'),
path('page2/page3/', views.page3, name='page3')
] | StarcoderdataPython |
9621785 | """Classes for retrieving Marker sequences
Example:
$ python sequences.py -s stx1
"""
import os
from rdflib import Graph
from middleware.decorators import submit, prefix, tojson
from middleware.graphers import turtle_utils
from routes.job_utils import fetch_job
from modules.phylotyper.ontology import stx1_graph,... | StarcoderdataPython |
6638109 | <reponame>ayser259/tasktrader
from django.shortcuts import render, redirect
from django.template import loader
from . models import *
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse
import requests
import datetime
import json
import requests
from django.core.exceptions import ObjectDoesNotExist... | StarcoderdataPython |
5146628 | <reponame>aitirga/PyFLOTRAN
from setuptools import setup, find_packages
setup(
name='PyFLOTRAN', # How you named your package folder (MyLib)
packages=find_packages(), # Chose the same as "name"
version='1.4', # Start with a small number and increase it with every change you make
license='MIT', # Ch... | StarcoderdataPython |
133441 | <gh_stars>10-100
from yowsup.common import YowConstants
from yowsup.structs import ProtocolEntity, ProtocolTreeNode
from .iq_groups import GroupsIqProtocolEntity
class ListGroupsIqProtocolEntity(GroupsIqProtocolEntity):
'''
<iq id="{{id}}"" type="get" to="g.us" xmlns="w:g2">
<"{{participating | owning}}... | StarcoderdataPython |
366778 | class Config(object):
JOOX_API_DOMAIN = "https://api-jooxtt.sanook.com/web-fcgi-bin"
JOOX_AUTH_PATH = "/web_wmauth"
JOOX_GETFAV_PATH = "/web_getfav"
JOOX_ADD_DIR_PATH = "/web_fav_add_dir"
JOOX_DEL_DIR_PATH = "/web_fav_del_dir"
JOOX_ADD_SONG_PATH = "/web_fav_add_song"
JOOX_DEL_SONG_PATH = "/... | StarcoderdataPython |
11354647 | import math
from collections import defaultdict
import torch
from torch.optim.optimizer import Optimizer, required
class RAdam(Optimizer):
"""RAdam optimizer, a theoretically sound variant of Adam.
Source: `LiyuanLucasLiu/RAdam <https://github.com/LiyuanLucasLiu/RAdam/blob/master/radam/radam.py>`_
Unde... | StarcoderdataPython |
259398 | <gh_stars>10-100
from copy import copy
from collections import deque
from itertools import chain
from reloadium.vendored.sentry_sdk._functools import wraps
from reloadium.vendored.sentry_sdk._types import MYPY
from reloadium.vendored.sentry_sdk.utils import logger, capture_internal_exceptions
from reloadium.vendored.s... | StarcoderdataPython |
240536 | from django.contrib import admin
# Register your models here.
from feder.letters.logs.models import EmailLog, LogRecord
class LogRecordInline(admin.StackedInline):
"""
Stacked Inline View for LogRecord
"""
model = LogRecord
readonly_fields = ["data", "created", "modified"]
class EmailLogAdmin(... | StarcoderdataPython |
9732677 | from modulepy.base import ModuleBase, ModuleInformation, ModuleVersion, SharedData
class GPSDataUser(ModuleBase):
information = ModuleInformation("GPSDataUser", ModuleVersion(1, 0, 0))
dependencies = [
ModuleInformation("GPS", ModuleVersion(1, 0, 0))
]
def process_input_data(self, data: Share... | StarcoderdataPython |
1753123 | <gh_stars>10-100
class Solution:
def uniquePathsIII(self, grid: List[List[int]]) -> int:
empty = 1
for i in range(len(grid)):
for j in range(len(grid[i])):
if grid[i][j] == 1:
sr = i
sc = j
elif grid[i][j] == 0:
... | StarcoderdataPython |
3382763 | <filename>mllib/basics/datastructure.py<gh_stars>0
class DataStructure(object):
RC = 1 # row combined
RS = 2 # row separated
CC = 3 # column combined
CS = 4 # column separated
def __setattr__(self, *_):
pass
@staticmethod
def is_valid(type):
return type == DataStructu... | StarcoderdataPython |
1969263 | # Thirdparty
import grpc
from grpc.framework.foundation import logging_pool
# Internal
from ddtrace.constants import ANALYTICS_SAMPLE_RATE_KEY
from ddtrace.contrib.grpc import patch, unpatch
from ddtrace import Pin
from ...base import BaseTracerTestCase
from .hello_pb2 import HelloRequest, HelloReply
from .hello_pb2... | StarcoderdataPython |
9660241 | """
Copyright (C) 2018, AIMLedge Pte, Ltd.
All rights reserved.
"""
import sys
from PyQt5.QtWidgets import QAction, QActionGroup, QMainWindow
from PyQt5.QtCore import QByteArray, QTimer
from PyQt5.QtGui import QPixmap, QImage
from PyQt5.QtMultimedia import QCamera
from gui.face_recognition_ui import Ui_FaceRecApp
from... | StarcoderdataPython |
6465753 | <reponame>Djamel-eddine/djamel_ben_smail
from django.urls import path
from base.views import person_profile_views as views
urlpatterns = [
path("register/", views.createPersonProfile, name="create-person-profile"),
path("update/<str:id>/", views.updatePersonProfile, name="update-person-profile"),
path("<s... | StarcoderdataPython |
5135743 | # Generated by Django 3.0.7 on 2020-07-25 18:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('scanEngine', '0008_configuration'),
]
operations = [
migrations.AlterField(
model_name='configuration',
name='short_... | StarcoderdataPython |
3225166 | # Copyright 2013 Cloudscaling Group, 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 applicabl... | StarcoderdataPython |
4845348 | <reponame>Argeniss-Software/rolaguard_engine
def process_packet(packet):
print(packet.to_json())
| StarcoderdataPython |
3283144 | import pytest
from ruts import BasicStats
from ruts.constants import BASIC_STATS_DESC
@pytest.fixture(scope="module")
def bs():
text = "Тезаурусы - особый класс лексикографических ресурсов, для которых характерны следующие черты: полнота\
значений словарного состава языка или какого-либо его сегмента; те... | StarcoderdataPython |
4914016 | # WARNING: Please don't edit this file. It was generated by Python/WinRT v1.0.0-beta.4
import enum
import winsdk
_ns_module = winsdk._import_ns_module("Windows.Foundation")
try:
import winsdk.windows.foundation.collections
except Exception:
pass
class AsyncStatus(enum.IntEnum):
CANCELED = 2
COMPLET... | StarcoderdataPython |
8026788 | import sys, os, time, pickle, random
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import yaml
with open('config.yaml') as f:
config = yaml.load(f)
import json
# Ashutosh added new imports for explainataion:
import matplotlib.pyplot as plt
import plotly
import shap
import lime
i... | StarcoderdataPython |
3540445 | # get data
import os
import time
import torch
import numpy as np
from src.datasets.datasets import Unity_XYTransOpenAI
from src.models.WitnessComplexAE.wc_ae import WitnessComplexAutoencoder
from src.models.autoencoder.autoencoders import ConvAE_Unity480320
from src.utils.plots import plot_2Dscatter
if __name__ == "... | StarcoderdataPython |
6573685 | import datetime
import requests
from collections import ChainMap
from dataclasses import dataclass
from functools import reduce
import operator
from typing import Dict, List
from waste_collection_schedule import Collection # type: ignore[attr-defined]
TITLE: str = "Ecoharmonogram"
DESCRIPTION: str = "Source for Ecoh... | StarcoderdataPython |
11292086 | <reponame>0LL13/persontitles
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# test_german_drtitel.py
"""Tests for drtitel module."""
import os
import sys
PACKAGE_PARENT = '..'
SCRIPT_DIR = os.path.dirname(
os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))),
) # isort:skip # noqa # pylint: di... | StarcoderdataPython |
208505 | """
This file is part of EmailHarvester
Copyright (C) 2016 @maldevel
https://github.com/maldevel/EmailHarvester
EmailHarvester - A tool to retrieve Domain email addresses from Search Engines.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU... | StarcoderdataPython |
3308509 | <filename>sandbox_patch.py
#!/usr/bin/env python
import argparse
import collections
import exceptions
import os
import re
import shutil
import sys
import subprocess
import warnings
import bzr_vcs
_PATCH_EXTENSION = '.patch'
_SANDBOX_CONF = 'sandbox.conf'
_SANDBOX_PATCH = 'sandbox.patch'
_SANDBOX_FIL... | StarcoderdataPython |
8062176 | <reponame>dineshkumarc987/phish_collect<filename>feeds/feed.py
'''Provides a base class for a phishing feed.'''
class Feed(object):
'''Base class for implementing a new phishing feed'''
def get(self, offset=0):
'''
Returns a list of models.Phish objects representing the new sites we haven't s... | StarcoderdataPython |
1727753 | <gh_stars>1-10
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.... | StarcoderdataPython |
3219690 | # coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | StarcoderdataPython |
3459253 | from setuptools import setup
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name='jstruct',
version='2021.11',
description='Readable serializable and deserializable Python nested models',
long_description=long_description,
long_description_content_type="text/... | StarcoderdataPython |
4965673 | """
Handles the data storage and retrieval.
"""
import sqlite3
import time
from functools import wraps
from os import path
from typing import Tuple
from halo.settings import DEFAULT_DB_LOCATION, DEFAULT_WEATHER_API_KEY, \
DEFAULT_BACKGROUND_IMAGE, DEFAULT_SCREEN_HEIGHT, DEFAULT_SCREEN_WIDTH, DEFAULT_UNITS, SUPPOR... | StarcoderdataPython |
78697 | <reponame>aldenjenkins/ThiccGaming<filename>site/thicc/apps/scape/apps.py<gh_stars>0
from __future__ import unicode_literals
from django.apps import AppConfig
class RunescapeConfig(AppConfig):
name = 'runescape'
| StarcoderdataPython |
309587 | name = "animalai_train" | StarcoderdataPython |
6452624 | <filename>example/program/hello.py
# hello.py
import myname
name = myname.get_name()
print("hello {}".format(name))
| StarcoderdataPython |
11371410 | <filename>dbms/DBMS_PROJECT.py
"""
@author. : <NAME>
@institute. : MIT Institute Moradabad India
@branch. : Computer Science & Engineering
@work as. : Software Devlope & Machine Learning Engineer
@website. : https://medium.com/@akashsaininasa
@github. : https://github.com/Akash671
@LinkedIn. : h... | StarcoderdataPython |
9728736 | from abc import ABC, abstractmethod
from dataclasses import dataclass
from napari.utils.misc import StringEnum
class ROIBase(ABC):
@property
@abstractmethod
def name(self) -> str:
raise NotImplementedError()
@name.setter
@abstractmethod
def name(self, name: str) -> None:
pass... | StarcoderdataPython |
3537883 | <filename>task8/FixFloat.py
def fix(n):
def dec(func):
def wrapper(*args, **kwargs):
res = func(*[round(i, n) for i in args], **{el[0]: round(el[1], n) for el in kwargs.items()})
return round(res, n)
return wrapper
return dec
| StarcoderdataPython |
6401208 | import numpy as np
# When you turn this function in to Gradescope, it is easiest to copy and paste this cell to a new python file called hw1.py
# and upload that file instead of the full Jupyter Notebook code (which will cause problems for Gradescope)
def compute_features(names):
"""
Given a list of names of ... | StarcoderdataPython |
3242174 | from __future__ import unicode_literals
from django.db import models
# Create your models here.
from animeapp.animes import Anime
class Document(models.Model):
csvFile = models.FileField(upload_to='')
| StarcoderdataPython |
3512131 | from django.views.generic import TemplateView
from website.models import MENU, PAGES, P404, SERVICES
class HtmlTemplate(TemplateView):
def get_context_data(self, page_name='index.html', **kwargs):
page=PAGES.get(page_name, P404)
kwargs.update(
dict((k, v[0] if len(v)==1 else v) for ... | StarcoderdataPython |
1972731 | import math
def gcdExtend(a,b,x,y):
if a==0:
x=0
y=1
return b
x1=1
y1=1
g=gcdExtend(b%a,a,x1,y1)
x=y1-(b//a)*x1
y=x1
return g
x=1
y=1
a,b=map(int,input().split())
ans_gcd=gcdExtend(a,b,x,y)
print("gcd of (",a,b,") is",ans_gcd)
| StarcoderdataPython |
1962497 | <filename>model.py
import pandas as pd
import numpy as np
import pickle
import seaborn as sns
sns.set()
"""IMPORT THE IRIS DATASET FROM THE SKLEARN DATA SET"""
iris_data=pd.read_csv("Iris.csv")
"""DISPLAYING HEAD VALUES OF IRIS_DATA"""
print(iris_data.head())
"""**CHECKING THE NULL OR NaN DATA PR... | StarcoderdataPython |
1639600 | <reponame>JitenDhandha/CFit<filename>Main.py
####################################################################################
# <NAME>, 2020 #
# CFit is a curve fitting tool in python, based on the method of least squares. #
# It comes equipped with... | StarcoderdataPython |
4878712 | from collections.abc import Callable
import importlib
import warnings
def import_module(module_name, things_to_import):
try:
new_module = importlib.import_module(module_name)
return getattr(new_module, things_to_import)
except ModuleNotFoundError as e:
warnings.warn(f"\n{e}. If you don... | StarcoderdataPython |
11307356 | import os
os.system("/usr/local/bin/rdiscoveryd")
| StarcoderdataPython |
1652553 | import pyxel
from consts.colour import Colour
from typing import List
class Entity:
id = 0
all = {}
grid = None
def __init__(
self,
x: int, y: int, height: int, width: int,
base_colour: Colour, tick_rate: int = 5,
is_solid: bool = True, parent_collection: List ... | StarcoderdataPython |
6679448 | from .__ALGO__ import apply
def test_algorithm():
input = "Jane"
result = apply(input)
assert result == "Hello Jane!"
| StarcoderdataPython |
215322 | from postgres import Postgres
import urllib.parse
import os
import os.path
import json
import logging
import gzip
import traceback
import psycopg2
import operator
import psycopg2.extras
from psycopg2.extras import NumericRange
import math
from logging.handlers import TimedRotatingFileHandler
from io import BytesIO
from... | StarcoderdataPython |
1916874 | from collections import namedtuple
Point = namedtuple('Point', ['x', 'y'])
moves = {
'n': lambda p: Point(p.x-1, p.y),
's': lambda p: Point(p.x+1, p.y),
'e': lambda p: Point(p.x, p.y+1),
'w': lambda p: Point(p.x, p.y-1),
}
turns = {
'n': ['n', 'e', 'w'],
's': ['s', 'e', 'w'],
'e': ['e', ... | StarcoderdataPython |
5061893 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Unit test cases for numeric types."""
from argparse import ArgumentTypeError
from unittest import TestCase, main
from argparsetools.types.numeric import integer, floating, positive, \
strictly_positive, negative, strictly_negative
# TODO: gather commonly used va... | StarcoderdataPython |
4830533 | #!/usr/bin/env python
#Sequence Types Examples (Tuples, Strings and Lists)
#Tuple Type
tTuple = (16, 'Rohtash', 1, (2 , 5), 20, "Lakra")
print tTuple
print "First item in Tuple:"
print tTuple[0]
print "Second from right in tTuple"
print tTuple[-2]
print "Slicing:[1:4]"
print tTuple[1:4]
print
#List Type
tList = ["Roht... | StarcoderdataPython |
6699974 | # --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incor... | StarcoderdataPython |
3277688 | """
*******************************************************
*
* test_checkParams_constraints - UNIT TEST FOR TRAVIS CI
*
* License: Apache 2.0
* Written by: <NAME>
* Created on: April 28, 2017
* Last updated: April 29, 2018
*
*******************************************************
"""
#################... | StarcoderdataPython |
43457 | from django.urls import reverse
from rest_framework import status
from rest_framework.test import force_authenticate
from core.models import UserModel
from recycle import garbage
from recycle.models import CommercialRequest, Location
from recycle.views.commercial_order import EditCommercialOrderAPIView
from tests.unit... | StarcoderdataPython |
3313280 | from unittest import TestCase, mock
class TournamentTest(TestCase):
@mock.patch
| StarcoderdataPython |
4947230 | import re
import time
import unittest
import mock
import six
import chainer
from chainer.backends import cuda
from chainer import testing
from chainer import training
from chainer.training import extensions
def _get_mocked_trainer(links, stop_trigger=(10, 'iteration')):
updater = mock.Mock()
optimizer = moc... | StarcoderdataPython |
4858661 | <filename>camera.py
from fractions import Fraction
import io
import logging
import os
import random
import string
import time
try:
from picamera import PiCamera
except ImportError:
print 'Warning: PiCamera module not available'
from PIL import Image
import config
logger = logging.getLogger(__name__)
class... | StarcoderdataPython |
3449321 | <gh_stars>1-10
import json
from unittest.mock import patch
from .base import AppTestCase, asynctest
from influxproxy.configuration import config
from influxproxy.drivers import MalformedDataError
DB_USER = 'testing'
DB_CONF = config['databases'][DB_USER]
class PingTest(AppTestCase):
@asynctest
async def re... | StarcoderdataPython |
1738522 | n, k = map(int, input().split())
h = list(map(int, input().split()))
h.sort()
if k > n:
print(0)
exit()
total = sum(h[0: n - k])
print(total)
| StarcoderdataPython |
11222862 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
gadget includes many small utility tools.
"""
from .backup import run_backup
from .codestats import CodeStats
from .configuration import Configuration
from .controlflow import try_until_succeed, try_ntimes
from .logger import EZLogger
from .messenger impor... | StarcoderdataPython |
299246 | from random import choice as _choice, randint as _randint
from sys import argv as _argv
__all__ = ('mega_obf', 'obfuscate')
_other_hex_mode = False # Hex mode. If it's true then it's the same as having 3 custom args in sys.argv.
alphabet = [chr(i) for i in range(97, 123)]
name = ''.join([_choice(alphabet) for _ in ... | StarcoderdataPython |
11234424 | #import os # clear screen
import numpy as np # matrix calc
from scipy.integrate import odeint # scientific computation (ode solver)
from utils.methods import poolData, sparsifyDynamics, sparseGalerkin , sparseGalerkin3D
import matplotlib.pyplot as py
#os.system('clear')
# Generate data
A=np.array([[-0.1, 2, 0],[ -... | StarcoderdataPython |
3226834 | <gh_stars>1-10
# python3
# Copyright 2018 DeepMind Technologies Limited. 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.... | StarcoderdataPython |
6456059 | <gh_stars>1-10
import math
from PIL import Image
from hilbertcurve.hilbertcurve import HilbertCurve
import numpy as np
import pygame
class World:
"""
Physical environment simulation element
"""
def __init__(self, map_file_name):
self.__map_file_name = map_file_name
self.__width =... | StarcoderdataPython |
9746285 | <reponame>lthurlow/Boolean-Constrained-Routing
"""
Boolean Vector Logic Expressions
Interface Functions:
bitvec
uint2bv
int2bv
Interface Classes:
BitVector
"""
from pyeda.boolalg.boolfunc import Slicer, VectorFunction
from pyeda.boolalg.expr import exprvar, Not, Or, And, Xor
from pyeda.util import cl... | StarcoderdataPython |
5033998 | <reponame>DragoNext/Drago-2D-Engine
class D2DWidgets:
def __init__(self,D2DOBJ,EVMANAGER):
"""Widgets :D"""
self.D2D = D2DOBJ
self.EVENT_MANAGER = EVMANAGER
self.WIDGETS = []
# _std standard events for widgets :3
def _std_x(self,*ALL_VARIABLESIN):
... | StarcoderdataPython |
1889978 | # 在我们执行import时,当前目录是不会变的(就算是执行子目录的文件),还是需要完整的包名
from uncompressor.extract import unzip # 导入函数unzip, 在其它地方需要调用函数unzip时, 只需要import uncompressor, 然后通过uncompressor.unzip调用
from uncompressor.extract import unrar
from uncompressor.extract import decompression
| StarcoderdataPython |
1944815 | import datetime
import json
import re
from collections import OrderedDict
from urllib.parse import parse_qs, urlparse
import bleach
import pytz
from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.exceptions import ValidationError as DjangoValidationError
from django.core.va... | StarcoderdataPython |
8115900 | from flask import current_app as app
import hashlib
import psycopg2
organization_field_length = 15
faculty_field_length = 10
group_field_length = 5
class ScheduleDB:
def __init__(self, config):
self.con = psycopg2.connect(
dbname=config["SCHEDULE_DB_NAME"],
user=config["SCHEDULE_D... | StarcoderdataPython |
3528854 | <gh_stars>1-10
class RRPProxyAPIDownException(Exception):
pass
| StarcoderdataPython |
344387 | #!/usr/bin/env python
import os
from joblib import Memory
from . import paths
from ..utils.files import listFilesInDir, ensure_dir_exists
from .pamap_common import * # noqa
memory = Memory('./')
join = os.path.join
# ================================================================
# consts
MISSING_DATA_VALUE = -... | StarcoderdataPython |
6677583 | <gh_stars>0
################################################################################
## author: <NAME>
## version: 1.0
## Python 3.6.5 | UTF-8
import socket
from threading import Thread
from random import randint
################################################################################
class Server:
... | StarcoderdataPython |
388433 | <reponame>jacksonpradolima/comfort
def new(a,b):
return a - b
def x(a,b):
return a
def y(z,t):
return z(*t)
def inModule2(a,b):
return a+b
def outerMethod(a,b):
def innerMethod(a,b):
if a < b:
return a+b
else:
return a-b
return innerMethod(a+2, b+4)
... | StarcoderdataPython |
5012873 | <filename>p646_maximum_length_of_pair_chain.py<gh_stars>0
#!/usr/bin/env python
# coding: utf-8
class Solution(object):
def findLongestChain(self, pairs):
"""
:type pairs: List[List[int]]
:rtype: int
"""
if not pairs:
return 0
pairs.sort(key=lambda p: (p... | StarcoderdataPython |
9717694 | import mongoengine
from mongoengine import *
SIDE = ((0, 'Radiant'),
(1, 'Dire'))
class Hero(Document):
id = LongField(primary_key=True)
name = StringField(required=True)
localized_name = StringField(required=True)
meta = {'db_alias': 'Daedalus'}
class PlayerPerformance(EmbeddedDocument):
... | StarcoderdataPython |
3315518 | import sys
import os
import time
import string
import random
from subprocess import *
from math import floor
import numpy as np
import pandas as pd
from shared.args import get_valued_arg, is_arg_passed, get_int_valued_arg
from shared.moduleloading import load_resel_mode
def print_usage (show_help_line=False):
"... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.