id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
358224 | <reponame>connorescajeda/sat
import sys
def anyhop_main(planner):
if len(sys.argv) == 1:
print(f"Usage: python3 {sys.argv[0]} -v:[verbosity] -s:[max seconds] [planner_file]+")
else:
verbosity = 1
max_seconds = None
for filename in sys.argv[1:]:
if filename.startswit... | StarcoderdataPython |
4800281 | <gh_stars>1-10
import json
import os
dirr = os.listdir('content/projects/')
projects = []
for x in dirr:
if ".md" in x:
projects.append(x)
out = []
for file_name in projects:
with open(os.path.join(os.curdir, "content/projects/", file_name), 'r') as file:
objects = file.read().split("---")
... | StarcoderdataPython |
3222205 | <filename>tests/components/aladdin_connect/test_config_flow.py
"""Test the Aladdin Connect config flow."""
from unittest.mock import patch
from homeassistant import config_entries
from homeassistant.components.aladdin_connect.config_flow import InvalidAuth
from homeassistant.components.aladdin_connect.const import DOM... | StarcoderdataPython |
3541512 | <gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-06-08 18:04
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('push_notifications', '0009_gcmdevice_rename_device_uuid'),
]
operation... | StarcoderdataPython |
1743730 | import logging
from traitlets import Unicode, Integer, List
from traitlets.config import Application
from conda_store_server.app import CondaStore
class CondaStoreWorker(Application):
aliases = {
"config": "CondaStoreWorker.config_file",
}
log_level = Integer(
logging.INFO,
help... | StarcoderdataPython |
11398088 | <filename>src/encoder_decoder/finetuning.py
import os
import torch
import torch.nn.functional as F
from datasets import DatasetDict
from torch.utils.data import DataLoader
from tqdm.auto import tqdm, trange
from transformers import AutoTokenizer, set_seed
from src.encoder_decoder.config import Config
from src.encoder_... | StarcoderdataPython |
1738572 | <filename>workflow/scripts/count/create_demultiplexed_index.py
# Author: <NAME> 2021
# print out barcodes and correspoding assignment (tsv format to standard out) from a picke file
import click
import csv
import pandas as pd
# options
@click.command()
@click.option('--experiment',
'experiment_file',
... | StarcoderdataPython |
341009 | <gh_stars>1-10
import nextcord, random
from nextcord.ext import commands, tasks
from nextcord.ext import commands
status = ['Arma 3', 'Minecraft', 'Left 4 Dead 2', 'Jackbox Party Pack', 'Metal Gear Solid V', 'Phasmophobia', 'Counter-Strike: Global Offensive', 'Garry\'s Mod', 'Barotrauma']
class statusChange(commands.C... | StarcoderdataPython |
9646051 | h = 5
print("*" * h)
for i in range(1,h):
for j in range(h):
if j == h - i:
print("*",end='')
else:
print(" ",end='')
print()
print("*" * h)
| StarcoderdataPython |
3487313 | <filename>scripts/format_script.py<gh_stars>1-10
import numpy as np
from telstate_interface import TelstateInterface
import redis
import pickle
import time
TelInt = TelstateInterface()
cal_K, cal_G, cal_B, cal_all, timestamp = TelInt.query_telstate('10.98.2.128:31829', '/home/danielc/')
red = redis.StrictRedis(port='... | StarcoderdataPython |
130060 | import pytest
import os
import warnings
from fixtures import COMPRESSION_NAMES
import zipfile
from compress_pickle import (
dump,
dumps,
load,
loads,
get_compression_read_mode,
get_compression_write_mode,
)
@pytest.mark.usefixtures("wrong_compressions")
def test_dump_fails_on_unhandled_compres... | StarcoderdataPython |
3288477 | <reponame>laylalaisy/Educational-Administration-System<gh_stars>1-10
from django.db import models
from basicInfo.config import course_type
class observer:
def __init__(self):
pass
def update(self,*text):
pass
class OperationObserver(observer):
def update(self,*text):
ope... | StarcoderdataPython |
9766842 | <filename>python/8kyu/is_he_gonna_survive.py<gh_stars>1-10
"""Kata url: https://www.codewars.com/kata/59ca8246d751df55cc00014c."""
def hero(bullets: int, dragons: int) -> bool:
return bullets >= dragons * 2
| StarcoderdataPython |
11286813 | #
# Copyright (c) 2019, Neptune Labs Sp. z o.o.
#
# 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 agr... | StarcoderdataPython |
9419 | # Copyright 2005-2008, <NAME>
# Copyright 2010, 2012 <NAME>
# This software's license gives you freedom; you can copy, convey,
# propagate, redistribute, modify and/or redistribute modified versions of
# this program under the terms of the GNU Affero General Public License
# (AGPL) as published by the Free Software Fo... | StarcoderdataPython |
4803594 | #Part 1
grid = {}
with open("input.txt") as data:
for line in data.readlines():
l, r = line.split(" -> ")
x1, y1 = map(int, l.split(","))
x2, y2 = map(int, r.split(","))
if x1 == x2 or y1 == y2:
for x in range(min(x1, x2), max(x1, x2) + 1):
for y in range(min(y1, y2), max(y1, y2)... | StarcoderdataPython |
1778222 | <reponame>Alex-Greenen/SpectralNeuralAnimation
# process data
from ProcessData.ProcessData import ProcessData
import os
# Clear
filelist = [ f for f in os.listdir('TrainingData') ]
for f in filelist: os.remove(os.path.join('TrainingData', f))
filelist = [ f for f in os.listdir('ValidationData') ]
for f in filelist: os... | StarcoderdataPython |
3570676 | <filename>miniSearchEngine/construct_engine/encoding_decoding.py
def vb_encoding(ori):
ori = bin(ori)[2:]
target = (7 - len(ori) % 7) * '0' + ori
tem = list(target)
count = 0
for i in range(len(target) // 7):
if i == len(target) // 7 - 1:
tem.insert(7 * i + count, '1')
el... | StarcoderdataPython |
4863320 | <filename>hms/exceptions.py
class ApiCallError(Exception):
def __init__(self, message, detail=None):
Exception.__init__(self, message)
self.detail = detail
| StarcoderdataPython |
1608261 | <filename>tensorflow/python/distribute/values.py
# Copyright 2018 The TensorFlow Authors. 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/li... | StarcoderdataPython |
363788 | <filename>pinax/announcements/urls.py<gh_stars>0
from django.conf.urls import url
from pinax.announcements import views
urlpatterns = [
url(r"^$", views.AnnouncementListView.as_view(),
name="announcement_list"),
url(r"^create/$", views.AnnouncementCreateView.as_view(),
name="announcement_creat... | StarcoderdataPython |
3365538 | from source import (
CINT
, CSTR
# CPU instructions semantics definition
, Type
, Comment
, Call
, MCall
, Macro
, Function
, Declare
, Variable
, BranchSwitch
, SwitchCase
, OpAssign
, OpIndex
, OpAdd
, BranchIf
, BranchElse
, OpLess
, OpOr
, OpAnd
, OpNot
, OpEq
)
from q... | StarcoderdataPython |
4909964 | <reponame>WestenPy/Curso_em_video
'''Faça um programa que leia um número inteiro qualquer e mostre
na tela a sua tabuada'''
print('-=' * 30)
print(' TABUADA')
print('-=' * 30)
n = int(input('Digite um número para saber a sua tabuada: '))
print(f'{n} x 1 = {n * 1}')
print(f'{n} x 2 = {n * 2}'... | StarcoderdataPython |
8106461 | <filename>KvantProgram.py
import os
clear = lambda: os.system("clear")
from colorama import init
init()
from colorama import Fore, Back, Style
clear()
print( Fore.RED + "Сделанно KvantGD гайд на канале")
print( Fore.WHITE + "Ссылка на канал YouTube: https://www.youtube.com/channel/KvantGD")
print("")
pr... | StarcoderdataPython |
3392442 | # Copyright (c) ASAPP Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
from dataclasses import dataclass, field
from omegaconf import II
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
f... | StarcoderdataPython |
3288806 | import copy
import math
from fractions import Fraction
from typing import *
from util import lcm_many, compare_trees, Tree, SMTUtilOption, get_tag, get_coefs_fraction, convert_int2list, \
find_subtrees_by_tags, get_lets
def look_into_floor(to_int: Tree, vars: Dict[str, Tuple[int, int]], lets: Dict[str, Any]) -> ... | StarcoderdataPython |
345737 | def search(blocking, requester, task, keyword, tty_mode):
# the result of the task the hub thread submitted to us
# will not be available right now
task.set_async()
blocking.search_image(requester, task.return_result, keyword, tty_mode)
| StarcoderdataPython |
8152376 | <filename>falpr/setup.py
from setuptools import setup
VERSION = '0.0.1'
with open('requirements.txt') as f:
install_requires = f.readlines()
setup(
name='falpr',
version=VERSION,
description='Fully Automated Licence Plate Recognizer',
long_description='Magnificent app which recognizes chars in ph... | StarcoderdataPython |
6647456 | <filename>viz3d/opengl/primitives/sphere.py
from typing import Tuple
from io import StringIO
import numpy as np
__vertex_data = """
0.000000 0.000000 -1.000000 0.102381 -0.315090 -0.943523
0.425323 -0.309011 -0.850654 0.102381 -0.315090 -0.943523
-0.162456 -0.499995 -0.850654 0.102381 -0.315090 -0.943523
0.723607 -0.... | StarcoderdataPython |
8085823 | <gh_stars>0
# -*- coding: utf-8 -*-
from datetime import date, datetime, timedelta
import time as t
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
#Load Tushare
from rqalpha.apis.api_base import history_bars, get_position
from rqalpha.mod.rqalpha_mod_sys_accounts.api.ap... | StarcoderdataPython |
6471426 | from bxcommon.models.serializable_flag import SerializableFlag
class QuotaType(SerializableFlag):
FREE_DAILY_QUOTA = 1
PAID_DAILY_QUOTA = 2
def __str__(self):
return str(self.name).lower()[:4]
| StarcoderdataPython |
9668962 | <reponame>Hamel007/oms_cms<gh_stars>10-100
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class UtilsConfig(AppConfig):
name = 'oms_cms.backend.utils'
verbose_name = _('Настройки')
| StarcoderdataPython |
6571088 | """
Options for managing Confab.
"""
from os import getcwd
from os.path import basename
from fabric.api import env, task
from fabric.utils import _AttributeDict
from difflib import unified_diff
from magic import Magic
from re import match
def _should_render(mime_type):
"""
Return whether a template file of ... | StarcoderdataPython |
1711889 | <reponame>viniciusriosfuck/vertical<filename>legacy/model_functions_old.py<gh_stars>0
import numpy as np
import pandas as pd
from datetime import datetime
from scipy.integrate import odeint
import matplotlib.pyplot as plt
def run_SEIR_ODE_model(covid_parameters, model_parameters) -> pd.DataFrame:
"""
Runs the... | StarcoderdataPython |
9648732 | # encoding: utf-8
"""sys.excepthook for IPython itself, leaves a detailed report on disk.
Authors:
* <NAME>
* <NAME>
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2001-2007 <NAME>. <<EMAIL>>
# Copyright (C) 2008-2011 The IPython Development Team
#
... | StarcoderdataPython |
4809358 | <reponame>AaronFriel/pulumi-aws-native
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, ... | StarcoderdataPython |
8148564 | <reponame>Dung-Han-Lee/Pointcloud-based-Row-Detection-using-ShellNet-and-PyTorch
from sys import argv
import os
def rename(directory):
num = 0
for filename in sorted(os.listdir(directory)):
ext = filename.split(".")[-1]
if (ext != 'png' and ext != 'npy' and ext != 'jpg') :
continue
... | StarcoderdataPython |
5089428 | <filename>runtests.py
#!/usr/bin/env python
# -*- coding: utf-8
from __future__ import unicode_literals, absolute_import
import os
import sys
import subprocess
import pytest
PYTEST_ARGS = ['--tb=short', '-q', '-s', '-rw']
FLAKE8_ARGS = ['custom_auth_user', 'tests']
sys.path.append(os.path.dirname(__file__))
def ... | StarcoderdataPython |
1662807 | from netapp.connection import NaConnection
from instance_info import InstanceInfo # 2 properties
from enabled_preset import EnabledPreset # 1 properties
from filter import Filter # 0 properties
from counter_data import CounterData # 2 properties
from filter_data import FilterData # 0 properties
from aggregation_data im... | StarcoderdataPython |
1767030 | from twitter.twitter import Twitter # noqa
| StarcoderdataPython |
177427 | <gh_stars>1-10
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import datetime
import unittest
import json
from libs import time_util
from model import swarming_task_queue_request
class SwarmingTaskQueu... | StarcoderdataPython |
3594404 | #!/usr/bin/env python
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Tool to help developers rebase branches across the Blink rename."""
import argparse
import json
import os
import subprocess
import s... | StarcoderdataPython |
6401361 | from numpy import int64
from randomForest_classifier.predict import make_prediction
from randomForest_classifier.processing.data_management import load_dataset
def test_make_single_prediction():
# Given
test_data = load_dataset(file_name='test.csv')
single_test_input = test_data[0:1]
# When
subj... | StarcoderdataPython |
1862 | <reponame>jgrigera/indico<filename>indico/web/forms/fields/protection.py<gh_stars>1-10
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ imp... | StarcoderdataPython |
5060252 | # -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.11.3
# kernelspec:
# display_name: Python 3
# name: python3
# ---
# + [markdown] id="view-in-github" colab_type="text"
... | StarcoderdataPython |
6540926 | <reponame>power-edge/mlb_statsapi_etl
"""
created by nikos at 4/29/21
"""
import unittest
from .base_test_mixin import ModelTestMixin, sleep_after_get
class TestSeasonModel(unittest.TestCase, ModelTestMixin):
from mlb_statsapi.model.api.season import SeasonModel as Mod
def setUp(self) -> None:
# noi... | StarcoderdataPython |
6407052 | <filename>Python/DeepSSMUtilsPackage/DeepSSMUtils/TorchLoaders.py<gh_stars>0
import os
import numpy as np
import itk
import csv
import random
import subprocess
import torch
from torch import nn
from torch.utils.data import DataLoader
######################## Data loading functions ####################################
... | StarcoderdataPython |
28936 | #!/usr/bin/env python3
import argparse
import gc
import numpy as np
import os
import pandas as pd
import pysam
# Number of SVs to process before resetting pysam (close and re-open file). Avoids a memory leak in pysam.
PYSAM_RESET_INTERVAL = 1000
def get_read_depth(df_subset, bam_file_name, mapq, ref_filename=None)... | StarcoderdataPython |
79696 | <reponame>Benjamin-Fouquet/Processing-scripts
#!/bin/env python
"""
Simple VTK example in Python to load an STL mesh and display with a manipulator.
<NAME>, 2014-01-28, (c) 2014
"""
import vtk
def render():
# Create a rendering window and renderer
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
... | StarcoderdataPython |
1789555 | <reponame>Guya-LTD/user
# -*- coding: utf-8 -*-
"""Copyright Header Details
Copyright
---------
Copyright (C) Guya , PLC - All Rights Reserved (As Of Pending...)
Unauthorized copying of this file, via any medium is strictly prohibited
Proprietary and confidential
LICENSE
-------
This file is subject ... | StarcoderdataPython |
99681 | import asyncio
import logging
import socket
import websockets
from gabriel_protocol import gabriel_pb2
from collections import namedtuple
URI_FORMAT = 'ws://{host}:{port}'
logger = logging.getLogger(__name__)
websockets_logger = logging.getLogger(websockets.__name__)
# The entire payload will be printed if this is... | StarcoderdataPython |
3288279 | #!/usr/bin/python
# $1 The readme to be transformed
# $2 brief description
# $pwd: dest dir
import sys
import os.path
def readFirst(line, brief, out):
if line[0:2] != "# ":
raise ValueError("Expected first line to start with '# '")
# skip the first line
if brief is not None:
out.write(line + "\n");
out.write... | StarcoderdataPython |
4827684 | <filename>homeassistant/components/zha/core/channels/protocol.py
"""
Protocol channels module for Zigbee Home Automation.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/zha/
"""
import logging
import zigpy.zcl.clusters.protocol as protocol
from .. imp... | StarcoderdataPython |
11369098 | <filename>model.py
# -*- coding: utf-8 -*-
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
bookmarks_tags = db.Table('bookmarks_tags',
db.Column('bookmark_id', db.Integer, db.ForeignKey('bookmark.id')),
db.Column('tag_id', db.Integer, db.ForeignKey('tag.id'))
... | StarcoderdataPython |
5028297 | #!/usr/bin/env python
"""
Convert a URL or a path into different formats, e.g., Jupyter URL, GitHub, Git
path.
> url.py https://github.com/.../.../Task229_Exploratory_analysis_of_ST_data.ipynb
file_name=
/Users/saggese/src/.../.../oil/ST/Task229_Exploratory_analysis_of_ST_data.ipynb
github_url=
https://github.com/..... | StarcoderdataPython |
12805635 | <gh_stars>10-100
"""
A custom Model Field for tagging.
"""
from django.db import IntegrityError
from django.db.models import signals
from django.db.models.fields import CharField
from django.utils.translation import ugettext_lazy as _
from tagging import settings
from tagging.models import Tag, Synonym
from tagging.ut... | StarcoderdataPython |
1818858 | /*!
* @file mdm_T1FitterIR.h
* @brief Class for estimating T1 (and M0) in a single voxel using inversion recovery method
* @details
* @author <NAME> (c) Copyright QBI Lab, University of Manchester 2020
*/
#ifndef MDM_T1FITERRIR_HDR
#define MDM_T1FITERRIR_HDR
#include "mdm_api.h"
#include "mdm_T1FitterBase.h"... | StarcoderdataPython |
121486 | <filename>rha/core/admin.py
# coding: utf-8
from django.contrib import admin
from models import (Enterprise, Contact, Partner,
Step, Gallery, Course, Objective,
Public, Team, Cost, Graduation,
Institute, Subscribe)
from forms import (CourseModelForm, Objectiv... | StarcoderdataPython |
4924221 | <reponame>open-data-toronto/ckan-customization-open-data-toronto
CUSTOM_MIMETYPES = {"gpkg": "application/geopackage+vnd.sqlite3"}
ZIPPED_FORMATS = ["SHP"]
CATALOGUE_SEARCH = {"rows": 10, "sort": "score desc", "start": 0}
GEOSPATIAL_FORMATS = {"CSV", "GEOJSON", "GPKG", "SHP"}
TABULAR_FORMATS = {"CSV", "JSON", "XML"}... | StarcoderdataPython |
5123294 | <reponame>groovetch/edx-figures
"""
# Background
Figures originally calculated completions as the certificates generated
As of mid 2020, we are reworking metrics so that course completsions are based
off of gradable sections likely followed by using or adapting the completion
aggregator
We need to rename our curre... | StarcoderdataPython |
1627638 |
def test_get_version(self):
"""Tests the get_version function."""
version = ${python_module_name}.get_version()
self.assertIsNotNone(version)
| StarcoderdataPython |
9749824 | <reponame>cdagnino/LearningModels
import src
import numpy as np
from scipy.stats import entropy
from scipy.special import expit
from numba import njit
def my_entropy(p):
return entropy(p)
@njit()
def force_sum_to_1(orig_lambdas):
"""
Forces lambdas to sum to 1
(although last element might be negativ... | StarcoderdataPython |
3496668 | class Solution:
def shiftingLetters(self, S, shifts):
"""
:type S: str
:type shifts: List[int]
:rtype: str
"""
a = ord("a")
s = 0
result = ""
for index in reversed(range(len(shifts))):
s += shifts[index]
s %= 26
... | StarcoderdataPython |
6573760 | # coding: utf-8
#
# Copyright 2021 The Oppia Authors. 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 requi... | StarcoderdataPython |
9797919 | import webbrowser
from cactus.utils import run_subprocess
import os
import platform
from threading import Thread
s1 = """
tell application "Google Chrome"
set windowsList to windows as list
repeat with currWindow in windowsList
set tabsList to currWindow's tabs as list
repeat with currTab in t... | StarcoderdataPython |
98895 | <reponame>gnmerritt/dailyrippl<filename>rippl/bills/migrations/0002_auto_20170109_2142.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-09 21:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bi... | StarcoderdataPython |
6555175 | <gh_stars>1-10
#!/usr/bin/python
import argparse
import collections
import json
import math
import os
import struct
import sys
ANGLE_FACTOR = 2 * math.pi / 40000.0
SPEED_FACTOR = 1 / 1000.0
def parseConfig(settingsFile):
settings = {}
curSection = None
lines = [x.strip() for x in settingsFile.readlines()]
fo... | StarcoderdataPython |
3400161 | <reponame>archibongn1/Project
from setuptools import setup, find_packages
setup(
name='ArithSmcho',
version='0.1',
packages=find_packages(exclude=['test*']),
url='',
license='',
author='smcho',
author_email='',
description=''
)
| StarcoderdataPython |
6649755 | <gh_stars>0
"""
Combination Sum II
Given a collection of candidate numbers (candidates) and a target number (target),
find all unique combinations in candidates where the candidate numbers sum to target.
Each number in candidates may only be used once in the combination.
Note: The solution set must not contain dup... | StarcoderdataPython |
105162 | from __future__ import unicode_literals
from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from django.test import override_settings
from rest_framework.exceptions import ValidationError
from rest_framework.test import APITestCase
from documents.models import DocumentType
fro... | StarcoderdataPython |
11286415 | <filename>tests/logfile/test_logfile.py<gh_stars>100-1000
# pylint: disable=protected-access
import logging
import pytest
from pyctuator.logfile.logfile import PyctuatorLogfile # type: ignore
from pyctuator.pyctuator import default_logfile_format
test_buffer_size = 1000
@pytest.mark.mark_logfile_test_empty_respon... | StarcoderdataPython |
3440292 | """
Dans_Diffraction Examples
Read values from a Crystallographic Information File (.cif or .mcif), edit the structure, write a different file
"""
import sys, os
import numpy as np
import matplotlib.pyplot as plt # Plotting
cf = os.path.dirname(__file__)
sys.path.insert(0,os.path.join(cf,'..'))
import Dans_Diffractio... | StarcoderdataPython |
398511 | # Copyright 2018-2021 Faculty Science Limited
#
# 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... | StarcoderdataPython |
8058830 | from unittest import TestCase
from maintain_frontend.llc1.validation.search_extent_validator import SearchExtentValidator
NO_GEOMETRY = None
FEATURE_COLLECTION = {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Polygon",
... | StarcoderdataPython |
55582 | # Author: StevenChaoo
# -*- coding:UTF-8 -*-
import json
import logging
import time
import random
import sys
from sklearn_crfsuite import CRF
from sklearn.metrics import classification_report
from util import tools
from tqdm import tqdm
logging.basicConfig(
format="%(asctime)s - %(levelname)s - %(name)s - %(me... | StarcoderdataPython |
11250080 | <gh_stars>10-100
"""
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: MIT-0
"""
import copy
import unittest
from unittest.mock import patch, MagicMock
from cfn_policy_validator.tests import offline_only
from cfn_policy_validator.tests.boto_mocks import BotoClientError
from c... | StarcoderdataPython |
3219149 | from libs import browser_init, insta_login
import pandas as pd
import numpy as np
import os
import sys
from datetime import datetime
from pathlib import Path
#initialising the connection
browser = browser_init()
insta_login(browser)
# Setting up a dict with the name and insta accounts of profiles to scrape
dct={}
d... | StarcoderdataPython |
302500 | from flask_login.utils import logout_user
from app import app, db, bcrypt
from flask import render_template, redirect, flash, url_for, request
from forms import StuRegistration, StuLogin, StuUpdate
from model import Student, Organization, Scholarship, scholarship_application
from flask_login import login_user, current_... | StarcoderdataPython |
80070 | <reponame>tiagoeckhardt/trac
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016-2019 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://trac.ed... | StarcoderdataPython |
9785630 | <gh_stars>0
"""
Scripts that querry ADS for the list of dissertations each year as well as scripts that parse the institutions.
"""
import urllib
import json
import yaml
import glob
import numpy as np
import astropy
import astropy.io.ascii
import os
import requests, bs4
#ADS_KEY = os.getenv('ADS_KEY')
ADS_TOKEN = os.g... | StarcoderdataPython |
9605532 | import psalg.configdb.configdb as cdb
import json
# json2xtc conversion depends on these being present with ':RO'
# (and the :RO does not appear in the xtc names)
leave_alone = ['detName:RO','detType:RO','detId:RO','doc:RO','alg:RO','version:RO']
def remove_read_only(cfg):
# be careful here: iterating recursively... | StarcoderdataPython |
3507808 | """In this example we're using GitHub's APIs and we're going to access a private repo.
In this example I will show you how to populate headers for your API call using a
OAuth token (that expires in April).
"""
import requests
url = 'https://api.github.com/repos/robot297/hello-world'
headers = {
'Accept': 'applica... | StarcoderdataPython |
3553110 | import csbuilder
from csbuilder.standard import Protocols, Roles, States
@csbuilder.protocols
class ThesisProtocols(Protocols):
AUTHENTICATION = 0
CHECK = 1
SEARCH = 2
MATCH = 3
REGISTER = 4
@csbuilder.roles(protocol=ThesisProtocols.AUTHENTICATION)
@csbuilder.roles(protocol=ThesisProtocols.CHEC... | StarcoderdataPython |
9627859 | <filename>libs/dimension_reduction.py
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn import datasets
from sklearn.decomposition import (PCA, IncrementalPCA,
KernelPCA, TruncatedSVD,
FastICA, MiniBatchDictionaryL... | StarcoderdataPython |
1604509 | # import os
# import logging
# import logging.config
# import yaml
# def setup_logging(
# default_path='logging.yaml',
# default_level=logging.INFO,
# env_key='LOG_CFG'
# ):
# """Setup logging configuration
# """
# path = default_path
# value = os.getenv(env_key, None)
# print(path)
... | StarcoderdataPython |
344617 | #!/usr/bin/python3
# <NAME> @2013
# steinkirch at gmail
from collections import defaultdict
def defaultdict_example():
''' show some examples for defaultdicts '''
pairs = {('a', 1), ('b',2), ('c',3)}
d1 = {}
for key, value in pairs:
if key not in d1:
d1[key] = []
... | StarcoderdataPython |
280595 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
from astropy.table import QTable
__all__ = [
'SpectrumButterfly',
]
class SpectrumButterfly(QTable):
"""Spectral model butterfly class.
Co... | StarcoderdataPython |
12858998 | <filename>tests/timesheet/test_regroup.py
import datetime
from . import create_timesheet
def test_regroup_doesnt_regroup_entries_with_different_alias():
contents = """01.04.2013
foo 2 bar
bar 2 bar"""
t = create_timesheet(contents)
entries = list(t.entries.filter(regroup=True).values())[0]
assert le... | StarcoderdataPython |
5089915 | import configparser
import dataclasses
import logging
import pathlib
from cod.instance import BaseInstance
from cod.tunnel import Tunnel
class Config:
"""
Loads the "~/cod.ini" configuration file into memory. It is an INI file
with the following sections:
# global settings here
ssh=/usr/bin/ssh
... | StarcoderdataPython |
42065 | from __future__ import annotations
import subprocess
import pytest
from conftest import CustomTOMLFile
@pytest.mark.parametrize("command", [["update"], ["types", "update"]])
def test_update(command: list[str], toml_file: CustomTOMLFile):
content = toml_file.poetry
content["dependencies"].add("requests", "^2... | StarcoderdataPython |
5101186 | <filename>prepare_reads_file.py
import pandas as pd
import click
from prepare_reads_file_helpers import parse_html, prepare_hsa_files
import os
@click.command()
@click.argument('hsa_gff_mirbase_file')
@click.argument('output_file')
@click.argument('output_folder')
def main(hsa_gff_mirbase_file, output_file,
... | StarcoderdataPython |
220070 | <filename>models/models.py<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
import torch
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
import torch.autograd as autograd
from torch.autograd.variable import Variable
from threading import Lock
from torch.distributions import Categ... | StarcoderdataPython |
1822526 | # ----------------------------------------------------------------------
# ctokens.py
#
# Token specifications for symbols in ANSI C and C++. This file is
# meant to be used as a library in other tokenizers.
# ----------------------------------------------------------------------
# Reserved words
tokens = [
# Li... | StarcoderdataPython |
1657031 | # -*- coding: utf-8 -*-
# standard system of measurement in United States, also known as
# ``british`` or ``imperial`` system
IMPERIAL = 'imperial'
# metric system of measurement..
METRIC = 'metric'
| StarcoderdataPython |
1798963 | <filename>src/tutorial/employee.py
"""
Automatically generated by Zserio Python extension version 2.4.0.
Generator setup: writerCode, pubsubCode, serviceCode, sqlCode.
"""
from __future__ import annotations
import typing
import zserio
import tutorial.experience
import tutorial.role
class Employee:
def __init__(... | StarcoderdataPython |
3496462 | import sys
import requests
import logging
from io import StringIO, BytesIO
from japrp.app.main_window import Ui_MainWindow
from PyQt5.QtWidgets import *
from PyQt5.QtCore import Qt, pyqtSlot, QTimer
from PyQt5.QtGui import QPixmap
from japrp.app_parts.qt_search import ClickableSearchResult
from japrp.parser import Radi... | StarcoderdataPython |
294074 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import json
import jsonschema
from datetime import datetime
def get_route():
"""
Запросить данные о маршруте.
"""
destination = input("Пункт назначения? ")
number = input("Номер поезда? ")
time = input("Время отправления?(формат чч:мм)... | StarcoderdataPython |
4861157 | import evaluate
from formulas import jaccard, ochiai, tarantula, ample, wong1, wong2, wong3, op1, op2, gp_list, gpif, gpasgn, gpcall, gpseq
import math
import sys
def compare_formula(spectra_list, f1, f2):
f1_list = list(map(lambda sp : f1(sp[0], sp[1], sp[2], sp[3]), spectra_list))
f2_list = list(map(lambda s... | StarcoderdataPython |
3372849 | <gh_stars>0
import os
import sys
import cv2
_IMAGE_SIZE = 512
image_folder = '/Users/kunato/Downloads/train/'
filenames = [os.path.join(image_folder, filename)
for filename in next(os.walk(image_folder))[-1]]
for fname in filenames:
print(
"\r>> Reading file [%s] image" % fname)
try:
... | StarcoderdataPython |
3514026 | #!/usr/bin/env python3
import time
from concurrent.futures import ThreadPoolExecutor
import concur as c
executor = ThreadPoolExecutor()
def timer():
yield from c.orr([c.text(""), c.button("Start timer")])
yield
future = executor.submit(lambda: time.sleep(3))
yield from c.orr([c.text("waiting for 3s... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.