id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
8040844 |
# This code is based on: https://github.com/nutonomy/second.pytorch.git
#
# MIT License
# Copyright (c) 2018
# 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 ... | StarcoderdataPython |
6466441 | <gh_stars>0
from app.Model.Model import Model
class Session(Model):
def __init__(self, json=None, pk=None):
self.id = None
self.sessionKey = None
self.orgId = None
super().__init__(json, pk)
@staticmethod
def table_name():
return 'sessions'
@staticmethod
d... | StarcoderdataPython |
23270 | <reponame>Kortemme-Lab/benchmark_set_construct<filename>benchmark_constructor/file_normalizers/ContactSelectFileNormalizer.py
import os
from .FileNormalizer import FileNormalizer
class ContactSelectFileNormalizer(FileNormalizer):
'''ContactSelectFileNormalizer creates a pymol script that selects
residues which... | StarcoderdataPython |
1819555 | <reponame>freedomtan/caffe2
# Copyright (c) 2016-present, Facebook, 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... | StarcoderdataPython |
11219863 | <reponame>Ftan91/IG_API_Experiment<gh_stars>0
from elasticsearch.client import IndicesClient
from elasticsearch import Elasticsearch
from pprint import pprint
from configurations import configurations
import requests
import facebook
import os
# make sure you have the 3 variables below set as env variable
# set within... | StarcoderdataPython |
9789052 | <reponame>sanjitjain2/BlackBoard-Image-Mosaicing
import numpy as np
import cv2
import sys
import click
def calcHomography(pts1,pts2):
# Calculate Homography using SVD
A = np.zeros((8,9),dtype = 'float')
for i in range(0,8,2):
A[i][0], A[i][1], A[i][2] = pts1[i/2][0], pts1[i/2][1], 1
A[i][6], A[i][7], A[i][8... | StarcoderdataPython |
4915929 | # ---------- requirements ----------
from download import download
import pandas as pd
import os
# Define global path target on which to join our files.
# Ends up in the data folder
path_target = os.path.join(
os.path.dirname(
os.path.realpath(__file__)),
"..", "dat... | StarcoderdataPython |
353802 | from django.dispatch import Signal
hijack_started = Signal()
hijack_ended = Signal()
| StarcoderdataPython |
283958 | <reponame>minyiky/xSACdb
# Generated by Django 2.2.7 on 2019-11-06 17:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('xsd_kit', '0002_auto_20141109_1711'),
]
operations = [
migrations.AlterField(
model_name='kit',
... | StarcoderdataPython |
12831948 | <gh_stars>1-10
import abc
import asyncio
import fnmatch
from abc import ABC
from collections import defaultdict
from dataclasses import dataclass
from typing import Dict, List, Tuple
@dataclass
class Notification:
topic: str
subject_id: str
data: dict
class Handler(ABC):
@abc.abstractmethod
asyn... | StarcoderdataPython |
341510 | <reponame>prithagupta/ml-sca
from .baseline import RandomClassifier, MajorityVoting, PriorClassifier
from .csv_reader import CSVReader
from .synthetic_dataset_reader import SyntheticDatasetGenerator
from .real_dataset_generator import RealDatasetGenerator
from .classification_test import optimize_search_cv
from .classi... | StarcoderdataPython |
4958365 | # -*- coding: utf-8 -*-
import os
import cv2
import numpy as np
from utils.util import get_arguments
from utils.palette import get_palette
from PIL import Image as PILImage
import importlib
args = get_arguments()
config = importlib.import_module('config')
cfg = getattr(config, 'cfg')
# paddle垃圾回收策略FLAG,ACE2P模型较大,当显存不... | StarcoderdataPython |
3386937 | import math
import random
import unittest
from cog_abm.ML.core import (NominalAttribute, NumericAttribute, Sample,
load_samples_arff, split_data, split_data_cv)
animals = ["dog", "cat", "lion", "duck", "python:)"]
class TestAttributes(unittest.TestCase):
def setUp(self):
self.symbols = animals
... | StarcoderdataPython |
6503273 | # -----------------------------------------------------------------------------
#
# Copyright 2013-2019 lispers.net - <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 Licen... | StarcoderdataPython |
383392 | <filename>demo/networks/Attention.py
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import math
import random
from dataset import START, PAD
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
class CNN(nn.Module):
def __init__(self, nc, leakyRelu=False):... | StarcoderdataPython |
5047905 | <reponame>lmyybh/pytorch-networks
import torch
import torch.nn as nn
class ProWGANDLoss(nn.Module):
def __init__(self):
super(ProWGANDLoss, self).__init__()
def gradient_penalty(self, D, real_img, fake_img, step, alpha, LAMDA=10):
batch_size = real_img.size(0)
device = real_img.dev... | StarcoderdataPython |
12827197 | <gh_stars>1-10
from django.db import models
from address.models import AddressField
class Entity(models.Model):
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
class Meta:
abstract = True
def update_attrs(self, **attrs):
try:
... | StarcoderdataPython |
260649 | <filename>music21/tree/fromStream.py
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Name: timespans/fromStream.py
# Purpose: Tools for creating timespans from Streams
#
# Authors: <NAME>
# <NAME>
#
# Copyright: Copyright © 201... | StarcoderdataPython |
3204200 | BBBB BBBBBBBBBBBBBB BBBB
XXXXX XXXXXXXXBBB BBBBBBBBX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXX
XXXX XXXXXXXXXXXXXXXXXXX
XXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX gettext('Search') X XXXXXXXXXXX XXXXXXXX XXXXXXXXX
XXXXXX
BB BBBBBBBBBBBBBBBBBBBB
BB BBBBBBBBBBBBBBBBBBBBBBBBBBB BB B
XXXXXX XXXXXXXXXXXXX... | StarcoderdataPython |
11227489 | <filename>setup/audioparser.py
"""
This module contains helper functions to:
- generate the list of file paths of the audio samples
- extract audio features for each audio sample
- create a dataframe containing the extracted features
"""
import os
from multiprocessing import Pool
# import time ## uncomment to measure... | StarcoderdataPython |
3306241 | import os
import ctypes
import copy
import struct
import windows
from windows import winproxy
from windows import utils
import windows.generated_def as gdef
from windows.winobject import process
from windows.winobject import network
from windows.winobject import registry
from windows.winobject import exception
from ... | StarcoderdataPython |
3508986 | default_app_config = 'tenant_workspace.apps.TenantWorkspaceConfig'
| StarcoderdataPython |
8029450 | <gh_stars>0
from rest_framework import serializers
from restapi.models import book
from django.contrib.postgres.fields import ArrayField
class bookSerializer(serializers.Serializer):
id=serializers.IntegerField(read_only=True)
name=serializers.CharField(max_length=100)
isbn=serializers.CharField(max_length... | StarcoderdataPython |
13861 | """
@Author : xiaotao
@Email : <EMAIL>
@Lost modifid : 2020/4/24 10:02
@Filename : __init__.py.py
@Description :
@Software : PyCharm
""" | StarcoderdataPython |
6413530 | <gh_stars>1-10
import argparse
import logging
import gpxpy as gpxpy
from tqdm import tqdm
from coordinates_label_photos.coordinates import exif_to_coordinates
from coordinates_label_photos.photos import list_photo_filenames, get_photo_exif
def main():
logging.basicConfig(level=logging.INFO)
parser = argparse... | StarcoderdataPython |
11206662 | import cloudpickle
import sys
from typing import Dict
def _execute_fun(path_to_serialized_fun: str) -> None:
with open(path_to_serialized_fun, "rb") as fd:
func: Dict = cloudpickle.load(fd)
func['func'](*func['args'])
if __name__ == "__main__":
_execute_fun(sys.argv[1])
| StarcoderdataPython |
4928979 | from decimal import Decimal
from serde import serde
from serde.json import from_json, to_json
@serde
class Foo:
v: Decimal
def main():
foo = Foo(Decimal(0.1))
print(f"Into Json: {to_json(foo)}")
s = '{"v": "0.1000000000000000055511151231257827021181583404541015625"}'
print(f"From Json: {from_j... | StarcoderdataPython |
11317954 | # Stack
from typing import TypeVar, Generic, List
T = TypeVar('T')
class Stack(Generic[T]):
def __init__(self) -> None:
self.items: List[T] = []
def push(self, item: T) -> None:
self.items.append(item)
def pop(self) -> T:
return self.items.pop()
def peek(self) -> T:
... | StarcoderdataPython |
172434 | # Generated by Django 3.1.12 on 2021-06-28 08:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('business_register', '0123_auto_20210622_1059'),
]
operations = [
migrations.AlterField(
model_name='vehicle',
name=... | StarcoderdataPython |
3572071 | from selenium.webdriver.common.by import By
class MainPageLocators(object):
GO_BUTTON = (By.ID, 'submit')
class SearchResultsPageLocators(object):
pass
| StarcoderdataPython |
1737428 | <reponame>suhassatish/h2o-dev<gh_stars>0
import sys
sys.path.insert(1, "../../../")
import h2o
from h2o.expr import Expr
def expr_slicing(ip,port):
# Connect to h2o
h2o.init(ip,port)
iris = h2o.import_frame(path=h2o.locate("smalldata/iris/iris_wheader.csv"))
iris.show()
##########################... | StarcoderdataPython |
11207749 | """Mass Equality Set Graph (MESGraph)."""
from SBMLLint.common import constants as cn
from SBMLLint.common.molecule import Molecule, MoleculeStoichiometry
from SBMLLint.common.reaction import Reaction
from SBMLLint.games.som import SOM
from SBMLLint.common.simple_sbml import SimpleSBML
import collections
import itert... | StarcoderdataPython |
250173 | import copy
import heapq
from datetime import datetime, timedelta, time
import itertools
from dateutil.rrule import rrulestr
from django.utils import timezone
# from .models import RepeatingEvent, Event, Accrual
class UnboundedOverlapError(Exception):
def __init__(self):
super().__init__('unbounded over... | StarcoderdataPython |
3482091 | <reponame>ufo2011/NXP-MCUBootUtility<filename>src/ui/ui_cfg_usdhcmmc.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import wx
import sys
import os
import RTyyyy_uidef
import uidef
import uivar
import uilang
sys.path.append(os.path.abspath(".."))
from win import bootDeviceWin_UsdhcMmc
from utils import sou... | StarcoderdataPython |
11399801 | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
import argparse
import os
from collections import OrderedDict
import torch
import torch.utils.data
from torch import nn, optim
from torch.nn import functional as F
from torchvision import datasets, transforms
import funsor
import fun... | StarcoderdataPython |
9744550 | <reponame>jazzathoth/DS-Unit-3-Sprint-1-Software-Engineering
#! /usr/bin/env python
from random import randint, sample, uniform
from acme import Product
# Useful to use with random.sample to generate names
ADJECTIVES = ['Awesome', 'Shiny', 'Impressive', 'Portable', 'Improved']
NOUNS = ['Anvil', 'Catapult',... | StarcoderdataPython |
11265689 | <gh_stars>1-10
from colander import Email
from colander import Length
from colander import SchemaNode
from colander import String
from colander import drop
from colander import SequenceSchema
from sandglass.time.schemas import BaseModelSchema
from sandglass.time.schemas import Dictionary
class UserSchema(BaseModelSc... | StarcoderdataPython |
165943 | <reponame>abhishekkushwaha4u/vitolx-backend
from django.contrib import admin
from exchange.models import (
Exchange
)
admin.site.register(Exchange)
| StarcoderdataPython |
5032406 | import pyjion
import gc
from test.libregrtest import main
pyjion.enable()
main()
pyjion.disable()
gc.collect()
| StarcoderdataPython |
5079917 | <reponame>Poehavshi/Hackaton_telegram_bot
TOKEN = '<YOUR_TOKEN>' | StarcoderdataPython |
6478172 | import pytest
from dolib.client import AsyncClient, Client
from dolib.models import Firewall, FirewallTargets
@pytest.mark.vcr
@pytest.mark.block_network()
def test_crud_firewalls(client: Client) -> None:
fw = Firewall(
name="test",
inbound_rules=[
Firewall.InboundRule(
... | StarcoderdataPython |
51142 | from __future__ import print_function
from __future__ import division
import os
import sys
import time
import datetime
import os.path as osp
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.backends.cudnn as cudnn
from torch.optim import lr_scheduler
from args import... | StarcoderdataPython |
1947972 | import sys
sys.path.append('../')
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
import seaborn as sns
from network import Protocol, BCPNNFast, NetworkManager
from connectivity_functions import create_artificial_manager
sns.set(font_scale=2.0)
# Patterns p... | StarcoderdataPython |
3515361 | <filename>exceptions/01_catch_exceptions.py
# This code snippet explains how Exception hierarchy works
# For more information check: https://docs.python.org/3.8/library/exceptions.html
try:
raise Exception("My custom exception")
except Exception as e: # catching Exception is not the best idea, try to be more speci... | StarcoderdataPython |
3353653 | <filename>Conf/sentinel.py<gh_stars>1-10
COMMAND_CONN_INFO_CYCLE = 10
COMMAND_CONN_PING_CYCLE = 1
COMMAND_CONN_SELF_CYCLE = 2
| StarcoderdataPython |
11312524 | import urllib.request
url='https://www.samsclub.com/sitemap.xml'
someRequest = urllib.request.urlopen(url)#loads provided URL
someRequest.getheaders() #Lists all HTTP headers.
someRequest.getheader("Content-Type") #return value of header 'Content-Type'
| StarcoderdataPython |
1893954 | import os
import time
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from argparse import Namespace
from .metrics import accuracy
from sopa.src.solvers.utils import noise_params
from MegaAdversarial.src.attacks import (
Clean,
PGD,
FGSM
)
CONFIG_PGD_TRAIN = {"eps": 0.3, "... | StarcoderdataPython |
382526 | def test_model_with_one_index():
ddl = """
CREATE table v2.task_requests (
runid decimal(21) not null
,job_id decimal(21) not null
,object_id varchar(100) not null default 'none'
,pipeline_id varchar(100) not null default 'none'
,sequ... | StarcoderdataPython |
3373390 | import pickle
import matplotlib.pyplot as plt
import numpy as np
from feature_format import featureFormat, targetFeatureSplit
from sklearn.feature_selection import SelectKBest, SelectPercentile, f_classif
import pprint
import operator
# loading the enron data dictionary
with open("final_project_dataset.pkl", "r") as d... | StarcoderdataPython |
3291906 | <filename>codewof/programming/content/en/hours-to-seconds/initial.py
def hours_to_seconds(hours):
seconds = hours x 60 x 60
return seconds
| StarcoderdataPython |
3524003 | <reponame>Correct-Syntax/wgpu-py<gh_stars>0
"""
WGPU backend implementation based on wgpu-native
The wgpu-native project (https://github.com/gfx-rs/wgpu) is a Rust library
based on gfx-hal, which wraps Metal, Vulkan, DX12 and more in the
future. It can compile into a dynamic library exposing a C-API,
accompanied by a ... | StarcoderdataPython |
3428451 | <reponame>datatalking/Python-Natural-Language-Processing
from gensim import models
w = models.Word2Vec.load_word2vec_format('/home/jalaj/Downloads/GoogleNews-vectors-negative300.bin', binary=True)
print 'King - man + woman:'
print ''
print w.wv.most_similar(positive=['woman', 'king'], negative=['man'])
print 'Similar... | StarcoderdataPython |
355621 | <gh_stars>0
''' Doc_String '''
from os import listdir, mkdir, getcwd, chdir, path
from my_headers import ii
####################################################################
####################################################################
####################################################################
... | StarcoderdataPython |
12830389 | ################
# Dependencies #
################
import importlib
from os import replace
from datetime import datetime, timedelta
from .helpers import route_url
from flask import make_response, jsonify, render_template, request as flask_request, abort as flask_abort, redirect as flask_redirect, session as flask_sessi... | StarcoderdataPython |
240085 | <reponame>stjordanis/owid-importer
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-01-05 07:06
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):
dependencies = [
... | StarcoderdataPython |
1900339 | # -*- coding: utf-8 -*-
"""Top-level package for LightBox."""
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.1.0'
| StarcoderdataPython |
6563210 | from db_context.Context import Context
class QueryContext(Context):
def __init__(self):
super().__init__()
def get_item_by_id(self, collection_name, item_id):
return self.db[collection_name].find_one({"_id": item_id})
def get_all(self, collection_name):
return self.db[collect... | StarcoderdataPython |
3334954 | <gh_stars>1-10
from .ass_toggle_comment import AssToggleCommentCommand
from .ass_toggle_comment import AssToggleCommentEventListener
__all__ = (
"AssToggleCommentCommand",
"AssToggleCommentEventListener",
)
| StarcoderdataPython |
277285 | <filename>src/utils/grid.py<gh_stars>0
import matplotlib.pyplot as plt
import numpy as np
import code
import cv2
from mpl_toolkits.axes_grid1 import ImageGrid
def nBilateral(img, n, params):
for i in range(n):
img = cv2.bilateralFilter(img, 5, *params)
return img
def nSharpen(img, n):
sharpen_kernel... | StarcoderdataPython |
4912464 | from actions.RequestOpenFood import RequestOpenFood
def get_open_food_info(req):
print(req)
result = req.get("result")
parameters = result.get("parameters")
barcode = parameters.get("barcode")
data = {}
if barcode:
try:
res = RequestOpenFood.get_product(barcode=barcode)
... | StarcoderdataPython |
12858964 | from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from .config import settings
SQLALCHEMY_DATABASE_URL = 'postgresql://{user}:{password}@{host}:{port}/{db}'.format(
user=settings.DB_USER,
password=settings.DB_PASSWORD,
hos... | StarcoderdataPython |
3440644 | <filename>python/py-itertools/compress-the-string.py
# Compress the String!
# groupby()
#
# https://www.hackerrank.com/challenges/compress-the-string/problem
#
import itertools
s = input()
print(' '.join(str((len(list(g)), int(c)))
for c, g in itertools.groupby(s)))
| StarcoderdataPython |
6644198 | <gh_stars>1-10
# -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.consistency import (
MultilineLoopViolation,
)
from wemake_python_styleguide.visitors.ast.loops import WrongLoopVisitor
incorrect_loop1 = """
def wrapper():
for x in some_func(1,
3):
...
"""
incorrect_l... | StarcoderdataPython |
8145182 | from .stub import Stub
from .calls import Call
from .doubles import Spy
from .doubles import TestDouble
from .interfaces import Observer
from .wrapper import AttributeWrapper
__all__ = ('Spy', 'Call', 'Stub', 'TestDouble', 'Observer', 'AttributeWrapper')
| StarcoderdataPython |
5096466 | <reponame>awesome-archive/webrecorder<gh_stars>0
import json
import time
import redis
import os
import re
import gevent
from operator import itemgetter
from bottle import request, HTTPError, response
from datetime import datetime
from re import sub
from webrecorder.basecontroller import BaseController, wr_api_spec
... | StarcoderdataPython |
3296803 | <reponame>nprez83/hyundai_kia_connect_api
import os
from hyundai_kia_connect_api.VehicleManager import VehicleManager
def test_login():
username = os.environ["KIA_CA_CDNNINJA_USERNAME"]
password = os.environ["KIA_CA_CDNNINJA_PASSWORD"]
pin = os.environ["KIA_CA_CDNNINJA_PIN"]
vm = VehicleManager(
... | StarcoderdataPython |
11313109 | """set up a new table for the Titanic data """
import os
import psycopg2
from dotenv import load_dotenv
load_dotenv() # looks inside the .env file for some env vars
# passes env var values to python var
DB_HOST = os.getenv("DB_HOST", default="OOPS")
DB_NAME = os.getenv("DB_NAME", default="OOPS")
DB_USER = os.getenv("D... | StarcoderdataPython |
1904477 | import os.path
from gzip import GzipFile
from typing import List, Dict, Optional, Union
import structlog
import rapidjson
import pandas as pd
from .handle_value_error import handle_value_error
class DsReaderFs:
def __init__(
self,
*,
root_path: str,
log: object = None,
man... | StarcoderdataPython |
11278901 | <filename>generated-libraries/python/netapp/ntdtest/ntdtest_nonlist_group_info.py
from netapp.ntdtest.group3_stats_info import Group3StatsInfo
from netapp.ntdtest.group1_stats_info import Group1StatsInfo
from netapp.ntdtest.group4_stats_info import Group4StatsInfo
from netapp.ntdtest.group2_stats_info import Group2Stat... | StarcoderdataPython |
3455018 | <reponame>yausername/whatsapp-cli<filename>whatsappCli/feed/pb_feeder.py
from collections import OrderedDict
import os
import io
import json
import requests
import threading
import time
from feeder import Feeder
import pb_stream
from pb_stream import contacts
from pb_stream import config
from pkg_resources import reso... | StarcoderdataPython |
1908343 | <filename>bin/upload_cdms.py
''' This program will Upload Color Depth MIPs to AWS S3.
'''
__version__ = '1.3.3'
import argparse
from datetime import datetime
import glob
import json
import os
import re
import socket
import sys
from time import strftime, time
import boto3
from botocore.exceptions import ClientError
imp... | StarcoderdataPython |
3459589 | import datetime
from django.test import TestCase
from dimagi.utils.dates import DateSpan
from pillowtop.es_utils import initialize_index_and_mapping
from corehq.apps.app_manager.const import AMPLIFIES_YES
from corehq.apps.app_manager.models import Application
from corehq.apps.data_analytics.const import NOT_SET, YES... | StarcoderdataPython |
3375849 | from PIL import Image
def plus(str):
# 返回指定长度的字符串,原字符串右对齐,前面填充0。
return str.zfill(8)
def getCode(img):
str = ""
# 获取到水印的宽和高进行遍历
for i in range(img.size[0]):
for j in range(img.size[1]):
# 获取水印的每个像素值
rgb = img.getpixel((i, j))
# 将像素值转为二进制后保存
... | StarcoderdataPython |
6434727 | # Copyright (c) 2020 fortiss GmbH
#
# Authors: <NAME>
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
import gin
import tensorflow as tf # pylint: disable=g-explicit-tensorflow-version-import
from tf_agents.networks import network, utils
@gin.co... | StarcoderdataPython |
301144 | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 21 17:28:04 2015
@author: <NAME>
"""
import pytest
from aneris.entity import Simulation
from aneris.entity.data import DataCatalog, DataPool
from aneris.control.pipeline import Sequencer
from aneris.control.simulation import Loader, Controller
from aneris.control.data i... | StarcoderdataPython |
3584527 | <reponame>magechaP/WayaHoodie<filename>hood/migrations/0001_initial.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2019-09-18 04:09
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations... | StarcoderdataPython |
3418932 | # TODO: maybe all this could be removed, and loading the model done in specific commands
# like in populate_db and
import numpy as np
import sys
import os
from pathlib import Path
# Importing rse_watch package and config
dir_path = Path(os.getcwd())
sys.path.append(str(dir_path / 'polls/rse_model'))
model_directory =... | StarcoderdataPython |
9651331 | <reponame>ollelauribostrom/pi-home-monitor<filename>tests/MockResponse.py
class MockResponse:
def __init__(self):
self.msg = None
def message(self, msg):
self.msg = msg | StarcoderdataPython |
271558 | import numpy as np
import math
#def recognit(forCounter,x_in,y_in,heading):
#data = np.genfromtxt('data'+str(forCounter)+'.csv',delimiter=',')
x_in = 1000
y_in = -800
heading = math.pi*0.1355
#data = np.genfromtxt('T1/data36.csv',delimiter=',')
data = np.concatenate ((data[211:400], data[0:211]),axis=0)
pos_flag = 0
... | StarcoderdataPython |
111997 | from bullet import Bullet, YesNo
from pathlib import Path
class BlueprintManager:
def __init__(self):
self.config = None
def setup(self, config: dict):
self.config = config
def get_blueprint_folder(self, blueprint_name: str = None):
library_folder = Path(self.config.get("library_... | StarcoderdataPython |
6706609 | <reponame>amcclead7336/Enterprise_Data_Science_Final
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ------------... | StarcoderdataPython |
4984541 | <reponame>Mudassaralimosu/imdb-rotten_tomatoes-metacritic<filename>src/imdb_rtomatoes_metacritic.py
import requests
from bs4 import BeautifulSoup
class Rating:
imdb_url=""
metacritic_url=""
rtomatoes_url=""
def __init__(self, name):
self.name=name
google_search=requests.get("https://... | StarcoderdataPython |
3541557 | <reponame>PauloLuna/ansible-pan<filename>library/panos_gre_tunnel.py<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2020 Palo Alto Networks, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ... | StarcoderdataPython |
3591936 | <reponame>sararob/python-aiplatform
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | StarcoderdataPython |
4809317 | <filename>scripts/vwize.py<gh_stars>10-100
import sys
import argparse
import os
from collections import Counter
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("-s", "--strains", type=str, required=False, dest="strains", nargs="+")
parser.add_argument("-i", "--input", type=str, req... | StarcoderdataPython |
135830 | # Copyright 2013 OpenStack Foundation
# 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 requ... | StarcoderdataPython |
3576518 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2009 <NAME> ( <EMAIL> )
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
"""
Short functions for working with collections of raw reads.
"""
... | StarcoderdataPython |
9797947 | import string
import secrets # for random token generation
from datetime import datetime
from .extensions import db
class Link(db.Model):
id = db.Column(db.Integer, primary_key=True)
original_url = db.Column(db.String(512))
short_url = db.Column(db.String(8), unique = True)
visits = db.C... | StarcoderdataPython |
8184509 | <reponame>dperl-sol/cctbx_project
from __future__ import absolute_import, division, print_function
import iotbx.pdb
from libtbx.str_utils import split_keeping_spaces
import sys
import six
trans_dict = {}
for k,v in six.iteritems(iotbx.pdb.rna_dna_atom_names_reference_to_mon_lib_translation_dict):
trans_dict[k.strip(... | StarcoderdataPython |
1943589 |
from jumpscale import j
# TODO: P2 S4 :eduard TextLineEditor tool does not work any more, is a
# pitty because ideal to parse config files on a filesystem (id:83)
JSBASE = j.application.jsbase_get_class()
class TextLineEditor(JSBASE):
"""
represents a piece of text but broken appart in blocks/tokens
thi... | StarcoderdataPython |
8094997 | <reponame>cermegno/mqtt-dash
import paho.mqtt.client as mqtt
import time
import redis
import json
# Choose the right Redis database
r = redis.Redis(host='127.0.0.1', port='6379')
#r = redis.Redis(host='myredis.in.pws.cloud', port='12345', password='<PASSWORD>')
# Select the right MQTT broker
#broker_address... | StarcoderdataPython |
1937436 | import os
from pysnark import runtime
from pysnark.runtime import LinComb
from pysnark.fixedpoint import LinCombFxp
from pysnark.boolean import LinCombBool
from pysnark.poseidon_constants import poseidon_constants
"""
Implements the Poseidon hash function with 128-bit security and 4-1 reduction
Currently supp... | StarcoderdataPython |
1983795 | from swagger_spec_validator import validate_spec_url
import sys
validate_spec_url(sys.argv[1])
| StarcoderdataPython |
1836470 | <filename>ProblemSet2/ProblemSet2-2.py
balance = 3926
annualInterestRate = 0.2
#import time
monthlyInterest = annualInterestRate / 12.0
workingBalance = balance
minimumPayment = 0
while workingBalance > 0:
minimumPayment += 10
workingBalance = balance
for month in range(1, 13):
workingBalance -= minimumPayment... | StarcoderdataPython |
6680921 | <filename>stockTrainerApp/views.py
import stripe
import quandl
import json
import datetime
import pandas as pd
from functools import wraps
from jose import jwt
from decouple import config
import json
from rest_framework.decorators import api_view
from . models import Test, Stock, User, Portfolio, Study
from . serialize... | StarcoderdataPython |
8131888 | <gh_stars>1-10
# All rights reserved by forest fairy.
# You cannot modify or share anything without sacrifice.
# If you don't agree, keep calm and don't look on text below...
__author__ = "VirtualV <github.com/virtualvfix>"
__date__ = "07/10/17 13:16"
import platform
from pkg_resources import parse_version
# check ... | StarcoderdataPython |
40533 | <gh_stars>1-10
# Copyright 2016 Canonical Limited.
#
# This file is part of charms.hardening.
#
# charm-helpers is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# charm-helpers is distributed... | StarcoderdataPython |
1778626 | import requests
from firepunch.slack_notifier import SlackNotifier
def test_post_slack(mocker):
mocker.patch("requests.post")
token = "dummy_<PASSWORD>"
channel_name = "#channel_name"
text = \
"1 commits between 2019-03-20 12:39:59 and 2019-03-21 12:39:58.\n" + \
"--------------------... | StarcoderdataPython |
1966013 | <filename>Algorithms_easy/0203. Remove Linked List Elements.py
"""
203. Remove Linked List Elements
Remove all elements from a linked list of integers that have value val.
Example:
Input: 1->2->6->3->4->5->6, val = 6
Output: 1->2->3->4->5
"""
# Definition for singly-linked list.
# class ListNode(object):
# def _... | StarcoderdataPython |
1761354 | import testbase
from sqlalchemy import *
class CompileTest(testbase.AssertMixin):
"""test various mapper compilation scenarios"""
def tearDownAll(self):
clear_mappers()
def testone(self):
global metadata, order, employee, product, tax, orderproduct
metadata = BoundMetaData(... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.