id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1756488 | <filename>posts/views.py
from django.core.paginator import Paginator
from django.shortcuts import render, get_object_or_404, redirect
from django.utils import timezone
from django.contrib import messages
from django.http import HttpResponseForbidden
from django.urls import reverse_lazy
from django.contrib.auth.models i... | StarcoderdataPython |
1773407 | <gh_stars>0
from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name="short-chn-yn",
version="0.0.2",
author="cltian",
author_email="<EMAIL>",
description="Short Chinses literal YES or NO recognition by logic",
long_description=l... | StarcoderdataPython |
67943 | #
# Copyright (c) 2015 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | StarcoderdataPython |
3270788 | import datetime
import unittest
import lxml.etree
from clarify.parser import (Parser, ResultJurisdiction)
class TestParser(unittest.TestCase):
def test__underscore_to_camel(self):
self.assertEqual(Parser._underscore_to_camel(""), "")
self.assertEqual(Parser._underscore_to_camel("test"), "test")... | StarcoderdataPython |
35879 | # --------------------------------------------------------
# Licensed under The MIT License [see LICENSE for details]
# --------------------------------------------------------
import os
import torch
import torch.nn.functional as F
import numpy as np
from core import networks
from core.utils import *
from core.loss i... | StarcoderdataPython |
84243 | # -*- coding: utf-8 -*-
"""
Created on Fri Oct 12 13:16:08 2018
@author: <NAME>
"""
"""colRecoder2(dataFrame, colName, oldVal, newVal):
requires: pandas dataFrame, colName must be the columns name (e.g. df.colName), not a string
effects: returns a copy of the column. Does NOT mutate data.
Thus must be assigned to cha... | StarcoderdataPython |
3232545 | # -*- coding: utf-8 -*-
from datetime import datetime
from fabric.api import *
# 登录用户和主机名:
env.user = 'root'
env.hosts = ['192.168.127.12'] # 如果有多个主机,fabric会自动依次部署
def pack():
' 定义一个pack任务 '
# 打一个tar包:
tar_files = ['*.py', 'static/*', 'templates/*']
#local('rm -f example.tar.gz')
local('tar -czvf... | StarcoderdataPython |
3356987 | <gh_stars>0
import pygame
from os import path
import spawns
import constants as con
class Overheat:
def __init__(self):
self.__overheat = 0
self.__hot = False
def get_Overheat(self):
return self.__overheat
def reset_Overheat(self):
self.__overheat = 0
def cool... | StarcoderdataPython |
1701689 | def squaresum(n):
sum=0
for i in range(1, n+1):
sum = sum +(i*i)
return sum
n=int(input("enter the number : "))
print(squaresum(n))
| StarcoderdataPython |
1704512 | <filename>data-models/python-datawrangling/src/gda/datawrangling/test_parse_xml.py
# -*- coding: utf-8 -*-
"""
解析XML文件.
"""
import unittest
from xml.etree import ElementTree as ET
import pprint
class TestParseXML(unittest.TestCase):
def test_read(self):
tree = ET.parse("../../../data/data-text.xml")
... | StarcoderdataPython |
3241564 | from __future__ import absolute_import, division, print_function, unicode_literals
from baseline import Baseline
multiple = Baseline("""
WHITESPACE
""")
| StarcoderdataPython |
3297567 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 6 11:08:12 2020
@author: nmei
This is a template script for training a convolutional neural network to perform
a categorical task, discriminating living vs nonliving images in a fMRI experiment
The convolutional layers are from pre-trained networks ... | StarcoderdataPython |
1755054 | # Time: O(n * k)
# Space: O(k)
# Given two integers n and k, find how many different arrays consist of numbers
# from 1 to n such that there are exactly k inverse pairs.
#
# We define an inverse pair as following: For ith and jth element in the array,
# if i < j and a[i] > a[j] then it's an inverse pair; Otherwis... | StarcoderdataPython |
44418 | <reponame>boonepeter/cat-laser<gh_stars>0
# Raspberry Pi Cat Laser Driver
# This code controls the laser pointer servos to target the laser at different
# locations. Make sure to modify the MQTT_SERVER variable below so that it points
# to the name or IP address of the host computer for the cloud server VM (i.e. the
#... | StarcoderdataPython |
1630512 | import tensorflow as tf
'''
Tensor Operations: initializations, constants, variables, shapes, reshaping
'''
######## Tensors: Varying shapes ###################
a = tf.constant(1.2, dtype=tf.float32, name='a')
b = tf.constant(3.4, dtype=tf.float32, name='b')
c = tf.constant([1.5, 44.3, 55.4], dtype=tf.float32, name=... | StarcoderdataPython |
1645729 | <reponame>maxpowel/flask_bundle<gh_stars>0
from .bundle import FlaskBundle, ApiBlueprints
| StarcoderdataPython |
3299840 | <gh_stars>1-10
from collections import defaultdict as dd
G = dd(lambda :dd(lambda :0))
vis = dd(lambda :False)
def load_data():
N,M,C1,C2 = [int(x) for x in input().split()]
weight = [int(x) for x in input().split()]
for i in range(M):
c1, c2, L = [int(x) for x in input().split()]
G[c1][c2... | StarcoderdataPython |
3339509 | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-05-08 09:13
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('subjects... | StarcoderdataPython |
120442 | """
0011. Container With Most Water
Medium
Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of the line i is at (i, ai) and (i, 0). Find two lines, which, together with the x-axis forms a container, such that the... | StarcoderdataPython |
1782300 | <reponame>GHDDI-AILab/Targeting2019-nCoV<filename>util/test1.py
import numpy as numpy
import pandas as pd
print(np.sum([1,2,3,4,5])) | StarcoderdataPython |
67449 | #! usr/bin/python3
# -*- coding: utf-8 -*-
#
# Flicket - copyright <NAME>: <EMAIL>
from datetime import datetime
from flask import redirect
from flask import request
from flask import make_response
from flask import render_template
from flask import Response
from flask import url_for
from flask_babel import gettext
f... | StarcoderdataPython |
74068 | <filename>brax/tools/mujoco_converter.py
# Copyright 2021 The Brax 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 requi... | StarcoderdataPython |
90025 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#
# Library to extract Exif information from digital camera image files.
# https://github.com/ianare/exif-py
#
#
# Copyright (c) 2002-2007 <NAME>
# Copyright (c) 2007-2014 <NAME> and contributors
# Copyright (c) 2020- Cyb3r Jak3
#
# See LICENSE.txt file for licensing ... | StarcoderdataPython |
122553 | <gh_stars>1-10
from queue import PriorityQueue as PQueue
N = int(input())
C = int(input())
V = int(input())
S = list(map(lambda x: int(x)-1, input().split()))
T = list(map(lambda x: int(x)-1, input().split()))
Y = list(map(int, input().split()))
M = list(map(int, input().split()))
E = [[] for _ in range(N)]
for f, t, c... | StarcoderdataPython |
1657839 | <gh_stars>10-100
#!/usr/bin/env python3
from __future__ import print_function
# dsl2.py
import sys
import importlib
def get_args(dsl_args):
"""return args, kwargs"""
args = []
kwargs = {}
for dsl_arg in dsl_args:
if '=' in dsl_arg:
k, v = dsl_arg.split('=', 1)
kwargs[k... | StarcoderdataPython |
120359 | from django.contrib.auth import get_user_model
import graphene
from graphene import relay, ObjectType, AbstractType
from graphene_django import DjangoObjectType
from graphene_django.filter import DjangoFilterConnectionField
from graphene.types.datetime import DateTime
from conference.event.models import Conference, S... | StarcoderdataPython |
3264880 | #利用加噪声的图像进行降噪自编码器的测试
import torch
import torchvision
from torch import nn
from torch.autograd import Variable
from torch.utils.data import DataLoader
from torchvision import transforms
from torchvision.utils import save_image
from torchvision.datasets import MNIST
import glob
import numpy as np
from PIL import Image
... | StarcoderdataPython |
7107 | import enum
class Status(enum.Enum):
"""Status enumeration."""
ACTIVE = 'ACTIVE'
DISABLED = 'DISABLED'
ARCHIVED = 'ARCHIVED'
DELETED = 'DELETED'
class ProgressStatus(enum.Enum):
"""Enumeration indicates the different
stages of the progress made on an engagement,
job or ... | StarcoderdataPython |
1742807 | passports = []
def parseFields(passport):
parsedPassport = {}
fields = passport[:-1].split(" ")
for field in fields:
pair = field.split(":", 1)
parsedPassport[pair[0]] = pair[1]
return parsedPassport
def validatePassportFields(passport):
return bool(validatePassportFieldBirthYear(... | StarcoderdataPython |
1733170 | <reponame>hyjiacan/restful-dj
from types import MethodType
class RouteMeta:
"""
路由元数据
"""
def __init__(self,
handler: MethodType,
func_args,
route_id=None,
module=None,
name=None,
kwarg... | StarcoderdataPython |
113609 | <filename>examples/blink.py
import time
import Rpi.GPIO as GPIO
from piwho import recognition
def blink(pin):
GPIO.output(pin,GPIO.HIGH)
time.sleep(1)
GPIO.output(pin,GPIO.LOW)
time.sleep(1)
def identify():
recog = recognition.SpeakerRecognizer('./recordings/')
friends = ['Abhishek', 'Ankit'... | StarcoderdataPython |
159109 | <filename>test.py
import ADS7830
ads = ADS7830.ADS7830(1, 0x48)
for i in range(0,8):
print "{0}: {1}".format(i, ads.Read(i))
| StarcoderdataPython |
1609704 | <gh_stars>0
# -*- coding: utf-8 -*-
"""This file contains SkyDrive log file parser in plaso."""
from __future__ import unicode_literals
import pyparsing
from dfdatetime import time_elements as dfdatetime_time_elements
from plaso.containers import events
from plaso.containers import time_events
from plaso.lib import... | StarcoderdataPython |
3253895 | <gh_stars>0
"""
this file contains the definition of the qui window for the property
settings for ducks
"""
from PyQt5 import QtCore, QtWidgets, QtGui, uic
from Utils import save_eucl_file
from Dialog.Colour import ColourDialog
from Constants import *
#fill QT interface with the correct values
def fill_fields(dialog... | StarcoderdataPython |
84087 | <reponame>desty2k/QDarkStyleSheet
# colorsystem.py is the full list of colors that can be used to easily create themes.
class Gray:
B0 = '#000000'
B10 = '#19232D'
B20 = '#293544'
B30 = '#37414F'
B40 = '#455364'
B50 = '#54687A'
B60 = '#60798B'
B70 = '#788D9C'
B80 = '#9DA9B5'
B90 ... | StarcoderdataPython |
3343467 | import json
import math
class Pose:
HOLD = "HOLD"
TURN_RIGHT = "TURN_RIGHT"
TURN_LEFT = "TURN_LEFT"
THROTTLE_UP = "THROTTLE_UP"
THROTTLE_DOWN = "THROTTLE_DOWN"
FORWARD = "FORWARD"
class Point:
def __init__(self, x, y, acc, index, desc):
self.x = x
self.y = y
self.... | StarcoderdataPython |
3344776 | from flask import abort, Blueprint, render_template
from jinja2.exceptions import TemplateNotFound
bp = Blueprint('pages', __name__, template_folder='templates')
pages_list = [
{
"page": "dichotomy-method",
"headline": "Dichotomy (Bisection method)",
"text": "Dichotomy (or Bisection) metho... | StarcoderdataPython |
1646868 | <filename>telegram_bot/sticker_set_downloader.py
''''''
import os
from PIL import Image
from telegram import Bot
from global_config.protected_config import _telegrambot_token
from global_config.environment_config import _base_dir, _temp_dir
from telegram_bot.func_helper import random_string, zip_dir
class StickerSe... | StarcoderdataPython |
146368 |
"""
General Approach for Parameter Tuning
We will use an approach similar to that of GBM here. The various steps to be performed are:
1.Choose a relatively high learning rate. Generally a learning rate of 0.1 works but somewhere
between 0.05 to 0.3 should work for different problems. Determine the optimum number of... | StarcoderdataPython |
3377568 | import os
import yaml
import argparse
import numpy as np
import torch
from discor.env import make_env
from discor.algorithm import EvalAlgorithm
def test(env, algo, render):
state = env.reset()
episode_return = 0.0
success = 0.0
done = False
while (not done):
action = algo.exploit(state)... | StarcoderdataPython |
133437 | import pytest
# Code that uses this is commented-out below.
# from ..types import TrackingItem
pytestmark = [pytest.mark.setone, pytest.mark.working, pytest.mark.schema]
@pytest.fixture
def tracking_item():
return {"tracking_type": "other", "other_tracking": {"extra_field": "extra_value"}}
def test_insert_an... | StarcoderdataPython |
194770 | <reponame>janaobsteter/Genotype_CODES<filename>CheckMergedFiles.py
import os
import GenFiles
import pandas as pd
from collections import defaultdict
import subprocess
import re
from itertools import chain
workdir = "/home/jana/Genotipi/Genotipi_DATA/Rjava_TEMP/"
os.chdir("/home/jana/Genotipi/Genotipi_DATA/Rjava_TEMP/"... | StarcoderdataPython |
1724074 | import re
import csv
import ipaddress
__version__ = 1.0
# Each route will have the following values
class Route_Template(object):
def __init__(self):
self.route = {}
self.protocol = []
self.metric = []
self.next_hop = []
self.age = []
self.interface = []
def __r... | StarcoderdataPython |
1750615 | """
Module for miscellaneous functions.
"""
import random
from collections import defaultdict
from string import letters
from lxml.builder import ElementMaker
from lxml import etree
def host_and_page(url):
""" Splits a `url` into the hostname and the rest of the url. """
url = url.split('//')[1]
parts = u... | StarcoderdataPython |
1633265 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from collections import defaultdict
from logging import StreamHandler, DEBUG, getLogger as realGetLogger, Formatter
try:
from colorama import Fore, Back, init, Style
class ColourStreamHandler(StreamHandler):
""" A colorized output SteamHandler """
ansi_c... | StarcoderdataPython |
84009 | # -*- coding: utf-8 -*-
from __future__ import division, print_function
__all__ = ["simplexy"]
import numpy as np
from ._simplexy import simplexy as run_simplexy
_dtype = np.dtype([("x", np.float32), ("y", np.float32),
("flux", np.float32), ("bkg", np.float32)])
def simplexy(img, **kwargs):
... | StarcoderdataPython |
1790591 | <gh_stars>100-1000
import unittest
import pandas as pd
from pandas.testing import assert_frame_equal
from styleframe import StyleFrame, Styler, Container, Series, utils
class SeriesTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.pandas_series = pd.Series((None, 1))
cls.sf_seri... | StarcoderdataPython |
116156 | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# Copyright 2016 <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/licenses/LICENSE-2.0
#
# Unless r... | StarcoderdataPython |
1670426 | arr=list(map(int,input().split()))
low=0
mid=0
high=len(arr)-1
while(mid<=high):
if (arr[mid]==0):
arr[low],arr[mid]=arr[mid],arr[low]
low+=1
mid+=1
elif (arr[mid]==1):
mid+=1
else:
arr[mid],arr[high]=arr[high],arr[mid]
high-=1
print(arr)
| StarcoderdataPython |
4825439 | <filename>server/blogsley/image/__init__.py<gh_stars>1-10
from datetime import datetime
from slugify import slugify
from blogsley.config import db
class Image(db.Model):
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(255))
filename = db.Column(db.String(100))
src = db.Column(d... | StarcoderdataPython |
3241699 | <reponame>TheShellLand/python
#!/usr/bin/env python
# -*- coding: utf8 -*-
import os
import requests
url = 'https://fpdl.vimeocdn.com/vimeo-prod-skyfire-std-us/01/4575/4/122877896/348642579.mp4?token' \
'=56957066_0x839f46c2194807f9e9fa0b07eaead9df817d2252'
local_dir = '/home/eric/Downloads'
def download_f... | StarcoderdataPython |
1682632 | <gh_stars>0
from django.shortcuts import render, get_object_or_404, redirect
from django.views.generic import TemplateView
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from .models import Publicaciones, Tematicas
from .forms import BibliotecaForms
# Crea... | StarcoderdataPython |
3370462 | <filename>compiler-rt/test/sanitizer_common/ios_commands/iossim_prepare.py
#!/usr/bin/python
import json
print(json.dumps({"env": {}}))
| StarcoderdataPython |
1722453 | <filename>commands/serverstats.py
import discord
from discord.ext import commands
from mojang import MojangAPI
from utils.utils import hypixel, utils
from utils.embeds import Embeds
import random
import datetime
import time as thyme
import mystbin
import re
mystbin_client = mystbin.MystbinClient()
class ServerStats(c... | StarcoderdataPython |
1763850 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('events', '0001_initial'),
migrations.swappable_dependency(settings.... | StarcoderdataPython |
11116 | # Write a recursive function to count the number of nodes in a Tree. (first do your self then see code)
def count_nodes(self):
count = 1
left_count = 0
right_count = 0
if self.left:
left_count = self.left.count_nodes()
if self.right:
right_count = self.right.count_nodes()
return count + left_count + rig... | StarcoderdataPython |
3238852 | <reponame>HSZemi/sensorid-collect<gh_stars>0
#! /usr/bin/env python3
import sys
import argparse
import json
import os
import csv
from features import *
# create a mapping of all known sensor classes to all known sensor names
def classes(directory):
sensors = {}
sensors['TYPE_ACCELEROMETER'] = []
sensors['TYPE_ACC... | StarcoderdataPython |
84427 | <gh_stars>1-10
def is_prime(num):
if num <= 1:
return False
d = 2
while d * d <= num and num % d != 0:
d += 1
return d * d > num | StarcoderdataPython |
3393415 | # uncompyle6 version 3.6.2
# Python bytecode 2.7
# Decompiled from: Python 2.7.17 (default, Oct 23 2019, 08:25:46)
# [GCC 4.2.1 Compatible Android (5220042 based on r346389c) Clang 8.0.7 (https://
# Embedded file name: <r>
try:
import os, sys, time
from multiprocessing.pool import ThreadPool
import mechani... | StarcoderdataPython |
1602171 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
def hackertarget_api(choice, target):
request_urls = [
"https://api.hackertarget.com/mtr/?q=",
"https://api.hackertarget.com/nping/?q=",
"https://api.hackertarget.com/dnslookup/?q=",
"https://api.hackertarget.com/reverse... | StarcoderdataPython |
1752848 | # python3
import sys
def sortcharecters(text):
count = [0] * 255
order = [None] * len(text)
for c in text:
count[ord(c)] += 1
for i in range(255):
count[i] += count[i - 1]
for i in range(len(text)-1,-1,-1):
count[ord(text[i])] -= 1
order[count[ord(text[i])]] = i
return order
def singlecl... | StarcoderdataPython |
95830 | <filename>Data Structure/Matrix/Addition of Two Matrices/SolutionByRiya.py
rows= int(input("Enter the number of rows: "))
cols= int(input("Enter the number of columns: "))
matrixA=[]
print("Enter the entries rowwise for matrix A: ")
for i in range(rows):
a=[]
for j in range(cols):
a.append(int(input())... | StarcoderdataPython |
1716388 | from libcst import BaseExpression, Call
from libcst import matchers as m
from django_codemod.constants import DJANGO_2_0, DJANGO_3_0, DJANGO_4_0
from django_codemod.visitors.base import (
BaseDjCodemodTransformer,
BaseFuncRenameTransformer,
)
class HttpUrlQuoteTransformer(BaseFuncRenameTransformer):
"""R... | StarcoderdataPython |
1642324 | <filename>src/unicon/plugins/tests/test_plugin_iosxe_quad.py
"""
Unittests for IOSXE/Quad plugin
"""
import unittest
from unittest.mock import patch
from pyats.topology import loader
import unicon
from unicon import Connection
from unicon.plugins.tests.mock.mock_device_iosxe import MockDeviceTcpWrapperIOSXE
@patc... | StarcoderdataPython |
105244 | <filename>scripts/viz_example.py
"""
Visualize which images have low and high confidence scores in training set.
"""
import os
import torch
import numpy as np
from tqdm import tqdm
from copy import deepcopy
from dotmap import DotMap
from src.utils import utils
from torchvision import transforms
from torch.utils.data im... | StarcoderdataPython |
54763 | <reponame>comps/pexen
import sys
from collections import namedtuple
import threading
import queue
import multiprocessing
import multiprocessing.queues # for picklability check
import pickle
from . import common, meta
class PoolError(common.SchedulerError):
"""Raised by ProcessWorkerPool or ThreadWorkerPool."""
... | StarcoderdataPython |
1619218 | import binascii
import hashlib
import json
from logging import getLogger
from time import time
import base58
from bip32utils import BIP32Key
from bitcoin.wallet import P2PKHBitcoinAddress
from coincurve import PrivateKey, PublicKey
from mnemonic import Mnemonic
CONFIG = None
def get_config():
return CONFIG
cl... | StarcoderdataPython |
1767654 | from flask import Blueprint
admin = Blueprint('admin', __name__, template_folder='templates')
from app.admin import routes | StarcoderdataPython |
3342651 | <reponame>ChineseSuperman/zvt
# -*- coding: utf-8 -*-
from typing import List, Union
import pandas as pd
from zvdata.factor import ScoreFactor
from zvdata.structs import IntervalLevel
from zvt.domain import FinanceFactor
class FinanceGrowthFactor(ScoreFactor):
def __init__(self,
entity_ids: Li... | StarcoderdataPython |
1644529 | import typing
from abaqusConstants import *
from .BeadTask import BeadTask
from .ShapeTask import ShapeTask
from .SizingTask import SizingTask
from .TopologyTask import TopologyTask
from ..Model.ModelBase import ModelBase
class OptimizationTaskModel(ModelBase):
"""Abaqus creates a Model object named `Model-1` wh... | StarcoderdataPython |
4801130 | # vi: set shiftwidth=4 tabstop=4 expandtab:
import datetime
import collections
import itertools
def get_adapters_from_file(file_path="../../resources/year2020_day10_input.txt"):
with open(file_path) as f:
return [int(l) for l in f]
def get_jolt_differences(adapters):
adapters = [0] + sorted(adapters... | StarcoderdataPython |
3287463 | import sys
import requests
import time
def update_record(username, password):
url = 'http://' + username + ':' + password + '@dyn.dns.he.net/nic/update?hostname=' + username
try:
r = requests.get(url)
print(r.status_code)
except requests.RequestException as e:
print(e)
if __name__... | StarcoderdataPython |
8119 | import numpy as np
import torch
from torch.nn import functional as F
from rltoolkit.acm.off_policy import AcMOffPolicy
from rltoolkit.algorithms import DDPG
from rltoolkit.algorithms.ddpg.models import Actor, Critic
class DDPG_AcM(AcMOffPolicy, DDPG):
def __init__(
self, unbiased_update: bool = False, cu... | StarcoderdataPython |
3256503 | #!python
from linkedlist import LinkedList
# Implement LinkedStack below, then change the assignment at the bottom
# to use this Stack implementation to verify it passes all tests
class LinkedStack(object):
def __init__(self, iterable=None):
"""Initialize this stack and push the given items, if any."""
... | StarcoderdataPython |
4818592 | # -*- coding: utf-8 -*-
import os, sys
from django.conf import settings
from django.core.management import call_command
DIRNAME = os.path.dirname(__file__)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(DIRNAME, 'database.db'),
}
}
settings.configure(D... | StarcoderdataPython |
35474 | <reponame>joepatmckenna/normal_forms
from normal_forms import normal_form
import sympy
# Murdock, Normal Forms and Unfoldings of Local Dynamical Systems, Example 4.5.24
def f(x, y, z):
f1 = 6 * x + x**2 + x * y + x * z + y**2 + y * z + z**2
f2 = 2 * y + x**2 + x * y + x * z + y**2 + y * z + z**2
f3 = 3 * ... | StarcoderdataPython |
1687068 | <filename>python/npcomp/tracing/emitters.py
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
import numpy as np
from collections import namedtuple
from enum import En... | StarcoderdataPython |
3392062 | # Builtins
import unittest
import time
# Submodule imports
from harvest.trader import *
from harvest.algo import BaseAlgo
from harvest.api.dummy import DummyStreamer
from harvest.api.paper import PaperBroker
from harvest.api.yahoo import YahooStreamer
# from harvest.api.robinhood import Robinhood
import datetime as ... | StarcoderdataPython |
3339300 | # add all the question types to QuestionChoices before anything else
from .. import add_type
from . import simple # store value as returned
from . import choice # multiple choice, do checks
from . import range_or_number # range of numbers
from . import timeperiod # time periods
from . import... | StarcoderdataPython |
86649 | from environs import Env
import re
import socket
# Loads environmental variables from .env
env = Env()
env.read_env()
# remove ./ from beginning of neo4j variables to avoid issues with docker
neo4j_import_dir = re.sub(
"^./", "", env("NEO4J_IMPORT_DIR", "./demo/neo4j/0.0.1/import")
)
neo4j_log_dir = re.sub("^./",... | StarcoderdataPython |
1739887 | """Dump Bathak Data"""
import json
from urduhack.utils.io import pickle_dump
new_training_data = []
data = "/Users/ikramali/Projects/Python/Xplore/data/125-172908_bathak_51986_posts-raw.pkl"
data_dump = f"86686_arynews_posts-raw.pkl"
json_data = "/Users/ikram/WorkPlace/projects/posts.json"
# with open(data, 'rb') a... | StarcoderdataPython |
3378151 | <filename>projectname/exampleapp/models/__init__.py
from .example import ExampleModel
| StarcoderdataPython |
3284402 | #x0 y0 x1 y1
paths = \
[dict(steering_angle = 0, target_angle = 0, coords = \
[[-123, 100, 123, 100],
[-123, 335, 123, 335],
[-123, 570, 123, 570],
[-123, 805, 123, 805],
[-123, 1040, 123, 1040],
[-123, 1275, 123, 1275],
[-123, 1510, 123, 1510],
[-123, 1745, 123, 1745],
[-123, 1980, 123, 1980]]),
dict(steering_angle =... | StarcoderdataPython |
44580 | import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from PySide2.QtWidgets import QVBoxLayout, QWidget
from traitlets import HasTraits, Instance, Bool, directional_link
from regexport.model import AppState
from regexport.views.utils import HasWidget
matplotlib.use('Qt5Agg')
from matplotlib.backends... | StarcoderdataPython |
3254834 | <filename>third_party/webrtc/src/chromium/src/third_party/webdriver/pylib/test/selenium/common/utils.py<gh_stars>1000+
import os
import socket
import time
import urllib
import subprocess
import signal
SERVER_ADDR = "localhost"
DEFAULT_PORT = 4444
SERVER_PATH = "build/java/server/src/org/openqa/grid/selenium/selenium... | StarcoderdataPython |
3294310 | <reponame>Linekio/python-fedex
"""
Location Service Module
This package contains the shipping methods defined by Fedex's
LocationService WSDL file. Each is encapsulated in a class for
easy access. For more details on each, refer to the respective class's
documentation.
"""
from ..base_service import FedexBaseServic... | StarcoderdataPython |
3351050 | from eval.eval import MedlineEvaluator
from util.arguments import settings
if __name__ == '__main__':
medline_path_new = settings['medline_path']
medline_path_old = settings['medline_path_old']
unannotated_path = '/home/midas/data/eval/old-unannotated-major.json'
eval_candidate_path = '/home/midas/dat... | StarcoderdataPython |
78003 | # pylint: disable=R0902,E1101,W0201,too-few-public-methods,W0613
import datetime
from sqlalchemy_utils import UUIDType
from sqlalchemy import (
Column,
DateTime,
Integer,
Sequence,
)
from codebase.utils.sqlalchemy import ORMBase
class User(ORMBase):
"""
用户由 AuthN 服务创建并鉴别,本处存储仅是为了关系映射方便
... | StarcoderdataPython |
3470 | import os
import itertools
import importlib
import numpy as np
import random
STRATEGY_FOLDER = "exampleStrats"
RESULTS_FILE = "results.txt"
pointsArray = [[1,5],[0,3]] # The i-j-th element of this array is how many points you receive if you do play i, and your opponent does play j.
moveLabels = ["D","C"]
#... | StarcoderdataPython |
1662890 | <filename>genericDetector/__init__.py
from .genericDetector import GenericDetector | StarcoderdataPython |
1676759 | from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2_provider.provider import OAuth2Provider
class OdnoklassnikiAccount(ProviderAccount):
def get_profile_url(self):
return "https://ok.ru/profile/" + self.account.extra_data["uid"]
def get_avatar_... | StarcoderdataPython |
46986 | #!/usr/bin/env python
"""Create benchmark for k nearest neighbor on unit sphere in R^k."""
# Scroll down to line 90 to "Adjust this" to add your experiment
import random
import numpy as np
import os.path
import logging
import sys
import Queue as queue
import h5py
import time
logging.basicConfig(format='%(asctime)s %... | StarcoderdataPython |
3271270 | <filename>scripts/calculate_rating.py
'''
Implementation of following rating algorithm
https://codeforces.com/blog/entry/20762
'''
import itertools
import json
import pymysql
from pymysql.cursors import DictCursor
USER_QUERY = 'SELECT user_id, username from users'
# TODO technically if a user has the same start ti... | StarcoderdataPython |
1679543 | from credo.banks_and_currencies import BanksCurrencies
from . import PUBLIC_KEY, SECRET_KEY
class TestBankCurrencies:
instance = BanksCurrencies(public_key=PUBLIC_KEY, secret_key=SECRET_KEY)
# testing for the data types because these endpoints don't return a status in the json response on success
def tes... | StarcoderdataPython |
141924 | import sublime
import sublime_plugin
import re
def panel_window(view):
for w in sublime.windows():
for panel in w.panels():
v = w.find_output_panel(panel.replace("output.", ""))
if v and v.id() == view.id():
return w
return None
def panel_is_visible(view):
... | StarcoderdataPython |
1793770 | # -*- coding: utf-8 -*-
import argparse
import ijson
import multiprocessing
import json
from os import linesep
from bisect import bisect_left
STOP_TOKEN = "<PASSWORD>!!!"
def file_writer(dest_filename, some_queue, some_stop_token):
"""Write JSON strings to a JSON list from a multiprocessing
queue to a file u... | StarcoderdataPython |
3288563 | <gh_stars>0
import requests
from bs4 import BeautifulSoup
from pymongo import MongoClient
client = MongoClient('localhost', 27017)
db = client.team9TestOne
# 여기 테스트
# 발매일 코드 데이터베이스에 저장하는 코드 따로만들기
movie_list = list(db.movies.find({}, {'_id': False}))
big_list = []
for movie in movie_list:
title = movie['title']
... | StarcoderdataPython |
1642454 | <reponame>bmorledge-hampton19/mutperiod
# This script takes data from the Kucab et al. mutation compendium paper and converts it to
# a trinucleotide context bed file.
import os, subprocess
from benbiohelpers.TkWrappers.TkinterDialog import TkinterDialog, Selections
from benbiohelpers.DNA_SequenceHandling import rever... | StarcoderdataPython |
3373042 | <reponame>malithbc/Mole-AR-Stage1
# Generated by Django 3.2.5 on 2021-07-28 06:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('playground', '0012_image_user_id'),
]
operations = [
migrations.AddField(
model_name='image',
... | StarcoderdataPython |
1615294 | <gh_stars>0
import hashlib
from shippo.error import APIError
BLACKLISTED_DIGESTS = {
}
def verify(hostname, certificate):
"""Verifies a PEM encoded certficate against a blacklist of known revoked
fingerprints.
returns True on success, raises RuntimeError on failure.
"""
if hostname not in BLAC... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.