id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
9761807 | <filename>tests/bugs/core_3211_test.py
#coding:utf-8
#
# id: bugs.core_3211
# title: String truncation occurs when selecting from a view containing NOT IN inside
# decription:
# tracker_id: CORE-3211
# min_versions: ['2.5.1']
# versions: 2.5.1
# qmid: None
import pytest
from firebird.... | StarcoderdataPython |
6440297 | <gh_stars>1-10
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | StarcoderdataPython |
8131762 | from opentracing_utils import trace, extract_span_from_kwargs, trace_flask, trace_requests, remove_span_from_kwargs
def test_dummy():
assert extract_span_from_kwargs
assert remove_span_from_kwargs
assert trace
assert trace_flask
assert trace_requests
| StarcoderdataPython |
3532822 |
import os
import pycountry
directory = './'
for filename in os.listdir(directory):
if filename.endswith(".png") and len(filename) == 6:
country_code_2_letter = filename.split(".")[0]
png_path = os.path.realpath(filename)
#print(country_code_2_letter)
for country in pycountry.coun... | StarcoderdataPython |
1904466 | <gh_stars>10-100
import json
import pytest
from tests.testapp.models import BlogPage
from tests.utils import get_test_image_file
from wagtail_live import blocks
from wagtail_live.receivers.base import TEXT, BaseMessageReceiver
from wagtail_live.webapp.models import Channel, Image, Message
from wagtail_live.webapp.rec... | StarcoderdataPython |
12823036 | <reponame>FroeMic/CDTM-Backend-Workshop<gh_stars>0
from flask import jsonify, request, session
import os, shutil
from server import app
from server.database import *
from server.utils import list_access, list_owner, login_required, has_json
# MARK: List routes
@app.route('/api/lists', methods=['GET'])
@login_require... | StarcoderdataPython |
6627323 | <filename>terra_bonobo_nodes/terra.py
import logging
from copy import deepcopy
from json import JSONDecodeError
from bonobo.config import Configurable, Option, Service
from bonobo.config.processors import ContextProcessor
from bonobo.constants import END, NOT_MODIFIED
from bonobo.util.objects import ValueHolder
from d... | StarcoderdataPython |
6416901 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import forms
from machina.core.db.models import get_model
ForumProfile = get_model('forum_member', 'ForumProfile')
class ForumProfileForm(forms.ModelForm):
class Meta:
model = ForumProfile
fields = ['avatar', 'signatur... | StarcoderdataPython |
3570729 | <gh_stars>0
# coding: utf-8
# parseduxml
#
# script to parse rss xml feed from http://www.education.govt.nz/
#
# Had problems parsing the html so i decided to add a try and pass if exception. It fixes it but does this mean it's going to save less data?
#
# Saving it as json. I'll make another script to build the ... | StarcoderdataPython |
3518211 | <filename>sunspot_code/hubble_solutions.py
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 31 15:18:46 2019
@author: rdickson
"""
def distance_from_modulus(dist_mod):
# Reference: https://lco.global/spacebook/what-is-distance-modulus/
parsecs = 10**((dist_mod+5)/5)
return parsecs
# Ingest the data
import ... | StarcoderdataPython |
149218 | <filename>pydsalg/datastruct/hashset.py
class HashSetString:
_ARR_DEFAULT_LENGTH = 211
def __init__(self, arr_len=_ARR_DEFAULT_LENGTH):
self._arr = [None,] * arr_len
self._count = 0
def _hash_str_00(self, value):
hashv = 0
for c in value:
hashv = (hashv * 27 + or... | StarcoderdataPython |
8011111 | <gh_stars>1-10
from ..exo_classes.exo_context import Context
from ..exo_errors.exo_errors import RTError
TT_VAR = 'var'
TT_INT = 'int'
TT_FLOAT = 'float'
TT_STRING = 'string'
TT_FUNCTION = 'fun'
TT_LIST = 'list'
class Value:
def __init__(self):
self.pos_start = None
self.pos_end = None
se... | StarcoderdataPython |
4928193 | <gh_stars>0
import sys
import os
master_word_list = []
f = open('dictionary.txt', 'r')
for line in f:
master_word_list.append(line.strip())
f.close()
out = open("8_chars_or_less.txt",'w')
for i in master_word_list:
if len(i) < 9:
out.write(i + '\n')
f.close()
| StarcoderdataPython |
6616039 | <reponame>signove/vital-sign-simulator<gh_stars>0
# file ecg.py
# date Feb 3, 2020
#
# Copyright (C) 2020 Signove Tecnologia Corporation.
# All rights reserved.
# Contact: Signove Tecnologia Corporation (<EMAIL>)
#
# $LICENSE_TEXT:BEGIN$
# MIT License
#
# Permission is hereby granted, free of charge, to a... | StarcoderdataPython |
5129360 | <reponame>y3rsh/opentrons<filename>api/tests/opentrons/protocol_runner/test_json_file_reader.py
"""Integration tests for the JsonFileReader interface."""
from decoy import matchers
from pathlib import Path
from opentrons.protocol_runner.protocol_source import ProtocolSource
from opentrons.protocol_runner.pre_analysis ... | StarcoderdataPython |
6430741 | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def deleteDuplicates(self, head: ListNode) -> ListNode:
node = head
while node and node.next:
if node.val ==node.next.val:
... | StarcoderdataPython |
11307547 | import os
import torch
from pelutils import MainTest
from transformers import AutoTokenizer
from daluke import daBERT
from daluke.data import BatchedExamples
from daluke.pretrain.data import load_entity_vocab, DataLoader, calculate_spans
from daluke.pretrain.data.build import DatasetBuilder
class TestData(MainTest)... | StarcoderdataPython |
1737977 | from pp.name import autoname
from pp.component import Component
from pp.layers import LAYER
from pp.port import deco_rename_ports
from pp.components.hline import hline
WIRE_WIDTH = 10.0
@deco_rename_ports
@autoname
def wire(length=50.0, width=WIRE_WIDTH, layer=LAYER.M3):
""" electrical straight wire
.. plo... | StarcoderdataPython |
1969553 | '''
Kattis - musicyourway
Relatively easy stable sorting problem since python's sort is stable by default.
Time: O(nm log n), Space: O(n)
'''
attributes = list(input().split())
hashmap = {}
for index, attribute in enumerate(attributes):
hashmap[attribute] = index
n = int(input())
songs = []
for i in range(n):
... | StarcoderdataPython |
12808651 | from django.contrib.auth.models import User, Group
from django.db.models import Q, Prefetch
from rest_framework import serializers
from dashboard.models import Post, Comment, Category
from users.models import Membership
from api_v1.containers.comment.serializers import CommentSerializer
from api_v1.containers.component... | StarcoderdataPython |
6498572 |
from absl import app, flags, logging
from absl.flags import FLAGS
import os
import time
import statistics
import tensorflow as tf
import cv2
from ops.bbox import chunk_anchors
from dataloader.data import load_class_names
from tasks.task import build_model, inference
from utils.interface import draw_boxes_cv2
fla... | StarcoderdataPython |
11337967 | <gh_stars>0
#------------------------------------------
# --- Author: Bing
# --- Version: 1.0
#--- Python Ver: Python 2.7
#--- Description: This code will Update (POST) the Device Shadw State Doc(Json) on AWS IoT Platform
#---
#--- Refer to following Doc for AWS Device Shadow REST APIs -
#--- http://docs.aws.amazon.com... | StarcoderdataPython |
5117883 | from django.test import TestCase
from web.models import Player
from web.utils import generate_unique_anonymous_username
class GenerateUniqueAnonymousUsernameTest(TestCase):
def setUp(self):
self.player = Player.objects.create(username=generate_unique_anonymous_username(), type='anonymous')
def test... | StarcoderdataPython |
6673097 | <reponame>dubiety/azure-sdk-for-python
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from .dataset_paths import PathSchema
from marshmallow import fields, post_load, validates, Validati... | StarcoderdataPython |
3418641 | import unittest
from src.t1000.domain.entity import Event
class EventTestCase(unittest.TestCase):
def setUp(self):
return super().setUp()
def tearDown(self):
return super().tearDown()
def test_equal_events(self):
event_entity_1 = Event('asdf', '2019-10-19', '07:05:00', 'entrada')... | StarcoderdataPython |
1982468 | <reponame>Ch3kUtHaN/Maintainance-Bot<filename>plugins/maintainance-bot.py
# (c) HeimanPictures
from pyrogram import Client, filters
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
from config import Config
@Client.on_message(filters.private & filters.command(['start', 'help', 'about']))
async de... | StarcoderdataPython |
378304 | """ Defines ArrayPlotData.
"""
from numpy import array
# Enthought library imports
from traits.api import Dict
# Local, relative imports
from abstract_plot_data import AbstractPlotData
class ArrayPlotData(AbstractPlotData):
""" A PlotData implementation class that handles a list of Numpy arrays
(or a 2-D N... | StarcoderdataPython |
3516192 | <filename>examples/trajectory.py
from __future__ import division, print_function # absolute_import
import matplotlib.pyplot as plt
import numpy as np
from builtins import range
from scipyplot.plot import color_over_time, color_over_trajectories, save2file
# Generate some data
n_curves = 10
x = np.linspace(0, 1, 10... | StarcoderdataPython |
3287028 | '''
This file contains several helper methods for working with service provider and component metainfo, as well as basic
service provider functionality and subclasses appropriate for real service provider types.
'''
import cPickle
import logging
log = logging.getLogger("service_provider")
import wx
import hooks
impor... | StarcoderdataPython |
11261857 | """ Contains methods for accessing the API Endpoints """
import types
from my_test_api_client.api.parameters import get_same_name_multiple_locations_param
class ParametersEndpoints:
@classmethod
def get_same_name_multiple_locations_param(cls) -> types.ModuleType:
return get_same_name_multiple_locati... | StarcoderdataPython |
3319388 | <reponame>datawire/kubernaut-node<gh_stars>1-10
import pytest
from kubernaut.model import Cluster
def test_cluster_shutdown():
call_invocations = []
def fake_handler(*args, **kwargs):
call_invocations.append((args, kwargs))
return 0, ""
cluster = Cluster(
cluster_id="FAKE_CLUST... | StarcoderdataPython |
9791374 | <gh_stars>0
def boxBlur(image):
'''
Apply the box blur algorithm to the photo to hide its content.
The pixels in the input image are represented as integers.
The algorithm distorts the input image in the following way:
Every pixel x in the output image has a value equal to the average
va... | StarcoderdataPython |
106852 | <reponame>chars32/edx_python
#Write a function that accepts a string and a character as input and returns the
#number of times the character is repeated in the string. Note that
#capitalization does not matter here i.e. a lower case character should be
#treated the same as an upper case character.
def count_character(... | StarcoderdataPython |
1897959 | <filename>web/utils.py
from django.conf import settings
from django.core.urlresolvers import resolve
from frgl.middleware.httpredirect import HttpRedirectException
from disqusapi import DisqusAPI
try: from web import models
except: pass
import string, random
rawContext ={
'debug': settings.DEBUG,
'images_hosti... | StarcoderdataPython |
328888 | <filename>lms_app/migrations/0001_initial.py
# Generated by Django 2.1.3 on 2018-12-14 18:21
import datetime
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
]
... | StarcoderdataPython |
1998455 | <gh_stars>10-100
# Derived from nova/network/linux_net.py
#
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License,... | StarcoderdataPython |
11288705 | <reponame>chenwenxiao/DOI
import time
import click
import numpy as np
from utils.data import *
from utils.data.mappers import *
def init_random(seed=None):
if seed is None:
seed = int(time.time())
print(f'Random seed: {seed}')
print('')
np.random.seed(seed)
@click.group()
def main():
"... | StarcoderdataPython |
3259798 | # Copyright (c) 2015-present, Facebook, Inc.
# All rights reserved.
import os
import json
import numpy as np
import torch
from torchvision import datasets, transforms
from torchvision.datasets.folder import ImageFolder, default_loader
from PIL import Image
from timm.data.constants import IMAGENET_DEFAULT_MEAN, IMAGE... | StarcoderdataPython |
6454151 | # coding: utf-8
class Ficha():
def __init__(self):
self.encarcelada = True
self.coronada = False
self.recta_final = False
# Asignar después de instanciar
self.posicion = 0
def dump_object(self):
"""Retorna el estado actual del objeto"""
return {
... | StarcoderdataPython |
1961196 | from django.db import models
from django.contrib.auth.models import AbstractUser
import pytz
COMMON_TIMEZONETUPLE = []
for timezone in pytz.common_timezones:
COMMON_TIMEZONETUPLE.append((timezone, timezone))
## We'll use the UX app to store our user model.
class User(AbstractUser):
socialTool = models.Boole... | StarcoderdataPython |
9635022 | import pickle
import unittest
from kirby.experiment import Experiment
from kirby.qa_model import QAModel
from kirby.run_params import RunParams
class TestQAModel(unittest.TestCase):
def setUp(self):
data_path = "data/augmented_datasets/pickle/"
self.run_params = RunParams(
data_files=... | StarcoderdataPython |
8173427 | <reponame>katema-official/Universita_magistrale_anno_1.1
import re
class UpDownFile:
def __init__(self, file_name):
self.file = open(file_name)
self.list_of_words = re.findall(r"\w+", self.file.read())
def __iter__(self):
self.index = 0
return self
def __next__(self):
... | StarcoderdataPython |
3350097 | <reponame>GELIELEO/vision_for_paper<gh_stars>1-10
import argparse
# import tensorflow as tf
# from tensorflow.python.summary import event_accumulator as ea
from tensorboard.backend.event_processing import event_accumulator as ea
from matplotlib import pyplot as plt
from matplotlib import colors as colors
import seabor... | StarcoderdataPython |
9788411 | <filename>lizardanalysis/calculations/direction_of_running.py
import pandas as pd
import numpy as np
from numpy import array
import math
def direction_of_running(**kwargs):
"""
Uses the Head tracking point to determine the direction of climbing.
Depending on the clicked value, which determines the... | StarcoderdataPython |
11229848 | <reponame>patrick-kidger/diffrax
import jax
import jax.interpreters.batching as batching
import jax.interpreters.mlir as mlir
import jax.interpreters.xla as xla
import jax.numpy as jnp
# unvmap_all
_unvmap_all_p = jax.core.Primitive("unvmap_all")
def unvmap_all(x):
return _unvmap_all_p.bind(x)
def _unvmap_al... | StarcoderdataPython |
382712 | import torch
from src import CraterDetector
if __name__ == "__main__":
model = CraterDetector()
model.load_state_dict(torch.load("blobs/CraterRCNN.pth"))
| StarcoderdataPython |
141308 | # Generated by Django 2.0 on 2018-06-20 13:14
import blog.models
import django.core.validators
from django.db import migrations, models
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.embeds.blocks
class Migration(migrations.Migration):
dependencies = [
('blog', '0005_auto_20180619_... | StarcoderdataPython |
6518367 | <reponame>alvaroiramirez/SensorTile<filename>stconfig.py
# Handles and characteristics
# ===========================
# CHAR_RW = '00000008-0001-11e1-ac36-0002a5d5c51b'
CHAR_RW = '00002a00-0000-1000-8000-00805f9b34fb' # Characteristic for Device Name
HANDLE_READ_DATA = 16
# Devices
# =======
# DEVICE_MAC = 'C0:83... | StarcoderdataPython |
19269 | <gh_stars>0
#!/usr/bin/env python
import rospy
from geometry_msgs.msg import Twist
import math
import os
from turtlesim.msg import Pose
import time
os.system("rosrun")
def callback(msg):
global current_angle
current_angle = msg.theta
# print(msg)
def move():
# Starts a new node
rospy.init_node('ro... | StarcoderdataPython |
11287659 | #!/usr/bin/env python
# Libraries
import imapclient
import imaplib
import json
import os
# Local imports
import account_settings
import constants
import utils
# Ordered tuple of folders which we need to consider first since
# we expect them to be the most common.
SPECIAL_FOLDERS = ('[Gmail]/All Mail', 'INBOX')
CURR... | StarcoderdataPython |
6546373 | #!/usr/bin/python3
# This code is designed to run with the D3 Xavier driver which
# we distribute separately (in binary form not source.)
import cv2
import numpy as np
import matplotlib.pyplot as plt
import os
import threading
IMG_FONT = cv2.FONT_HERSHEY_SIMPLEX
WHITE_COLOR = (255, 255, 255)
class BosonCamera:
... | StarcoderdataPython |
1600217 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import
import six
import six.moves.cPickle as pickle
from six.moves.queue import Queue
import sys
from threading import Thread
from mathics import settings
from... | StarcoderdataPython |
3457065 | <filename>eyey/utils.py
import re
import email
import logging
fh = logging.FileHandler('eyey.log')
formatter = logging.Formatter('%(asctime)s - %(module)s.%(funcName)s - %(message)s')
fh.setFormatter(formatter)
fh.setLevel(logging.WARNING)
sh = logging.StreamHandler()
sh.setFormatter(formatter)
sh.setLevel(logging.DEB... | StarcoderdataPython |
6412634 | # -*- coding: utf-8 -*-
import argparse
import glob
import json
from lib import *
import math
from matplotlib import pyplot as plt
import os
import numpy as np
from PIL import Image
from pprint import pprint
import sys
# input
parser = argparse.ArgumentParser()
parser.add_argument('-config', dest="CONFIG", default="c... | StarcoderdataPython |
4926953 | <reponame>JennyCCDD/epidemix<filename>epidemix/vaccination.py
########################################################################
'''
A place to define vaccination strategies.
Author: <NAME>
Date : 2020.06.06 - 2020.08.11
'''
########################################################################
... | StarcoderdataPython |
9770722 | <reponame>KrithikMurugesan/Exeter-coding-challenge<filename>exeter_coding.py
import csv
import re
d={}
def csvToDictionary():
reader = csv.reader(open('/content/drive/MyDrive/Exeter/french_dictionary.csv', 'r'))
d = {}
for row in reader:
k, v = row
d[k] = v
return d
def textToLi... | StarcoderdataPython |
387727 | #<NAME> <<EMAIL>> wants to use XInclude in his stylesheets
from Xml.Xslt import test_harness
import os
from Ft.Lib import Uri
BASE_URI = Uri.OsPathToUri(os.path.abspath(__file__), attemptAbsolute=True)
INCLUDE_URI = Uri.Absolutize('tg_20010628-include.xml', BASE_URI)
sheet_1 = """\
<?xml version="1.0" encoding="iso-... | StarcoderdataPython |
3570252 | import cv2
import numpy as np
capture = cv2.VideoCapture('messi.mp4')
while(True):
ret, frame = capture.read()
img = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
# n=4
# kernel = np.ones((n,n),np.float32)/(n*n)
# img = cv2.filter2D(img,-1,kernel)
img = cv2.GaussianBlur(img,(5,5),0)
ret,th... | StarcoderdataPython |
283769 | # Copyright 2011 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | StarcoderdataPython |
280896 | from django_redis import get_redis_connection
from rest_framework.decorators import action
from rest_framework.generics import CreateAPIView
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import View,APIView
from rest_framework.viewsets impo... | StarcoderdataPython |
11375872 | <reponame>sjforeman/RadioFisher<filename>plotting/plot_Veff.py
#!/usr/bin/python
"""
Plot effective volume as a function of perp/parallel k. (Fig. 2)
"""
import numpy as np
import pylab as P
import scipy.interpolate
import matplotlib.cm, matplotlib.ticker
import scipy.ndimage
from rfwrapper import rf
from radiofisher.u... | StarcoderdataPython |
4887955 | """
MIT License
Copyright (c) 2021 <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
to use, copy, modify, merge, publish, distri... | StarcoderdataPython |
8009520 | <filename>uncertainty/tests/test_word.py
import unittest
from uncertainty.word import *
class WordsTestCase(unittest.TestCase):
def test_get_features(self):
data = [
('Its', 'it', 'PRP$', 'B-np'),
('short', 'short', 'JJ', 'I-np'),
('life', 'life', 'NN', 'I-... | StarcoderdataPython |
3312541 | import serial
import sys
import time
import serial.tools.list_ports
print "initializing..."
serPort = ""
totalPorts = 0
count = 0
comportInteger = 0
comportnameStr = ""
comportnumberStr = ""
eggNotFound = True
print "Ready!"
while eggNotFound:
# Find Live Ports
ports = list(serial.tools.list_ports.comports())... | StarcoderdataPython |
12812971 | <filename>srn/model/resnet_srn.py
from .srn import SRN
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
import torch.utils.model_zoo as model_zoo
__all__ = ['ResNetSRN', 'resnet50']
model_urls = {
'resnet50': 'https://download.pytorch.org/models/resnet50-19c8e357.pth'
}
def conv... | StarcoderdataPython |
6664590 | import typing
import hypothesis.strategies as st
from capi.src.hypothesis_strategies.coordinate import coordinate_strategy
from capi.src.implementation.datastructures.polygon import Polygon
@st.composite
def polygon_strategy(draw: typing.Callable, min_num_vertices: int = 3, max_num_vertices: int = 10):
vertices... | StarcoderdataPython |
1738981 | <reponame>sniff122/ImageUploader
try:
from flask import render_template, jsonify, request, Flask, send_from_directory, redirect
import json, time, random, requests, os
import secrets
import discord
from discord.ext import commands
from discord.ext.commands import bot
import asyncio
impor... | StarcoderdataPython |
3550167 | """Split a mesh by connectivity and
order the pieces by increasing area.
"""
from vedo import *
em = load(datadir+"embryo.tif").isosurface(80)
# return the list of the largest 10 connected meshes:
splitem = em.splitByConnectivity(maxdepth=40)[0:9]
show( [(em, __doc__), splitem], N=2, axes=1 )
| StarcoderdataPython |
44879 | master_doc = 'index'
extensions = ['sphinxprettysearchresults']
templates_path = ['_templates'] | StarcoderdataPython |
211013 | """ Dont duplicate errors same type. """
DUPLICATES = (
# multiple statements on one line
[('pep8', 'E701'), ('pylint', 'C0321')],
# missing whitespace around operator
[('pep8', 'E225'), ('pylint', 'C0326')],
# unused variable
[('pylint', 'W0612'), ('pyflakes', 'W0612')],
# undefined va... | StarcoderdataPython |
9771504 | <reponame>PythonGirlSam/lunr
#!/usr/bin/env python
# Copyright (c) 2011-2016 Rackspace US, 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... | StarcoderdataPython |
3283958 | def color_add():
'''Add new color to active palette
'''
pass
def color_delete():
'''Remove active color from palette
'''
pass
def new():
'''Add new palette
'''
pass
| StarcoderdataPython |
324736 | numbers = [14, 2,3,4,5,6,7,6,5,7,8,8,9,10,11,12,13,14,14]
numbers2 =[]
for number in numbers:
if number not in numbers2:
numbers2.append(number)
print(numbers2) | StarcoderdataPython |
1618016 | <reponame>abb-iss/distributed-fuzzy-vault
"""
Poly Ring by user6655984 on StackOverflow
https://stackoverflow.com/questions/48065360/interpolate-polynomial-over-a-finite-field
"""
import itertools
class PolyRing:
def __init__(self, field):
self.K = field
def add(self, p, q):
s = [sel... | StarcoderdataPython |
9711253 | <filename>tests/helpers/test_cmd.py
"""aws_codeartifact_poetry.helpers.cmd unit tests."""
import os
import subprocess
import sys
from unittest.mock import MagicMock, patch
import pytest
from _pytest.logging import LogCaptureFixture
from aws_codeartifact_poetry.helpers.catch_exceptions import CLIError
from aws_codear... | StarcoderdataPython |
1974638 | <reponame>lintosh/mailMorth<gh_stars>0
#~ version one of the mailMorth api which would hold all the functionalities of our version one
#(@: Name): "mailMorth"
#(@:Description): "email Management, and automation api code"
#(@:Author): "inteliJence development team"
#under the license of Apache License 2.0 and ... | StarcoderdataPython |
8141175 | from setuptools import find_packages, setup
def readme():
with open('README.rst') as f:
return f.read()
setup(name='pll',
version="0.1",
description="Design and simulation of RF phase-locked loops",
long_desription=readme(),
classifiers=[
'Development Status :: Alpha ::',... | StarcoderdataPython |
9692563 | <reponame>vvoelz/ratespec
#!/usr/bin/env python
import os, sys, glob
import scipy
from scipy.linalg import pinv
import numpy as np
import matplotlib
from pylab import *
from RateSpecClass import *
from RateSpecTools import *
UsePlotting = False
try:
from PlottingTools import *
UsePlotting = True
except:
... | StarcoderdataPython |
8004144 | <filename>volttron/tests/base.py
import json
import os
import shutil
import subprocess
import sys
import time
import tempfile
import unittest
from contextlib import closing
from StringIO import StringIO
from volttron.platform import aip
from volttron.platform.control import server
from volttron.platform import packag... | StarcoderdataPython |
172746 | <reponame>alexwawl/leetcode-solutions-javascript-python
"""
# Definition for a Node.
class Node(object):
def __init__(self, val, children):
self.val = val
self.children = children
"""
class Solution(object):
def preorder(self, root):
"""
:type root: Node
:rtype: List[int]... | StarcoderdataPython |
9741579 | # PLEASE STOP!
# DO NOT EDIT THIS FILE OR DELETE THIS FILE
# Create a new config.py file in same directory and import, then extend this class.
# Special Credit @Jisan09
import os
from typing import Set
from telethon.tl.types import ChatBannedRights
class Config(object):
LOGGER = True
# MUST NEEDED VARS
... | StarcoderdataPython |
3406962 | <reponame>dasmith2/djaveS3
# flake8: noqa
from djaveS3.models.file import File
from djaveS3.models.signed_file import SignedFile
from djaveS3.models.test_photo import TestPhoto
| StarcoderdataPython |
3547073 | import unittest
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
@staticmethod
def from_array(vals):
if not vals:
return None
root_parent = ListNode(0)
parent = root_parent
for val in val... | StarcoderdataPython |
3566563 | from django.http.response import JsonResponse
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.contrib.auth import get_user_model
from django.contrib import auth
from decouple import config
from accounts.utils import check_login
from .models import Place
from .ser... | StarcoderdataPython |
160835 | import cv2
import numpy as np
import ImageLoader as il
from pprint import pprint
FACE_CASCADE = cv2.CascadeClassifier('haar_cascade.xml')
SIDE_CASCADE = cv2.CascadeClassifier('lbpcascade_sideface.xml')
def detect_faces(img):
"""
Method for detecting all faces in a given image.
"""
gray = cv2.cvtColor(... | StarcoderdataPython |
3571492 | <filename>arviz/tests/helpers.py
import os
import pickle
import numpy as np
import pymc3 as pm
import pystan
def eight_schools_params():
"""Share setup for eight schools"""
return {
'J': 8,
'y': np.array([28., 8., -3., 7., -1., 1., 18., 12.]),
'sigma': np.array([15., 10., 16., 11., 9.,... | StarcoderdataPython |
8128332 | <reponame>linearlabstech/blox<filename>BLOX/Core/Metrics.py
import inspect
import ignite.metrics as metrics
METRICS = dict(inspect.getmembers(metrics)) | StarcoderdataPython |
6501622 | <gh_stars>0
"""JAX-related utilities."""
from collections import namedtuple
import jax
import jax.lax as lax
import jax.numpy as jnp
from jax import jit
from jax.dtypes import canonicalize_dtype
from jax.experimental import host_callback
from jax.tree_util import tree_flatten, tree_leaves, tree_map, tree_unflatten
__... | StarcoderdataPython |
11295843 | try:
import resource
except ImportError:
resource = None
import time
class DebugTimer(object):
has_resource = resource is not None
def elapsed_ru(self, name):
return getattr(self._end_rusage, name) - getattr(self._start_rusage, name)
def start(self, request):
self._start_time... | StarcoderdataPython |
186337 | from gip.logging import autoinit # NOQA
import gip.functions
from gip import args
from gip import version
__version__ = version.__version__
def main():
parser = args.ArgumentsParser()
tokens = parser.parse_tokens()
if len(tokens) == 0:
tokens.append(args.Token('', 'help', verbose=False))
gi... | StarcoderdataPython |
11277233 | """
Dataset Downloader
Module Description
==================
Module for downloading and building the project database.
Copyright Information
===============================
This file is Copyright (c) 2021 <NAME>, <NAME>, <NAME>, <NAME>.
"""
from typing import Union
from termcolor import colored
from core.util import... | StarcoderdataPython |
300306 | import networkx as nx
import scipy
import matplotlib.pyplot as plt
from networkx.drawing.nx_agraph import write_dot
from networkx.drawing.nx_agraph import to_agraph
from IPython.display import Image
import pygraphviz as pgv
def graph(G, color="#cccccc", filename="/tmp/simple.png"):
for u, v in G.edges:
... | StarcoderdataPython |
205156 | """
DESCRIPTION:
Tools for getting Authorization websites of Nanjing University
PACKAGES:
NjuUiaAuth
NjuEliteAuth
"""
import execjs
import requests
import re
import os
from io import BytesIO
URL_NJU_UIA_AUTH = 'https://authserver.nju.edu.cn/authserver/login'
URL_NJU_ELITE_LOGIN = 'http://elite.nju.edu.cn/j... | StarcoderdataPython |
11222650 | <gh_stars>0
from quex.input.code.base import SourceRef
from quex.engine.state_machine.core import DFA
from quex.engine.state_machine.character_counter import SmLineColumnCountInfo
from quex.engine.misc.tools import typed
from quex.constants ... | StarcoderdataPython |
287714 | <filename>apps/blog/urls.py
# blog/urls.py
# Django modules
from django.urls import path
# Locals
from .views import *
app_name = 'blog'
urlpatterns = [
path('', HomeView.as_view(), name='homepage'),
path('posts/', PostListView.as_view(), name='post_list'),
path('post/1', PostDetailView, name='post_detai... | StarcoderdataPython |
3484583 | from pathlib import Path
from fhir.resources.codesystem import CodeSystem
from oops_fhir.utils import CodeSystemConcept
__all__ = ["GoalLifecycleStatus"]
_resource = CodeSystem.parse_file(Path(__file__).with_suffix(".json"))
class GoalLifecycleStatus:
"""
GoalLifecycleStatus
Codes that reflect the c... | StarcoderdataPython |
3384659 | <filename>2_TOT/visualize_pnas.py
# Copyright 2015 <NAME>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This progr... | StarcoderdataPython |
11279229 | import os, sys
import cv2
import torch
import torchvision
import torch.nn.functional as F
import torch.nn as nn
import numpy as np
from glob import glob
import time
import datetime
import imageio
sys.path.append('./models/')
from FLAME import FLAME, FLAMETex
from renderer import Renderer
import util
to... | StarcoderdataPython |
8158419 | # Copyright 2012 OpenStack LLC.
# Copyright 2014 DreamHost, LLC.
# All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICE... | StarcoderdataPython |
3200370 | from dl.optimizer.Optim import Optim
class LRDecayScheduler:
def __init__(self,
optimizer: Optim,
decay_mode="min",
factor=1e-1,
tolerance_round=10,
verbose=False,
cooldown=0,
min_lr=0,
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.